Staging instance, all changes can be removed at any time

Skip to content

staging: Deploy AUR stack

Antoine R. Dumont requested to merge staging-deploy-aur-stack into production
swh-helm-diff
[swh] Comparing changes between branches production and staging-deploy-aur-stack (per environment)...
Switched to branch 'production'
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...
Switched to branch 'staging-deploy-aur-stack'
[swh] Generate config in staging-deploy-aur-stack branch for environment staging...
[swh] Generate config in staging-deploy-aur-stack branch for environment staging...
[swh] Generate config in staging-deploy-aur-stack branch for environment staging...
Switched to branch 'production'
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...
Switched to branch 'staging-deploy-aur-stack'
[swh] Generate config in staging-deploy-aur-stack branch for environment production...
[swh] Generate config in staging-deploy-aur-stack branch for environment production...
[swh] Generate config in staging-deploy-aur-stack branch for environment production...


------------- diff for environment staging namespace swh -------------

--- /tmp/swh-chart.swh.4Chp8jYw/staging-swh.before      2023-10-27 11:25:13.372992504 +0200
+++ /tmp/swh-chart.swh.4Chp8jYw/staging-swh.after       2023-10-27 11:25:14.040991805 +0200
@@ -422,20 +422,113 @@

     if [ ! -e $WITNESS_FILE ]; then
       touch $WITNESS_FILE
       kill 1
     fi
 ---
 # Source: swh/templates/listers/configmap.yaml
 apiVersion: v1
 kind: ConfigMap
 metadata:
+  name: lister-aur-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
+    celery:
+      task_broker: amqp://swhconsumer:${AMQP_PASSWORD}@scheduler0.internal.staging.swh.network:5672/%2f
+      task_acks_late: true
+      task_queues:
+      - swh.lister.aur.tasks.AurListerTask
+
+      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-bioconductor-template
   namespace: swh
 data:
   config.yml.template: |
     storage:
       cls: pipeline
       steps:
       - cls: retry
       - cls: remote
         url: http://storage1.internal.staging.swh.network:5002
@@ -14850,20 +14943,183 @@
           name: indexer-utils
           defaultMode: 0777
           items:
           - key: "pre-stop-idempotent.sh"
             path: "pre-stop.sh"
 ---
 # Source: swh/templates/listers/deployment.yaml
 apiVersion: apps/v1
 kind: Deployment
 metadata:
+  name: lister-aur
+  namespace: swh
+  labels:
+    app: lister-aur
+spec:
+  revisionHistoryLimit: 2
+  selector:
+    matchLabels:
+      app: lister-aur
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app: lister-aur
+      annotations:
+        # Force a rollout upgrade if the configuration changes
+        checksum/config: 5b52eea38d3cf1b693c9dcb36164188b6d285e55ef29586b783f0a83714a5338
+    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: IfNotPresent
+          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:20231012.1
+        imagePullPolicy: IfNotPresent
+        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-aur-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-bioconductor
   namespace: swh
   labels:
     app: lister-bioconductor
 spec:
   revisionHistoryLimit: 2
   selector:
     matchLabels:
       app: lister-bioconductor
   strategy:
@@ -23199,20 +23455,60 @@
       consumerGroup: swh-archive-stg-swh.indexer.journal_client.origin_intrinsic_metadata
       lagThreshold: "1000"
       offsetResetPolicy: earliest
     authenticationRef:
       name: keda-indexers-trigger-authentication-origin-intrinsic
 ---
 # Source: swh/templates/listers/keda-autoscaling.yaml
 apiVersion: keda.sh/v1alpha1
 kind: ScaledObject
 metadata:
+  name: lister-aur-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-aur
+    # 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-aur
+    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.aur.tasks.AurListerTask
+      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-bioconductor-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-bioconductor
     # envSourceContainerName: {container-name} # Optional. Default:
                                                # .spec.template.spec.containers[0]
@@ -24810,20 +25106,32 @@
     name: keda-indexers-kafka-secrets-origin-intrinsic
     key: tls
   - parameter: password
     name: swh-archive-broker-secret
     key: BROKER_USER_PASSWORD
 ---
 # Source: swh/templates/listers/keda-autoscaling.yaml
 apiVersion: keda.sh/v1alpha1
 kind: TriggerAuthentication
 metadata:
+  name: amqp-authentication-lister-aur
+  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-bioconductor
   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


------------- diff for environment staging namespace swh-cassandra -------------

--- /tmp/swh-chart.swh.4Chp8jYw/staging-swh-cassandra.before    2023-10-27 11:25:13.584992282 +0200
+++ /tmp/swh-chart.swh.4Chp8jYw/staging-swh-cassandra.after     2023-10-27 11:25:14.252991583 +0200
@@ -793,20 +793,123 @@

     root:
       level: "INFO"
       handlers:
       - console
 ---
 # Source: swh/templates/loaders/configmap.yaml
 apiVersion: v1
 kind: ConfigMap
 metadata:
+  name: loader-aur-template
+  namespace: swh-cassandra
+data:
+  config.yml.template: |
+    storage:
+      cls: pipeline
+      steps:
+      - cls: buffer
+        min_batch_size:
+          content: 100
+          content_bytes: 52428800
+          directory: 100
+          directory_entries: 500
+          extid: 100
+          release: 100
+          release_bytes: 52428800
+          revision: 100
+          revision_bytes: 52428800
+          revision_parents: 200
+      - cls: filter
+      - cls: retry
+      - cls: remote
+        url: http://storage:5002
+    celery:
+      task_broker: amqp://swhconsumer:${AMQP_PASSWORD}@scheduler0.internal.staging.swh.network:5672/%2f
+      task_acks_late: false
+      task_queues:
+      - swh.loader.package.aur.tasks.LoadAur
+
+      sentry_settings_for_celery_tasks:
+        __sentry-settings-for-celery-tasks__
+    metadata_fetcher_credentials:
+      __metadata-fetcher-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/metadata-fetcher/credentials
+    if [ -f $CREDS_LISTER_PATH ]; then
+      awk "/__metadata-fetcher-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/__metadata-fetcher-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/loaders/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
   name: loader-bioconductor-template
   namespace: swh-cassandra
 data:
   config.yml.template: |
     storage:
       cls: pipeline
       steps:
       - cls: buffer
         min_batch_size:
           content: 100
@@ -15034,20 +15137,186 @@
           secretName: sentry-settings-for-celery-tasks
           optional: true
 # if defined at the "typed" loader level
 # otherwise use the global image is defined First this needs to replace - in
 # $loader_type with "" to find the proper image name.
 ---
 # Source: swh/templates/loaders/deployment.yaml
 apiVersion: apps/v1
 kind: Deployment
 metadata:
+  name: loader-aur
+  namespace: swh-cassandra
+  labels:
+    app: loader-aur
+spec:
+  revisionHistoryLimit: 2
+  selector:
+    matchLabels:
+      app: loader-aur
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app: loader-aur
+      annotations:
+        # Force a rollout upgrade if the configuration changes
+        checksum/config: 01340f9c16b54582c60b051e1252c90a717dec61b6f7c7ea1a846fe67075aee2
+    spec:
+      affinity:
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            nodeSelectorTerms:
+            - matchExpressions:
+              - key: swh/loader
+                operator: In
+                values:
+                - "true"
+      priorityClassName: swh-cassandra-normal-workload
+
+      terminationGracePeriodSeconds: 3600
+      initContainers:
+        - name: prepare-configuration
+          image: debian:bullseye
+          imagePullPolicy: IfNotPresent
+          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: metadata-fetcher-credentials
+            mountPath: /etc/credentials/metadata-fetcher
+            readOnly: true
+
+          - name: sentry-settings-for-celery-tasks
+            mountPath: /etc/credentials/sentry-settings
+            readOnly: true
+      containers:
+      - name: loaders
+        image: container-registry.softwareheritage.org/swh/infra/swh-apps/loader_package:20231006.1
+
+        imagePullPolicy: IfNotPresent
+        command:
+          - /opt/swh/entrypoint.sh
+        resources:
+          requests:
+            memory: 512Mi
+            cpu: 500m
+        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: "10"
+        - 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: loader-utils
+            mountPath: /pre-stop.sh
+            subPath: "pre-stop.sh"
+          - name: configuration
+            mountPath: /etc/swh
+          - name: localstorage
+            mountPath: /tmp
+
+          - name: configuration-template
+            mountPath: /etc/swh/logging-configuration.yml
+            subPath: "logging-configuration.yml"
+            readOnly: true
+
+      volumes:
+      - name: localstorage
+        ephemeral:
+          volumeClaimTemplate:
+            metadata:
+              labels:
+                type: ephemeral-volume
+            spec:
+              accessModes:
+              - ReadWriteOnce
+              resources:
+                requests:
+                  storage: 100Gi
+              storageClassName: local-path
+      - name: configuration
+        emptyDir: {}
+      - name: configuration-template
+        configMap:
+          name: loader-aur-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: loader-utils
+        configMap:
+          name: loader-utils
+          defaultMode: 0777
+          items:
+          - key: "pre-stop-idempotent.sh"
+            path: "pre-stop.sh"
+      - name: metadata-fetcher-credentials
+        secret:
+          secretName: metadata-fetcher-credentials
+          optional: true
+
+      - name: sentry-settings-for-celery-tasks
+        secret:
+          secretName: sentry-settings-for-celery-tasks
+          optional: true
+# if defined at the "typed" loader level
+# otherwise use the global image is defined First this needs to replace - in
+# $loader_type with "" to find the proper image name.
+---
+# Source: swh/templates/loaders/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
   name: loader-bioconductor
   namespace: swh-cassandra
   labels:
     app: loader-bioconductor
 spec:
   revisionHistoryLimit: 2
   selector:
     matchLabels:
       app: loader-bioconductor
   strategy:
@@ -21289,20 +21558,56 @@
       excludeUnacknowledged: "false" # QueueLength should include unacked messages
                                      # Implies "http" protocol is used
       value: "10"
       queueName: swh.loader.package.archive.tasks.LoadTarball
       vhostName: /                   # Vhost to use for the connection
 ---
 # Source: swh/templates/loaders/keda-autoscaling.yaml
 apiVersion: keda.sh/v1alpha1
 kind: ScaledObject
 metadata:
+  name: loader-aur-operators
+  namespace: swh-cassandra
+spec:
+  scaleTargetRef:
+    apiVersion:    apps/v1     # Optional. Default: apps/v1
+    kind:          Deployment  # Optional. Default: Deployment
+    # Mandatory. Must be in same namespace as ScaledObject
+    name:          loader-aur
+    # envSourceContainerName: {container-name} # Optional. Default:
+                                               # .spec.template.spec.containers[0]
+  pollingInterval:  30                         # Optional. Default: 30 seconds
+  cooldownPeriod:   300                        # Optional. Default: 300 seconds
+  idleReplicaCount: 0                          # Set to 0 to stop all the workers when there is
+                                               # no activity on the queue
+  minReplicaCount:  0
+  maxReplicaCount:  1
+  triggers:
+  - type: rabbitmq
+    authenticationRef:
+      name: amqp-authentication-loader-aur
+    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: "10"
+      queueName: swh.loader.package.aur.tasks.LoadAur
+      vhostName: /                   # Vhost to use for the connection
+---
+# Source: swh/templates/loaders/keda-autoscaling.yaml
+apiVersion: keda.sh/v1alpha1
+kind: ScaledObject
+metadata:
   name: loader-bioconductor-operators
   namespace: swh-cassandra
 spec:
   scaleTargetRef:
     apiVersion:    apps/v1     # Optional. Default: apps/v1
     kind:          Deployment  # Optional. Default: Deployment
     # Mandatory. Must be in same namespace as ScaledObject
     name:          loader-bioconductor
     # envSourceContainerName: {container-name} # Optional. Default:
                                                # .spec.template.spec.containers[0]
@@ -22665,20 +22970,32 @@
   namespace: swh-cassandra
 spec:
   secretTargetRef:
   - parameter: host            # "host" is required by the scalerObject trigger metadata
     name: common-secrets
     key: rabbitmq-http-host
 ---
 # Source: swh/templates/loaders/keda-authentication.yaml
 apiVersion: keda.sh/v1alpha1
 kind: TriggerAuthentication
+metadata:
+  name: amqp-authentication-loader-aur
+  namespace: swh-cassandra
+spec:
+  secretTargetRef:
+  - parameter: host            # "host" is required by the scalerObject trigger metadata
+    name: common-secrets
+    key: rabbitmq-http-host
+---
+# Source: swh/templates/loaders/keda-authentication.yaml
+apiVersion: keda.sh/v1alpha1
+kind: TriggerAuthentication
 metadata:
   name: amqp-authentication-loader-bioconductor
   namespace: swh-cassandra
 spec:
   secretTargetRef:
   - parameter: host            # "host" is required by the scalerObject trigger metadata
     name: common-secrets
     key: rabbitmq-http-host
 ---
 # Source: swh/templates/loaders/keda-authentication.yaml


------------- diff for environment staging namespace swh-cassandra-next-version -------------

--- /tmp/swh-chart.swh.4Chp8jYw/staging-swh-cassandra-next-version.before       2023-10-27 11:25:13.816992039 +0200
+++ /tmp/swh-chart.swh.4Chp8jYw/staging-swh-cassandra-next-version.after        2023-10-27 11:25:14.476991349 +0200
@@ -587,20 +587,123 @@

     root:
       level: "INFO"
       handlers:
       - console
 ---
 # Source: swh/templates/loaders/configmap.yaml
 apiVersion: v1
 kind: ConfigMap
 metadata:
+  name: loader-aur-template
+  namespace: swh-cassandra-next-version
+data:
+  config.yml.template: |
+    storage:
+      cls: pipeline
+      steps:
+      - cls: buffer
+        min_batch_size:
+          content: 100
+          content_bytes: 52428800
+          directory: 100
+          directory_entries: 500
+          extid: 100
+          release: 100
+          release_bytes: 52428800
+          revision: 100
+          revision_bytes: 52428800
+          revision_parents: 200
+      - cls: filter
+      - cls: retry
+      - cls: remote
+        url: http://storage:5002
+    celery:
+      task_broker: amqp://swhconsumer:${AMQP_PASSWORD}@scheduler0.internal.staging.swh.network:5672/%2f
+      task_acks_late: false
+      task_queues:
+      - swh.loader.package.aur.tasks.LoadAur
+
+      sentry_settings_for_celery_tasks:
+        __sentry-settings-for-celery-tasks__
+    metadata_fetcher_credentials:
+      __metadata-fetcher-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/metadata-fetcher/credentials
+    if [ -f $CREDS_LISTER_PATH ]; then
+      awk "/__metadata-fetcher-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/__metadata-fetcher-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/loaders/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
   name: loader-bioconductor-template
   namespace: swh-cassandra-next-version
 data:
   config.yml.template: |
     storage:
       cls: pipeline
       steps:
       - cls: buffer
         min_batch_size:
           content: 100
@@ -14496,20 +14599,186 @@
           secretName: sentry-settings-for-celery-tasks
           optional: true
 # if defined at the "typed" loader level
 # otherwise use the global image is defined First this needs to replace - in
 # $loader_type with "" to find the proper image name.
 ---
 # Source: swh/templates/loaders/deployment.yaml
 apiVersion: apps/v1
 kind: Deployment
 metadata:
+  name: loader-aur
+  namespace: swh-cassandra-next-version
+  labels:
+    app: loader-aur
+spec:
+  revisionHistoryLimit: 2
+  selector:
+    matchLabels:
+      app: loader-aur
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app: loader-aur
+      annotations:
+        # Force a rollout upgrade if the configuration changes
+        checksum/config: 343ca3681dfd9add5d3375273079fe0d6aae9dfa1f9cb8f4319a3e38258b51c0
+    spec:
+      affinity:
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            nodeSelectorTerms:
+            - matchExpressions:
+              - key: swh/loader
+                operator: In
+                values:
+                - "true"
+      priorityClassName: swh-cassandra-next-version-normal-workload
+
+      terminationGracePeriodSeconds: 60
+      initContainers:
+        - name: prepare-configuration
+          image: debian:bullseye
+          imagePullPolicy: IfNotPresent
+          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: metadata-fetcher-credentials
+            mountPath: /etc/credentials/metadata-fetcher
+            readOnly: true
+
+          - name: sentry-settings-for-celery-tasks
+            mountPath: /etc/credentials/sentry-settings
+            readOnly: true
+      containers:
+      - name: loaders
+        image: container-registry.softwareheritage.org/swh/infra/swh-apps/loader_package:20231006.1
+
+        imagePullPolicy: IfNotPresent
+        command:
+          - /opt/swh/entrypoint.sh
+        resources:
+          requests:
+            memory: 512Mi
+            cpu: 500m
+        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: "10"
+        - 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: loader-utils
+            mountPath: /pre-stop.sh
+            subPath: "pre-stop.sh"
+          - name: configuration
+            mountPath: /etc/swh
+          - name: localstorage
+            mountPath: /tmp
+
+          - name: configuration-template
+            mountPath: /etc/swh/logging-configuration.yml
+            subPath: "logging-configuration.yml"
+            readOnly: true
+
+      volumes:
+      - name: localstorage
+        ephemeral:
+          volumeClaimTemplate:
+            metadata:
+              labels:
+                type: ephemeral-volume
+            spec:
+              accessModes:
+              - ReadWriteOnce
+              resources:
+                requests:
+                  storage: 100Gi
+              storageClassName: local-path
+      - name: configuration
+        emptyDir: {}
+      - name: configuration-template
+        configMap:
+          name: loader-aur-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: loader-utils
+        configMap:
+          name: loader-utils
+          defaultMode: 0777
+          items:
+          - key: "pre-stop-idempotent.sh"
+            path: "pre-stop.sh"
+      - name: metadata-fetcher-credentials
+        secret:
+          secretName: metadata-fetcher-credentials
+          optional: true
+
+      - name: sentry-settings-for-celery-tasks
+        secret:
+          secretName: sentry-settings-for-celery-tasks
+          optional: true
+# if defined at the "typed" loader level
+# otherwise use the global image is defined First this needs to replace - in
+# $loader_type with "" to find the proper image name.
+---
+# Source: swh/templates/loaders/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
   name: loader-bioconductor
   namespace: swh-cassandra-next-version
   labels:
     app: loader-bioconductor
 spec:
   revisionHistoryLimit: 2
   selector:
     matchLabels:
       app: loader-bioconductor
   strategy:
@@ -20679,20 +20948,56 @@
       excludeUnacknowledged: "false" # QueueLength should include unacked messages
                                      # Implies "http" protocol is used
       value: "1"
       queueName: swh.loader.package.archive.tasks.LoadTarball
       vhostName: /                   # Vhost to use for the connection
 ---
 # Source: swh/templates/loaders/keda-autoscaling.yaml
 apiVersion: keda.sh/v1alpha1
 kind: ScaledObject
 metadata:
+  name: loader-aur-operators
+  namespace: swh-cassandra-next-version
+spec:
+  scaleTargetRef:
+    apiVersion:    apps/v1     # Optional. Default: apps/v1
+    kind:          Deployment  # Optional. Default: Deployment
+    # Mandatory. Must be in same namespace as ScaledObject
+    name:          loader-aur
+    # envSourceContainerName: {container-name} # Optional. Default:
+                                               # .spec.template.spec.containers[0]
+  pollingInterval:  30                         # Optional. Default: 30 seconds
+  cooldownPeriod:   300                        # Optional. Default: 300 seconds
+  idleReplicaCount: 0                          # Set to 0 to stop all the workers when there is
+                                               # no activity on the queue
+  minReplicaCount:  0
+  maxReplicaCount:  1
+  triggers:
+  - type: rabbitmq
+    authenticationRef:
+      name: amqp-authentication-loader-aur
+    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: "10"
+      queueName: swh.loader.package.aur.tasks.LoadAur
+      vhostName: /                   # Vhost to use for the connection
+---
+# Source: swh/templates/loaders/keda-autoscaling.yaml
+apiVersion: keda.sh/v1alpha1
+kind: ScaledObject
+metadata:
   name: loader-bioconductor-operators
   namespace: swh-cassandra-next-version
 spec:
   scaleTargetRef:
     apiVersion:    apps/v1     # Optional. Default: apps/v1
     kind:          Deployment  # Optional. Default: Deployment
     # Mandatory. Must be in same namespace as ScaledObject
     name:          loader-bioconductor
     # envSourceContainerName: {container-name} # Optional. Default:
                                                # .spec.template.spec.containers[0]
@@ -21997,20 +22302,32 @@
   namespace: swh-cassandra-next-version
 spec:
   secretTargetRef:
   - parameter: host            # "host" is required by the scalerObject trigger metadata
     name: common-secrets
     key: rabbitmq-http-host
 ---
 # Source: swh/templates/loaders/keda-authentication.yaml
 apiVersion: keda.sh/v1alpha1
 kind: TriggerAuthentication
+metadata:
+  name: amqp-authentication-loader-aur
+  namespace: swh-cassandra-next-version
+spec:
+  secretTargetRef:
+  - parameter: host            # "host" is required by the scalerObject trigger metadata
+    name: common-secrets
+    key: rabbitmq-http-host
+---
+# Source: swh/templates/loaders/keda-authentication.yaml
+apiVersion: keda.sh/v1alpha1
+kind: TriggerAuthentication
 metadata:
   name: amqp-authentication-loader-bioconductor
   namespace: swh-cassandra-next-version
 spec:
   secretTargetRef:
   - parameter: host            # "host" is required by the scalerObject trigger metadata
     name: common-secrets
     key: rabbitmq-http-host
 ---
 # Source: swh/templates/loaders/keda-authentication.yaml


------------- diff for environment production namespace swh -------------

No differences


------------- diff for environment production namespace swh-cassandra -------------

No differences

Refs. swh/infra/sysadm-environment#5061 (closed)

Merge request reports

Loading