Skip to content

Duplicate rpc service in swh-cassandra namespace

Antoine R. Dumont requested to merge mr/migrate-objstorage-to-cassandra into production

This is meant to be a mr that we will progressively merge/update once a review validates it. (I'll rename the source branch though).

services so far:

  • objstorage read-only [1]
  • ...
[1] diff
[swh] Comparing changes between branches production and mr/migrate-objstorage-to-cassandra (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 mr/migrate-objstorage-to-cassandra branch for environment staging...
[swh] Generate config in mr/migrate-objstorage-to-cassandra branch for environment staging...
[swh] Generate config in mr/migrate-objstorage-to-cassandra 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 mr/migrate-objstorage-to-cassandra branch for environment production...
[swh] Generate config in mr/migrate-objstorage-to-cassandra branch for environment production...
[swh] Generate config in mr/migrate-objstorage-to-cassandra branch for environment production...


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

     _        __  __
   _| |_   _ / _|/ _|  between /tmp/swh-chart.swh.nwr8AM2g/staging-swh.before, 139 documents
 / _' | | | | |_| |_       and /tmp/swh-chart.swh.nwr8AM2g/staging-swh.after, 139 documents
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned no differences
        |___/



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

     _        __  __
   _| |_   _ / _|/ _|  between /tmp/swh-chart.swh.nwr8AM2g/staging-swh-cassandra.before, 438 documents
 / _' | | | | |_| |_       and /tmp/swh-chart.swh.nwr8AM2g/staging-swh-cassandra.after, 438 documents
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned no differences
        |___/



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

     _        __  __
   _| |_   _ / _|/ _|  between /tmp/swh-chart.swh.nwr8AM2g/staging-swh-cassandra-next-version.before, 345 documents
 / _' | | | | |_| |_       and /tmp/swh-chart.swh.nwr8AM2g/staging-swh-cassandra-next-version.after, 345 documents
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned no differences
        |___/



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

     _        __  __
   _| |_   _ / _|/ _|  between /tmp/swh-chart.swh.nwr8AM2g/production-swh.before, 449 documents
 / _' | | | | |_| |_       and /tmp/swh-chart.swh.nwr8AM2g/production-swh.after, 449 documents
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned no differences
        |___/



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

     _        __  __
   _| |_   _ / _|/ _|  between /tmp/swh-chart.swh.nwr8AM2g/production-swh-cassandra.before, 126 documents
 / _' | | | | |_| |_       and /tmp/swh-chart.swh.nwr8AM2g/production-swh-cassandra.after, 131 documents
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned one difference
        |___/

(file level)
    ---
    # Source: swh/templates/objstorage/configmap.yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: objstorage-read-only-configuration-template
      namespace: swh-cassandra
    data:
      config.yml.template: |
        objstorage:
          cls: multiplexer
          objstorages:
          - cls: remote
            name: winery
            timeout:
            - 0.5
            - 10
            url: http://winery-read-only.internal.cea.swh.network
          - cls: remote
            name: banco
            url: http://objstorage-ro-banco-xfs-rpc-ingress
          - cls: remote
            name: saam
            url: http://objstorage-ro-saam-zfs-rpc-ingress
          readonly: true
        
    # Source: swh/templates/objstorage/configmap.yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
      namespace: swh-cassandra
      name: objstorage-read-only-configuration-logging
    data:
      logging-gunicorn.json: |
        {
          "disable_existing_loggers": true,
          "filters": {
            "throttle_accesslog": {
              "interval": 60,
              "status_codes": [
                200,
                400
              ]
            }
          },
          "formatters": {
            "default": {
              "class": "pythonjsonlogger.jsonlogger.JsonFormatter",
              "format": "[%(asctime)s: %(levelname)s/%(processName)s-%(process)d %(threadName)s(%(pathname)s:%(lineno)s:%(funcName)s)]%(name)s %(message)s"
            }
          },
          "handlers": {
            "console": {
              "class": "logging.StreamHandler",
              "formatter": "default",
              "level": "INFO",
              "stream": "ext://sys.stdout"
            }
          },
          "loggers": {
            "azure": {
              "level": "WARN"
            },
            "gunicorn": {
              "level": "INFO"
            },
            "gunicorn.access": {
              "filters": [
                "throttle_accesslog"
              ],
              "handlers": [
                "console"
              ],
              "level": "WARN"
            },
            "gunicorn.error": {
              "level": "INFO"
            },
            "swh": {
              "level": "INFO"
            },
            "swh.core.statsd": {
              "level": "INFO"
            }
          },
          "root": {
            "handlers": [
              "console"
            ],
            "level": "INFO"
          },
          "version": 1
        }
        
    # Source: swh/templates/objstorage/service.yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: objstorage-read-only
      namespace: swh-cassandra
      labels:
        app: objstorage-read-only
    spec:
      type: ClusterIP
      selector:
        app: objstorage-read-only
      ports:
      - port: 5003
        targetPort: 5003
        name: rpc
    # Source: swh/templates/objstorage/deployment.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      namespace: swh-cassandra
      name: objstorage-read-only
      labels:
        app: objstorage-read-only
    spec:
      revisionHistoryLimit: 2
      replicas: 2
      selector:
        matchLabels:
          app: objstorage-read-only
      strategy:
        type: RollingUpdate
        rollingUpdate:
          maxSurge: 1
      template:
        metadata:
          labels:
            app: objstorage-read-only
          annotations:
            checksum/config: f8fb65b61b6eae0d81033392986c7b686886dce813ab09c5c294fc54eb0eeaf7
            checksum/config-logging: 65a495137cae0c9727210602fb23f3cac4d45813c0a58df6225620e2fdef77c4
            checksum/config-utils: 13a26f6add17e96ce01550153c77dcd48de60241a3f4db3c93d5467234be2a7f
        spec:
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                - matchExpressions:
                  - key: swh/objstorage
                    operator: In
                    values:
                    - "true"
          priorityClassName: swh-cassandra-frontend-rpc
          initContainers:
          - name: prepare-configuration
            image: "container-registry.softwareheritage.org/swh/infra/swh-apps/utils:20231211.1"
            imagePullPolicy: IfNotPresent
            command:
            - /entrypoints/prepare-configuration.sh
            env: 
            volumeMounts:
            - name: configuration
              mountPath: /etc/swh
            - name: configuration-template
              mountPath: /etc/swh/configuration-template
            - name: config-utils
              mountPath: /entrypoints
              readOnly: true
          containers:
          - name: objstorage-read-only
            resources:
              requests:
                memory: 512Mi
                cpu: 500m
            image: "container-registry.softwareheritage.org/swh/infra/swh-apps/objstorage:20240910.1"
            imagePullPolicy: IfNotPresent
            ports:
            - containerPort: 5003
              name: rpc
            readinessProbe:
              httpGet:
                path: /
                port: rpc
              initialDelaySeconds: 15
              failureThreshold: 30
              periodSeconds: 5
            livenessProbe:
              tcpSocket:
                port: rpc
              initialDelaySeconds: 10
              periodSeconds: 5
            command:
            - /bin/bash
            args:
            - "-c"
            - /opt/swh/entrypoint.sh
            env:
            - name: WORKERS
              value: 4
            - name: THREADS
              value: 4
            - name: TIMEOUT
              value: 60
            - name: STATSD_HOST
              value: prometheus-statsd-exporter
            - name: STATSD_PORT
              value: 9125
            - name: STATSD_TAGS
              value: "deployment:objstorage-read-only"
            - name: STATSD_SERVICE_TYPE
              value: objstorage-read-only
            - name: SWH_LOG_LEVEL
              value: WARN
            - name: SWH_LOG_CONFIG_JSON
              value: /etc/swh/logging/logging-gunicorn.json
            - name: SWH_SENTRY_ENVIRONMENT
              value: production
            - name: SWH_MAIN_PACKAGE
              value: swh.objstorage
            - name: SWH_SENTRY_DSN
              valueFrom:
                secretKeyRef:
                  name: common-secrets
                  key: objstorage-sentry-dsn
                  # 'name' secret should exist & include key
    # if the setting doesn't exist, sentry pushes will be disabled
    optional: true
            - name: SWH_SENTRY_DISABLE_LOGGING_EVENTS
              value: "true"
            volumeMounts:
            - name: configuration
              mountPath: /etc/swh
            - name: configuration-logging
              mountPath: /etc/swh/logging
          volumes:
          - name: configuration
            emptyDir: {}
          - name: configuration-template
            configMap:
              name: objstorage-read-only-configuration-template
              items:
              - key: config.yml.template
                path: config.yml.template
          - name: configuration-logging
            configMap:
              name: objstorage-read-only-configuration-logging
              items:
              - key: logging-gunicorn.json
                path: logging-gunicorn.json
          - name: config-utils
            configMap:
              name: config-utils
              defaultMode: 0555
    # Source: swh/templates/objstorage/ingress.yaml
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      namespace: swh-cassandra
      name: objstorage-read-only-ingress-default
      labels:
        app: objstorage-read-only
        endpoint-definition: default
      annotations:
        nginx.ingress.kubernetes.io/client-body-buffer-size: 128K
        nginx.ingress.kubernetes.io/proxy-body-size: 4G
        nginx.ingress.kubernetes.io/proxy-buffering: on
        nginx.ingress.kubernetes.io/service-upstream: "true"
        nginx.ingress.kubernetes.io/whitelist-source-range: "10.42.0.0/16,10.43.0.0/16,127.0.0.0/8,192.168.100.0/24,192.168.101.0/24,192.168.200.0/22"
    spec:
      ingressClassName: nginx
      rules:
      - host: objstorage-read-only-rpc-ingress-swh-cassandra
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: objstorage-read-only
                port:
                  number: 5003

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

Edited by Antoine R. Dumont

Merge request reports

Loading