From 1a34942c798d59fedfd64c8713b129c7d6d68deb Mon Sep 17 00:00:00 2001 From: Pedro Moura Date: Wed, 6 Mar 2024 20:12:53 -0300 Subject: [PATCH] Planet: Add cronjob and PVC Signed-off-by: Pedro Moura --- playbooks/openshift-apps/planet.yml | 5 ++ roles/openshift-apps/planet/files/pvc.yml | 11 ++++ .../planet/templates/cronjob.yml | 62 +++++++++++++++++++ .../planet/templates/deployment.yml | 6 ++ 4 files changed, 84 insertions(+) create mode 100644 roles/openshift-apps/planet/files/pvc.yml create mode 100644 roles/openshift-apps/planet/templates/cronjob.yml diff --git a/playbooks/openshift-apps/planet.yml b/playbooks/openshift-apps/planet.yml index 502a1c30a2..dd9d8ea76a 100644 --- a/playbooks/openshift-apps/planet.yml +++ b/playbooks/openshift-apps/planet.yml @@ -73,3 +73,8 @@ app: planet template: deployment.yml objectname: deployment.yml + + - role: openshift/object + app: planet + template: cronjob.yml + objectname: cronjob.yml diff --git a/roles/openshift-apps/planet/files/pvc.yml b/roles/openshift-apps/planet/files/pvc.yml new file mode 100644 index 0000000000..9cfa5983e0 --- /dev/null +++ b/roles/openshift-apps/planet/files/pvc.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: planet-http-storage +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 50Mi + storageClassName: ocs-storagecluster-cephfs diff --git a/roles/openshift-apps/planet/templates/cronjob.yml b/roles/openshift-apps/planet/templates/cronjob.yml new file mode 100644 index 0000000000..3f5d7e141d --- /dev/null +++ b/roles/openshift-apps/planet/templates/cronjob.yml @@ -0,0 +1,62 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: build-planet + namespace: planet +spec: + schedule: '*/5 * * * *' + concurrencyPolicy: Forbid + suspend: false + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 1 + jobTemplate: + metadata: + name: build-planet + spec: + template: + spec: + containers: + - name: build-planet + image: image-registry.openshift-image-registry.svc:5000/planet/planet:latest + command: ["/bin/bash", "-c"] + # Running build_planet.py twice to bypass undefined method error + args: + - | + /usr/bin/python3 /pluto/build_planet.py + /usr/bin/python3 /pluto/build_planet.py + env: + - name: KRB5_CONFIG + value: '/etc/krb5/krb5.conf' + - name: KRB5_CLIENT_KTNAME + value: '/etc/keytabs/http' + - name: KRB5CCNAME + value: '/tmp/ccache' + volumeMounts: + - name: keytab-volume + mountPath: /etc/keytabs/http + subPath: http + readOnly: true + - name: krb-config-volume + mountPath: /etc/krb5 + readOnly: true + - name: ipa-config-volume + mountPath: /etc/ipa + readOnly: true + - name: planet-build-storage + mountPath: /var/www/html + readOnly: false + volumes: + - name: keytab-volume + secret: + secretName: planet-keytab-http + - name: krb-config-volume + configMap: + name: krb5-config + - name: ipa-config-volume + configMap: + name: ipa-client-config + - name: planet-build-storage + persistentVolumeClaim: + claimName: planet-http-storage + restartPolicy: OnFailure + terminationGracePeriodSeconds: 30 diff --git a/roles/openshift-apps/planet/templates/deployment.yml b/roles/openshift-apps/planet/templates/deployment.yml index d8ba4e5e75..7541082f85 100644 --- a/roles/openshift-apps/planet/templates/deployment.yml +++ b/roles/openshift-apps/planet/templates/deployment.yml @@ -41,6 +41,9 @@ spec: - name: ipa-config-volume mountPath: /etc/ipa readOnly: true + - name: planet-build-storage + mountPath: /var/www/html + readOnly: false volumes: - name: keytab-volume secret: @@ -51,3 +54,6 @@ spec: - name: ipa-config-volume configMap: name: ipa-client-config + - name: planet-build-storage + persistentVolumeClaim: + claimName: planet-http-storage