From 80364165e6cef78f67c428cc565c09fc6d24d084 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Fri, 2 Oct 2020 10:08:42 +0200 Subject: [PATCH] testdays: start the playbook and role to deploy this app in openshift Signed-off-by: Pierre-Yves Chibon --- playbooks/openshift-apps/testdays.yml | 44 +++++++++++++ .../openshift-apps/testdays/files/service.yml | 15 +++++ .../testdays/templates/buildconfig.yml | 30 +++++++++ .../testdays/templates/deploymentconfig.yml | 66 +++++++++++++++++++ .../testdays/templates/imagestream.yml | 10 +++ 5 files changed, 165 insertions(+) create mode 100644 playbooks/openshift-apps/testdays.yml create mode 100644 roles/openshift-apps/testdays/files/service.yml create mode 100644 roles/openshift-apps/testdays/templates/buildconfig.yml create mode 100644 roles/openshift-apps/testdays/templates/deploymentconfig.yml create mode 100644 roles/openshift-apps/testdays/templates/imagestream.yml diff --git a/playbooks/openshift-apps/testdays.yml b/playbooks/openshift-apps/testdays.yml new file mode 100644 index 0000000000..25b48beb33 --- /dev/null +++ b/playbooks/openshift-apps/testdays.yml @@ -0,0 +1,44 @@ +- name: make the app be real + hosts: os_masters_stg[0] #: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 + + roles: + - role: openshift/project + app: testdays + description: The Fedora QE testdays application + appowners: + - pingou + - frantisekz + tags: + - appowners + + - role: openshift/object + app: testdays + template: buildconfig.yml + objectname: buildconfig.yml + + - role: openshift/object + app: testdays + template: deploymentconfig.yml + objectname: deploymentconfig.yml + + - role: openshift/object + app: testdays + template: imagestream.yml + objectname: imagestream.yml + + - role: openshift/object + app: testdays + file: service.yml + objectname: service.yml + + - role: openshift/start-build + app: testdays + buildname: testdays-build + objectname: testdays-build diff --git a/roles/openshift-apps/testdays/files/service.yml b/roles/openshift-apps/testdays/files/service.yml new file mode 100644 index 0000000000..096b17a4d6 --- /dev/null +++ b/roles/openshift-apps/testdays/files/service.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: testdays + name: testdays +spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: testdays + deploymentconfig: testdays diff --git a/roles/openshift-apps/testdays/templates/buildconfig.yml b/roles/openshift-apps/testdays/templates/buildconfig.yml new file mode 100644 index 0000000000..4929fc0301 --- /dev/null +++ b/roles/openshift-apps/testdays/templates/buildconfig.yml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: BuildConfig +metadata: + name: testdays-build + labels: + environment: "testdays" +spec: + output: + to: + kind: ImageStreamTag + name: testdays:latest + source: + type: Git + git: + uri: https://pagure.io/fedora-qa/testdays-web.git +{% if env == 'staging' %} + ref: "develop" +{% else %} + ref: "production" +{% endif %} + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + namespace: openshift + name: python:3.6 + triggers: + - type: ConfigChange + - type: ImageChange diff --git a/roles/openshift-apps/testdays/templates/deploymentconfig.yml b/roles/openshift-apps/testdays/templates/deploymentconfig.yml new file mode 100644 index 0000000000..0892871ca1 --- /dev/null +++ b/roles/openshift-apps/testdays/templates/deploymentconfig.yml @@ -0,0 +1,66 @@ +--- +apiVersion: v1 +kind: DeploymentConfig +metadata: + labels: + app: testdays + service: testdays + name: testdays +spec: + replicas: 1 + selector: + app: testdays + deploymentconfig: testdays + strategy: + type: Recreate + template: + metadata: + labels: + app: testdays + deploymentconfig: testdays + spec: + containers: + - name: testdays + image: testdays:latest + command: ["container_start.sh", "runserver"] + ports: + - containerPort: 8080 + resources: {} + env: + - name: POSTGRESQL_USER + value: "{{ }}" + - name: POSTGRESQL_PASSWORD + value: "{{ }}" + - name: POSTGRESQL_DATABASE + value: "{{ }}" + - name: POSTGRESQL_SERVICE_HOST + value: "{{ }}" + - name: POSTGRESQL_SERVICE_PORT + value: "{{ }}" + - name: SECRET_KEY + value: "{{ }}" + - name: RESULTSDB_URL + value: "https://taskotron.fedoraproject.org/resultsdb/results" + readinessProbe: + timeoutSeconds: 1 + initialDelaySeconds: 5 + httpGet: + path: / + port: 8080 + livenessProbe: + timeoutSeconds: 1 + initialDelaySeconds: 30 + httpGet: + path: / + port: 8080 + + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - testdays + from: + kind: ImageStreamTag + name: testdays:latest diff --git a/roles/openshift-apps/testdays/templates/imagestream.yml b/roles/openshift-apps/testdays/templates/imagestream.yml new file mode 100644 index 0000000000..7ca675ae61 --- /dev/null +++ b/roles/openshift-apps/testdays/templates/imagestream.yml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: ImageStream +metadata: + name: testdays +spec: + lookupPolicy: + local: false +status: + dockerImageRepository: ""