staging: Deploy D lang lister
New lister referenced. Helm diff happy [1]
[1]
$ make swh-helm-diff
make swh-helm-diff
./helm-diff.sh swh
[swh] Comparing changes between branches production and staging-add-dlang-lister...
Switched to branch 'production'
Your branch is behind 'origin/production' by 2 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
[swh] Generate config in production branch for swh/values/default.yaml...
[swh] Generate config in production branch for swh/values/minikube.yaml...
[swh] Generate config in production branch for swh/values/production-cassandra.yaml...
[swh] Generate config in production branch for swh/values/production.yaml...
[swh] Generate config in production branch for swh/values/staging-cassandra.yaml...
[swh] Generate config in production branch for swh/values/staging.yaml...
Switched to branch 'staging-add-dlang-lister'
[swh] Generate config in staging-add-dlang-lister branch for swh/values/default.yaml...
[swh] Generate config in staging-add-dlang-lister branch for swh/values/minikube.yaml...
[swh] Generate config in staging-add-dlang-lister branch for swh/values/production-cassandra.yaml...
[swh] Generate config in staging-add-dlang-lister branch for swh/values/production.yaml...
[swh] Generate config in staging-add-dlang-lister branch for swh/values/staging-cassandra.yaml...
[swh] Generate config in staging-add-dlang-lister branch for swh/values/staging.yaml...
------------- diff for swh/values/default.yaml -------------
No differences
------------- diff for swh/values/minikube.yaml -------------
No differences
------------- diff for swh/values/production-cassandra.yaml -------------
No differences
------------- diff for swh/values/production.yaml -------------
--- /tmp/swh-chart.swh.ETJGot9c/production.yaml.before 2023-09-28 18:28:26.170946321 +0200
+++ /tmp/swh-chart.swh.ETJGot9c/production.yaml.after 2023-09-28 18:28:27.330947804 +0200
@@ -23385,21 +23385,21 @@
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:
+ value: production
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
@@ -23505,21 +23505,21 @@
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:
+ value: production
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
@@ -23644,21 +23644,21 @@
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:
+ value: production
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
------------- diff for swh/values/staging-cassandra.yaml -------------
No differences
------------- diff for swh/values/staging.yaml -------------
--- /tmp/swh-chart.swh.ETJGot9c/staging.yaml.before 2023-09-28 18:28:26.606946878 +0200
+++ /tmp/swh-chart.swh.ETJGot9c/staging.yaml.after 2023-09-28 18:28:27.790948393 +0200
@@ -965,20 +965,115 @@
root:
level: "INFO"
handlers:
- console
---
# Source: swh/templates/listers/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
+ name: lister-dlang-template
+ namespace: swh
+data:
+ config.yml.template: |
+ storage:
+ cls: pipeline
+ steps:
+ - cls: retry
+ - cls: remote
+ url: http://storage1.internal.staging.swh.network:5002
+
+ scheduler:
+ cls: remote
+ url: http://scheduler.internal.staging.swh.network:80
+
+ celery:
+ task_broker: amqp://swhconsumer:${AMQP_PASSWORD}@scheduler0.internal.staging.swh.network:5672/%2f
+ task_acks_late: true
+ task_queues:
+ - swh.lister.dlang.tasks.DlangListerTask
+
+ sentry_settings_for_celery_tasks:
+ __sentry-settings-for-celery-tasks__
+ credentials:
+ __lister-credentials__
+ init-container-entrypoint.sh: |
+ #!/bin/bash
+
+ set -e
+
+ CONFIG_FILE=/etc/swh/config.yml
+ CONFIG_FILE_WIP=/tmp/wip-config.yml
+
+ # substitute environment variables when creating the default config.yml
+ eval echo \""$(</etc/swh/configuration-template/config.yml.template)"\" \
+ > $CONFIG_FILE
+
+
+ SENTRY_SETTINGS_PATH=/etc/credentials/sentry-settings/sentry_settings_for_celery_tasks
+ if [ -f $SENTRY_SETTINGS_PATH ]; then
+ awk "/__sentry-settings-for-celery-tasks__/{system(\"sed 's/^/ /g' $SENTRY_SETTINGS_PATH\");next}1" $CONFIG_FILE > $CONFIG_FILE_WIP
+ mv $CONFIG_FILE_WIP $CONFIG_FILE
+ else
+ sed -i 's/__sentry-settings-for-celery-tasks__//g' $CONFIG_FILE
+ fi
+
+ CREDS_LISTER_PATH=/etc/credentials/listers/credentials
+ if [ -f $CREDS_LISTER_PATH ]; then
+ awk "/__lister-credentials__/{system(\"sed 's/^/ /g' $CREDS_LISTER_PATH\");next}1" $CONFIG_FILE > $CONFIG_FILE_WIP
+ mv $CONFIG_FILE_WIP $CONFIG_FILE
+ else
+ sed -i 's/__lister-credentials__//g' $CONFIG_FILE
+ fi
+
+ exit 0
+
+
+ logging-configuration.yml: |
+ version: 1
+
+ handlers:
+ console:
+ class: logging.StreamHandler
+ formatter: json
+ stream: ext://sys.stdout
+
+ formatters:
+ json:
+ class: pythonjsonlogger.jsonlogger.JsonFormatter
+ # python-json-logger parses the format argument to get the variables it actually expands into the json
+ format: "%(asctime)s:%(threadName)s:%(pathname)s:%(lineno)s:%(funcName)s:%(task_name)s:%(task_id)s:%(name)s:%(levelname)s:%(message)s"
+
+ loggers:
+ celery:
+ level: "INFO"
+ amqp:
+ level: WARNING
+ urllib3:
+ level: WARNING
+ azure.core.pipeline.policies.http_logging_policy:
+ level: WARNING
+ swh:
+ level: "INFO"
+ celery.task:
+ level: "INFO"
+
+ root:
+ level: "INFO"
+ handlers:
+ - console
+---
+# Source: swh/templates/listers/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
name: lister-gitea-template
namespace: swh
data:
config.yml.template: |
storage:
cls: pipeline
steps:
- cls: retry
- cls: remote
url: http://storage1.internal.staging.swh.network:5002
@@ -15341,20 +15436,183 @@
- name: sentry-settings-for-celery-tasks
secret:
secretName: sentry-settings-for-celery-tasks
optional: true
# Set useJsonLogger to false to let the logs be plain text
---
# Source: swh/templates/listers/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
+ name: lister-dlang
+ namespace: swh
+ labels:
+ app: lister-dlang
+spec:
+ revisionHistoryLimit: 2
+ selector:
+ matchLabels:
+ app: lister-dlang
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxSurge: 1
+ template:
+ metadata:
+ labels:
+ app: lister-dlang
+ annotations:
+ # Force a rollout upgrade if the configuration changes
+ checksum/config: 2f017d8dfd67f5553e6603015631c2f6e53834feeffb4c098c8e5383534f0aed
+ spec:
+ affinity:
+
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: swh/lister
+ operator: In
+ values:
+ - "true"
+ priorityClassName: swh-normal-workload
+
+ terminationGracePeriodSeconds: 3600
+ initContainers:
+ - name: prepare-configuration
+ image: debian:bullseye
+ imagePullPolicy: Always
+ env:
+
+ - name: AMQP_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: amqp-secrets
+ key: swhconsumer-password
+ # 'name' secret must exist & include that ^ key
+ 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
+ - name: lister-credentials-secrets
+ mountPath: /etc/credentials/listers
+ readOnly: true
+
+ - name: sentry-settings-for-celery-tasks
+ mountPath: /etc/credentials/sentry-settings
+ readOnly: true
+ containers:
+ - name: listers
+ resources:
+ requests:
+ memory: 256Mi
+ cpu: 250m
+ image: container-registry.softwareheritage.org/swh/infra/swh-apps/lister:20230925.2
+ imagePullPolicy: Always
+ command:
+ - /bin/bash
+ args:
+ - -c
+ - /opt/swh/entrypoint.sh
+ lifecycle:
+ preStop:
+ exec:
+ command: ["/pre-stop.sh"]
+ env:
+ - name: STATSD_HOST
+ value: prometheus-statsd-exporter
+ - name: STATSD_PORT
+ value: "9125"
+ - name: MAX_TASKS_PER_CHILD
+ value: "1"
+ - name: LOGLEVEL
+ value: "INFO"
+ - name: SWH_CONFIG_FILENAME
+ value: /etc/swh/config.yml
+
+ - name: SWH_LOG_CONFIG
+ value: /etc/swh/logging-configuration.yml
+
+
+ - name: SWH_SENTRY_ENVIRONMENT
+ value: staging
+ - name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
+ value: "yes"
+ volumeMounts:
+ - name: lister-utils
+ mountPath: /pre-stop.sh
+ subPath: "pre-stop.sh"
+ - name: configuration
+ mountPath: /etc/swh
+
+ - name: configuration-template
+ mountPath: /etc/swh/logging-configuration.yml
+ subPath: "logging-configuration.yml"
+ readOnly: true
+
+ volumes:
+ - name: configuration
+ ephemeral:
+ volumeClaimTemplate:
+ metadata:
+ labels:
+ type: ephemeral-volume
+ spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 100Gi
+ storageClassName: local-path
+ - name: configuration-template
+ configMap:
+ name: lister-dlang-template
+ defaultMode: 0777
+ items:
+ - key: "config.yml.template"
+ path: "config.yml.template"
+ - key: "init-container-entrypoint.sh"
+ path: "init-container-entrypoint.sh"
+
+ - key: "logging-configuration.yml"
+ path: "logging-configuration.yml"
+
+ - name: lister-utils
+ configMap:
+ name: lister-utils
+ defaultMode: 0777
+ items:
+ - key: "pre-stop-idempotent.sh"
+ path: "pre-stop.sh"
+ - name: lister-credentials-secrets
+ secret:
+ secretName: lister-credentials-secrets
+ optional: true
+
+ - name: sentry-settings-for-celery-tasks
+ secret:
+ secretName: sentry-settings-for-celery-tasks
+ optional: true
+# Set useJsonLogger to false to let the logs be plain text
+---
+# Source: swh/templates/listers/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
name: lister-gitea
namespace: swh
labels:
app: lister-gitea
spec:
revisionHistoryLimit: 2
selector:
matchLabels:
app: lister-gitea
strategy:
@@ -18752,21 +19010,21 @@
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:
+ value: staging
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
@@ -18876,21 +19134,21 @@
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:
+ value: staging
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
@@ -19019,21 +19277,21 @@
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:
+ value: staging
- name: SWH_MAIN_PACKAGE
value: swh.scheduler
- name: SWH_SENTRY_DSN
valueFrom:
secretKeyRef:
name: scheduler-sentry-secrets
key: sentry-dsn
# if the setting doesn't exist, sentry issue pushes will be disabled
optional: false
- name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
@@ -21697,20 +21955,60 @@
vhostName: / # Optional. If not specified, use the vhost in the
# `host` connection string. Alternatively, you can
# use existing environment variables to read
# configuration from: See details in "Parameter
# list" section hostFromEnv: RABBITMQ_HOST%
---
# Source: swh/templates/listers/keda-autoscaling.yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
+ name: lister-dlang-operators
+ namespace: swh
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1 # Optional. Default: apps/v1
+ kind: Deployment # Optional. Default: Deployment
+ # Mandatory. Must be in same namespace as ScaledObject
+ name: lister-dlang
+ # envSourceContainerName: {container-name} # Optional. Default:
+ # .spec.template.spec.containers[0]
+ pollingInterval: 30 # Optional. Default: 30 seconds
+ cooldownPeriod: 3600 # Optional. Default: 300 seconds
+ idleReplicaCount: 0 # Optional. Must be less than
+ # minReplicaCount
+ minReplicaCount: 0
+ maxReplicaCount: 1
+ triggers:
+ - type: rabbitmq
+ authenticationRef:
+ name: amqp-authentication-lister-dlang
+ metadata:
+ protocol: auto # Optional. Specifies protocol to use,
+ # either amqp or http, or auto to
+ # autodetect based on the `host` value.
+ # Default value is auto.
+ mode: QueueLength # QueueLength to trigger on number of msgs in queue
+ excludeUnacknowledged: "false" # QueueLength should include unacked messages
+ # Implies "http" protocol is used
+ value: "1"
+ queueName: swh.lister.dlang.tasks.DlangListerTask
+ vhostName: / # Optional. If not specified, use the vhost in the
+ # `host` connection string. Alternatively, you can
+ # use existing environment variables to read
+ # configuration from: See details in "Parameter
+ # list" section hostFromEnv: RABBITMQ_HOST%
+---
+# Source: swh/templates/listers/keda-autoscaling.yaml
+apiVersion: keda.sh/v1alpha1
+kind: ScaledObject
+metadata:
name: lister-gitea-operators
namespace: swh
spec:
scaleTargetRef:
apiVersion: apps/v1 # Optional. Default: apps/v1
kind: Deployment # Optional. Default: Deployment
# Mandatory. Must be in same namespace as ScaledObject
name: lister-gitea
# envSourceContainerName: {container-name} # Optional. Default:
# .spec.template.spec.containers[0]
@@ -23075,20 +23373,32 @@
namespace: swh
spec:
secretTargetRef:
- parameter: host # "host" is required by the scalerObject trigger metadata
name: common-secrets
key: rabbitmq-http-host
---
# Source: swh/templates/listers/keda-autoscaling.yaml
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
+metadata:
+ name: amqp-authentication-lister-dlang
+ namespace: swh
+spec:
+ secretTargetRef:
+ - parameter: host # "host" is required by the scalerObject trigger metadata
+ name: common-secrets
+ key: rabbitmq-http-host
+---
+# Source: swh/templates/listers/keda-autoscaling.yaml
+apiVersion: keda.sh/v1alpha1
+kind: TriggerAuthentication
metadata:
name: amqp-authentication-lister-gitea
namespace: swh
spec:
secretTargetRef:
- parameter: host # "host" is required by the scalerObject trigger metadata
name: common-secrets
key: rabbitmq-http-host
---
# Source: swh/templates/listers/keda-autoscaling.yaml
Edited by Antoine R. Dumont