diff --git a/swh/templates/checker-deposit/configmap.yaml b/swh/templates/checker-deposit/configmap.yaml index 8e45ff2..d86b13d 100644 --- a/swh/templates/checker-deposit/configmap.yaml +++ b/swh/templates/checker-deposit/configmap.yaml @@ -1,66 +1,66 @@ {{ if .Values.checker_deposit.enabled -}} --- apiVersion: v1 kind: ConfigMap metadata: name: checker-deposit-utils namespace: {{ $.Values.namespace }} data: pre-stop-idempotent.sh: | #!/bin/bash # pre-stop hook can be triggered multiple times but we want it to be applied only # once so container can warm-shutdown properly. # When celery receives multiple times the sigterm signal, this ends up doing an # immediate shutdown which prevents long-standing tasks to finish properly. set -ex WITNESS_FILE=/tmp/already-stopped # to support near-immediate concurrent calls sleep $(echo | awk '{print rand()}) if [ ! -e $WITNESS_FILE ]; then touch $WITNESS_FILE kill 1 fi --- apiVersion: v1 kind: ConfigMap metadata: name: checker-deposit-template namespace: {{ $.Values.namespace }} data: config.yml.template: | extraction_dir: "/tmp/swh.checker.deposit/" storage: cls: remote url: http://{{ .Values.checker_deposit.storage.host }}:{{ .Values.checker_deposit.storage.port }}/ celery: task_broker: amqp://${AMQP_USERNAME}:${AMQP_PASSWORD}@{{ .Values.checker_deposit.amqp.host }}:{{ .Values.checker_deposit.amqp.port }}/ task_acks_late: true task_modules: - swh.deposit.loader.tasks task_queues: - swh.deposit.loader.tasks.ChecksDepositTsk deposit: - url: https://{{ .Values.checker_deposit.host }}/1/private/ + url: https://{{ .Values.checker_deposit.deposit.host }}/1/private/ auth: username: ${DEPOSIT_USERNAME} password: ${DEPOSIT_PASSWORD} init-container-entrypoint.sh: | #!/bin/bash set -e CONFIG_FILE=/etc/swh/config.yml # substitute environment variables when creating the default config.yml eval echo \""$( $CONFIG_FILE exit 0 {{ end }} diff --git a/swh/templates/checker-deposit/deployment.yaml b/swh/templates/checker-deposit/deployment.yaml index 01f1b19..e5193a3 100644 --- a/swh/templates/checker-deposit/deployment.yaml +++ b/swh/templates/checker-deposit/deployment.yaml @@ -1,144 +1,144 @@ {{- $deployment_config := .Values.checker_deposit -}} {{ if $deployment_config.enabled -}} {{- $configurationChecksum := include (print $.Template.BasePath "/checker-deposit/configmap.yaml") . -}} --- apiVersion: apps/v1 kind: Deployment metadata: name: checker-deposit namespace: {{ $.Values.namespace }} labels: app: checker-deposit spec: revisionHistoryLimit: 2 selector: matchLabels: app: checker-deposit strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 template: metadata: labels: app: checker-deposit annotations: # Force a rollout upgrade if the configuration changes checksum/config: {{ $configurationChecksum | sha256sum }} spec: {{- if $.Values.checker_deposit.affinity }} affinity: {{ toYaml $.Values.checker_deposit.affinity | nindent 8 }} {{- end }} initContainers: - name: prepare-configuration image: debian:bullseye imagePullPolicy: Always env: - name: AMQP_USERNAME valueFrom: secretKeyRef: name: common-secrets key: rabbitmq-amqp-username # 'name' secret must exist & include that ^ key optional: false - name: AMQP_PASSWORD valueFrom: secretKeyRef: name: common-secrets key: rabbitmq-amqp-password # 'name' secret must exist & include that ^ key optional: false + - name: DEPOSIT_USERNAME + valueFrom: + secretKeyRef: + name: common-secrets + key: deposit-username + # 'name' secret must exist & include key "host" + optional: false + - name: DEPOSIT_PASSWORD + valueFrom: + secretKeyRef: + name: common-secrets + key: deposit-password + # 'name' secret must exist & include key "host" + optional: false command: - /entrypoint.sh volumeMounts: - name: configuration-template mountPath: /entrypoint.sh subPath: "init-container-entrypoint.sh" readOnly: true - name: configuration mountPath: /etc/swh - name: configuration-template mountPath: /etc/swh/configuration-template containers: - name: checker-deposit resources: requests: memory: {{ get $deployment_config "requestedMemory" | default "512Mi" }} cpu: {{ get $deployment_config "requestedCpu" | default "500m" }} limits: memory: "4000Mi" cpu: "1200m" image: {{ $.Values.swh_checker_deposit_image }}:{{ $.Values.swh_checker_deposit_image_version }} imagePullPolicy: Always command: - /bin/bash args: - -c - /opt/swh/entrypoint.sh lifecycle: preStop: exec: command: ["/pre-stop.sh"] env: - name: STATSD_HOST value: {{ $.Values.statsdExternalHost | default "prometheus-statsd-exporter" }} - name: STATSD_PORT value: {{ $.Values.statsdPort | default "9125" | quote }} - name: MAX_TASKS_PER_CHILD value: {{ get $deployment_config "maxTasksPerChild" | default 1 | quote }} - name: LOGLEVEL value: {{ get $deployment_config "logLevel" | default "INFO" | quote }} - name: SWH_CONFIG_FILENAME value: /etc/swh/config.yml - name: SWH_SENTRY_ENVIRONMENT value: {{ $.Values.sentry.environment }} - name: SWH_MAIN_PACKAGE value: swh.vault - name: SWH_SENTRY_DSN valueFrom: secretKeyRef: name: common-secrets key: checker-deposit-sentry-dsn # 'name' secret must exist & include key "host" optional: false - - name: DEPOSIT_USERNAME - valueFrom: - secretKeyRef: - name: common-secrets - key: deposit-username - # 'name' secret must exist & include key "host" - optional: false - - name: DEPOSIT_PASSWORD - valueFrom: - secretKeyRef: - name: common-secrets - key: deposit-username - # 'name' secret must exist & include key "host" - optional: false volumeMounts: - name: checker-deposit-utils mountPath: /pre-stop.sh subPath: "pre-stop.sh" - name: configuration mountPath: /etc/swh volumes: - name: configuration emptyDir: {} - name: configuration-template configMap: name: checker-deposit-template defaultMode: 0777 items: - key: "config.yml.template" path: "config.yml.template" - key: "init-container-entrypoint.sh" path: "init-container-entrypoint.sh" - name: checker-deposit-utils configMap: name: checker-deposit-utils defaultMode: 0777 items: - key: "pre-stop-idempotent.sh" path: "pre-stop.sh" {{ end }}