storage: Allow cronjob declarations to specific storage instance
This adds the specific storage cronjob template to declare cronjobs per storage deployment instance.
In a second commit, this adds the missing cronjob for the postgresql read-write storage instance.
make swh-helm-diff
[swh] Comparing changes between branches production and add-storage-create-object-reference-partitions-cronjob (per environment)...
Your branch is up to date with 'origin/production'.
[swh] Generate config in production branch for environment staging, namespace swh...
[swh] Generate config in production branch for environment staging, namespace swh-cassandra...
[swh] Generate config in production branch for environment staging, namespace swh-cassandra-next-version...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment staging...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment staging...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment staging...
Your branch is up to date with 'origin/production'.
[swh] Generate config in production branch for environment production, namespace swh...
[swh] Generate config in production branch for environment production, namespace swh-cassandra...
[swh] Generate config in production branch for environment production, namespace swh-cassandra-next-version...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment production...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment production...
[swh] Generate config in add-storage-create-object-reference-partitions-cronjob branch for environment production...
------------- diff for environment staging namespace swh -------------
--- /tmp/swh-chart.swh.ATidibRq/staging-swh.before 2023-12-06 11:53:54.773763966 +0100
+++ /tmp/swh-chart.swh.ATidibRq/staging-swh.after 2023-12-06 11:53:55.497762910 +0100
@@ -24665,20 +24665,115 @@
- name: configuration
emptyDir: {}
- name: configuration-template
configMap:
name: scheduler-update-metrics-configuration-template
items:
- key: "config.yml.template"
path: "config.yml.template"
restartPolicy: OnFailure
---
+# Source: swh/templates/storage/cronjob.yaml
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+ name: storage-postgresql-read-write-create-object-reference-partitions
+spec:
+ # By default, at 00:05 each first day of the month
+ schedule: "5 0 1 * *"
+ jobTemplate:
+ spec:
+ template:
+ spec:
+ initContainers:
+ - name: prepare-configuration
+ image: debian:bullseye
+ imagePullPolicy: IfNotPresent
+ command:
+ - /entrypoints/prepare-configuration.sh
+ env:
+
+
+ - name: POSTGRESQL_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: swh-postgresql-common-secret
+ key: postgres-swh-password
+ # 'name' secret must exist & include that ^ key
+ optional: false
+
+ volumeMounts:
+ - name: configuration
+ mountPath: /etc/swh
+ - name: configuration-template
+ mountPath: /etc/swh/configuration-template
+ - name: config-utils
+ mountPath: /entrypoints
+ readOnly: true
+ containers:
+ - name: storage-postgresql-read-write-create-object-reference-partitions
+ resources:
+ requests:
+ memory: 512Mi
+ cpu: 500m
+ image: container-registry.softwareheritage.org/swh/infra/swh-apps/storage:20231205.1
+ command:
+ - /opt/swh/entrypoint.sh
+ args:
+ - swh
+ - --log-level
+ - INFO
+ - storage
+ - create-object-reference-partitions
+ - "$(date +%Y-%m-%d)"
+ - "$(date -d '+1 month' +%Y-%m-%d)"
+ env:
+ - name: STATSD_HOST
+ value: prometheus-statsd-exporter
+ - name: STATSD_PORT
+ value: "9125"
+ - name: SWH_CONFIG_FILENAME
+ value: /etc/swh/config.yml
+ - name: LOG_LEVEL
+ value: INFO
+ - name: SWH_SENTRY_ENVIRONMENT
+ value: staging
+ - name: SWH_MAIN_PACKAGE
+ value: swh.storage
+ - name: SWH_SENTRY_DSN
+ valueFrom:
+ secretKeyRef:
+ name: common-secrets
+ key: storage-sentry-dsn
+ # if the setting doesn't exist, sentry issue pushes will be disabled
+ optional: false
+ - name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
+ value: "true"
+ imagePullPolicy: IfNotPresent
+ volumeMounts:
+ - name: configuration
+ mountPath: /etc/swh
+ volumes:
+ - name: configuration
+ emptyDir: {}
+ - name: configuration-template
+ configMap:
+ name: storage-postgresql-read-write-configuration-template
+ items:
+ - key: "config.yml.template"
+ path: "config.yml.template"
+ - name: config-utils
+ configMap:
+ name: config-utils
+ defaultMode: 0555
+ restartPolicy: OnFailure
+---
# Source: swh/templates/graphql/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: swh
name: graphql-ingress-default
annotations:
nginx.ingress.kubernetes.io/preserve-trailing-slash: "true"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: "false"
------------- diff for environment staging namespace swh-cassandra -------------
No differences
------------- diff for environment staging namespace swh-cassandra-next-version -------------
No differences
------------- diff for environment production namespace swh -------------
No differences
------------- diff for environment production namespace swh-cassandra -------------
No differences