FPDC Openshift configuration

Signed-off-by: Clement Verna <cverna@tutanota.com>
This commit is contained in:
Clement Verna 2018-09-20 21:25:13 +02:00 committed by Kevin Fenzi
parent 7b2808a2cc
commit 41b9195cf5
6 changed files with 212 additions and 0 deletions

View file

@ -0,0 +1,56 @@
- name: make the app be real
hosts: os-masters-stg[0]
user: root
gather_facts: False
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
roles:
- role: openshift/project
app: fpdc
description: Fedora Product Definition Center
appowners:
- cverna
- abompard
- role: openshift/object
app: fpdc
template: imagestream.yml
objectname: imagestream.yml
- role: openshift/object
app: fpdc
template: buildconfig.yml
objectname: buildconfig.yml
- role: openshift/object
app: fpdc
template: configmap.yml
objectname: configmap.yml
- role: openshift/start-build
app: fpdc
buildname: coreos-build
objectname: coreos-build
- role: openshift/object
app: fpdc
file: service.yml
objectname: service.yml
- role: openshift/route
app: fpdc
routename: fpdc
host: "fpdc{{ env_suffix }}.fedoraproject.org"
serviceport: 8080-tcp
servicename: fpdc
- role: openshift/object
app: fpdc
file: deploymentconfig.yml
objectname: deploymentconfig.yml
- role: openshift/rollout
app: fpdc
dcname: fpdc

View file

@ -0,0 +1,58 @@
---
apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: fpdc
service: fpdc
name: fpdc
spec:
replicas: 2
selector:
app: fpdc
deploymentconfig: fpdc
strategy:
resources: {}
template:
metadata:
labels:
app: fpdc
deploymentconfig: fpdc
spec:
containers:
- image: fpdc:latest
name: fpdc
ports:
- containerPort: 8080
protocol: TCP
volumesMounts:
- name: config-volume
mountPath: /opt/app-root/src/fpdc/settings/
readOnly: true
readinessProbe:
timeoutSeconds: 1
initialDelaySeconds: 5
httpGet:
path: /
port: 8080
livenessProbe:
timeoutSeconds: 1
initialDelaySeconds: 30
httpGet:
path: /
port: 8080
volumes:
- name: config-volume
configMap:
name: fpdc-configmap
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- fpdc
from:
kind: ImageStreamTag
name: fpdc:latest

View file

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: fpdc
name: fpdc
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: fpdc
deploymentconfig: fpdc

View file

@ -0,0 +1,29 @@
apiVersion: v1
kind: BuildConfig
metadata:
name: fpdc-build
labels:
environment: "fpdc"
spec:
output:
to:
kind: ImageStreamTag
name: fpdc:latest
source:
type: Git
git:
uri: https://github.com/fedora-infra/fpdc.git
strategy:
type: Source
sourceStrategy:
from:
kind: ImageStreamTag
name: python:3.6
triggers:
{% if fpdc_github_secret is defined %}
- type: GitHub
github:
secret: "{{ fpdc_github_secret }}"
{% endif %}
- type: ConfigChange
- type: ImageChange

View file

@ -0,0 +1,43 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fpdc-configmap
labels:
app: fpdc
data:
prod.py: |-
# Django settings for fpdc project.
from base import *
{% if env == 'staging' %}
SECRET_KEY = '{{ stg_fpdc_secret_key }}'
{% else %}
SECRET_KEY = '{{ fpdc_secret_key }}'
{% endif %}
DEBUG = False
ALLOWED_HOSTS = []
{% if env == 'staging' %}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'fpdc',
'USER': 'fpdc',
'PASSWORD': '{{ fpdc_stg_db_pass }}',
'HOST': '{{ fpdc_stg_db_server }}',
'PORT': '',
}
}
{% else %}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'fpdc',
'USER': 'fpdc',
'PASSWORD': '{{ fpdc_db_pass }}',
'HOST': '{{ fpdc_db_server }}',
'PORT': '',
}
}
{% endif %}

View file

@ -0,0 +1,10 @@
---
apiVersion: v1
kind: ImageStream
metadata:
name: fpdc
spec:
lookupPolicy:
local: false
status:
dockerImageRepository: ""