diff --git a/playbooks/openshift-apps/fas-changes.yml b/playbooks/openshift-apps/fas-changes.yml new file mode 100644 index 0000000000..4138e8d682 --- /dev/null +++ b/playbooks/openshift-apps/fas-changes.yml @@ -0,0 +1,53 @@ +- name: make the app be real + hosts: os_masters[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 + + vars: + + roles: + - role: openshift/project + app: fas-changes + description: "Get last changed users in FAS" + appowners: + - abompard + tags: + - apply-appowners + + - role: openshift/imagestream + app: fas-changes + imagename: fas-changes + + - role: openshift/object + app: fas-changes + template: buildconfig.yml + objectname: buildconfig.yml + + - role: openshift/object + app: fas-changes + template: configmap.yml + objectname: configmap.yml + + - role: openshift/object + app: fas-changes + file: service.yml + objectname: service.yml + + - role: openshift/route + app: fas-changes + routename: fas-changes + host: "fas-changes.app.os{{ env_suffix }}.fedoraproject.org" + serviceport: web + servicename: fas-changes + annotations: + haproxy.router.openshift.io/timeout: 5m + + - role: openshift/object + app: fas-changes + template: deploymentconfig.yml + objectname: deploymentconfig.yml diff --git a/roles/openshift-apps/fas-changes/files/service.yml b/roles/openshift-apps/fas-changes/files/service.yml new file mode 100644 index 0000000000..7c9dfd1c83 --- /dev/null +++ b/roles/openshift-apps/fas-changes/files/service.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: fas-changes + labels: + app: fas-changes +spec: + ports: + - name: web + port: 8080 + targetPort: 8080 + selector: + app: fas-changes + deploymentconfig: fas-changes diff --git a/roles/openshift-apps/fas-changes/templates/buildconfig.yml b/roles/openshift-apps/fas-changes/templates/buildconfig.yml new file mode 100644 index 0000000000..c5d5843edb --- /dev/null +++ b/roles/openshift-apps/fas-changes/templates/buildconfig.yml @@ -0,0 +1,29 @@ +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: fas-changes + labels: + app: fas-changes + build: fas-changes +spec: + runPolicy: Serial + source: + type: Git + git: + uri: https://github.com/abompard/fas-changes.git + ref: main + contextDir: / + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + name: python:3.6 + namespace: openshift + output: + to: + kind: ImageStreamTag + name: fas-changes:latest + triggers: + - type: ConfigChange + - type: ImageChange diff --git a/roles/openshift-apps/fas-changes/templates/config.py b/roles/openshift-apps/fas-changes/templates/config.py new file mode 100644 index 0000000000..5dae092b70 --- /dev/null +++ b/roles/openshift-apps/fas-changes/templates/config.py @@ -0,0 +1,8 @@ +# +# This is the config file for FAS Changes as intended to be used in OpenShift +# + +DB_NAME = "fas2" +DB_HOST = "db-fas{{ env_suffix }}" +DB_USER = "fasreadonly" +DB_PASSWORD = "{{ fas_db_readonly_password }}" diff --git a/roles/openshift-apps/fas-changes/templates/configmap.yml b/roles/openshift-apps/fas-changes/templates/configmap.yml new file mode 100644 index 0000000000..08702af3f9 --- /dev/null +++ b/roles/openshift-apps/fas-changes/templates/configmap.yml @@ -0,0 +1,15 @@ +{% macro load_file(filename) %}{% include filename %}{%- endmacro -%} +--- +apiVersion: v1 +kind: List +metadata: {} +items: +- apiVersion: v1 + kind: ConfigMap + metadata: + name: fas-changes-config + labels: + app: fas-changes + data: + fas-changes.cfg: |- + {{ load_file('config.py') | indent(6) }} diff --git a/roles/openshift-apps/fas-changes/templates/deploymentconfig.yml b/roles/openshift-apps/fas-changes/templates/deploymentconfig.yml new file mode 100644 index 0000000000..be4030d4ce --- /dev/null +++ b/roles/openshift-apps/fas-changes/templates/deploymentconfig.yml @@ -0,0 +1,59 @@ +apiVersion: apps.openshift.io/v1 +kind: DeploymentConfig +metadata: + name: fas-changes + labels: + app: fas-changes +spec: + replicas: 1 + selector: + app: fas-changes + deploymentconfig: fas-changes + strategy: + type: Rolling + activeDeadlineSeconds: 21600 + rollingParams: + intervalSeconds: 1 + maxSurge: 25% + maxUnavailable: 25% + timeoutSeconds: 600 + updatePeriodSeconds: 1 + template: + metadata: + creationTimestamp: null + labels: + app: fas-changes + deploymentconfig: fas-changes + spec: + containers: + - name: fas-changes + imagePullPolicy: Always + ports: + - containerPort: 8080 + #protocol: TCP + #resources: {} + #terminationMessagePath: /dev/termination-log + #terminationMessagePolicy: File + volumeMounts: + - name: fas-changes-config-volume + mountPath: "/etc/fas-changes" + readOnly: true + env: + - name: FLASK_SETTINGS + value: "/etc/fas-changes/fas-changes.cfg" + # - name: SCRIPT_NAME + # value: "/fas-changes" + volumes: + - name: fas-changes-config-volume + configMap: + name: fas-changes-config + triggers: + - imageChangeParams: + automatic: true + containerNames: + - fas-changes + from: + kind: ImageStreamTag + name: fas-changes:latest + type: ImageChange + - type: ConfigChange