Skip to content

production/objstorage: Deploy read-only instance on rancher agent saam

Antoine R. Dumont requested to merge migrate-objstorage-rpc into staging

This deploys a new read-only objstorage instance on the rancher node saam (node selection by hostname and of a the specific affinity swh/objstorage-pathslicing=true). This instance can only be deployed on saam to access its /srv/softwareheritage/objects partition mounted read-only.

In terms of resources, we match saam's current gunicorn resources of 16 workers with 2 replicas with each 4 workers (2 threads per worker).

The name of the service & ingress are explicit to avoid name conflict ambiguity on the various read-only services we have.

make swh-helm-diff (objstorage)
[swh] Comparing changes between branches production and migrate-objstorage-rpc (per environment)...
Your branch is ahead of 'origin/production' by 4 commits.
  (use "git push" to publish your local commits)
[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 migrate-objstorage-rpc branch for environment staging...
[swh] Generate config in migrate-objstorage-rpc branch for environment staging...
[swh] Generate config in migrate-objstorage-rpc branch for environment staging...
Your branch is ahead of 'origin/production' by 4 commits.
  (use "git push" to publish your local commits)
[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 migrate-objstorage-rpc branch for environment production...
[swh] Generate config in migrate-objstorage-rpc branch for environment production...
[swh] Generate config in migrate-objstorage-rpc branch for environment production...


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

No differences


------------- 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
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   migrate-objstorage-rpc  8⚑  %  gco staging
Switched to branch 'staging'
Your branch is ahead of 'origin/staging' by 4 commits.
  (use "git push" to publish your local commits)
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   staging  4⬆  8⚑  %  git reset --hard origin/staging
HEAD is now at 0fd15e0 production/storage: Open read-only access to vpn
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   staging  8⚑  %  gco production
Switched to branch 'production'
Your branch is ahead of 'origin/production' by 4 commits.
  (use "git push" to publish your local commits)
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   production  4⬆  8⚑  %  git reset --hard origin/production
HEAD is now at 0fd15e0 production/storage: Open read-only access to vpn
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   production  8⚑  % 
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   production  8⚑  %  gco migrate-objstorage-rpc
Switched to branch 'migrate-objstorage-rpc'
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   migrate-objstorage-rpc  8⚑  % 
 swh-3.10.9  tony  yavin4  ~  work  swh  sysadm-environment  swh-charts   migrate-objstorage-rpc  8⚑  %  make swh-helm-diff | colordiff
Switched to branch 'production'
Switched to branch 'migrate-objstorage-rpc'
Switched to branch 'production'
Switched to branch 'migrate-objstorage-rpc'
./swh/helm-diff.sh
[swh] Comparing changes between branches production and migrate-objstorage-rpc (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 migrate-objstorage-rpc branch for environment staging...
[swh] Generate config in migrate-objstorage-rpc branch for environment staging...
[swh] Generate config in migrate-objstorage-rpc 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 migrate-objstorage-rpc branch for environment production...
[swh] Generate config in migrate-objstorage-rpc branch for environment production...
[swh] Generate config in migrate-objstorage-rpc branch for environment production...


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

No differences


------------- 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 -------------

--- /tmp/swh-chart.swh.WEHo0k1x/production-swh.before   2024-01-24 10:24:24.069855769 +0100
+++ /tmp/swh-chart.swh.WEHo0k1x/production-swh.after    2024-01-24 10:24:24.549855022 +0100
@@ -5590,20 +5590,37 @@
         storage_conf:
           cls: remote
           url: http://banco.internal.softwareheritage.org:5003/
       - cls: filtered
         filters_conf:
         - type: readonly
         storage_conf:
           cls: remote
           url: http://saam.internal.softwareheritage.org:5003/
 ---
+# Source: swh/templates/objstorage/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  namespace: swh
+  name: objstorage-ro-saam-zfs-configuration-template
+data:
+  config.yml.template: |
+    objstorage:
+      client_max_size: 1073741824
+      cls: multiplexer
+      objstorages:
+      - cls: pathslicing
+        compression: none
+        root: /srv/softwareheritage/objects
+        slicing: 0:2/0:5
+---
 # Source: swh/templates/scheduler/extra-services-configmap.yaml
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: extra-services-configuration-template
   namespace: swh
 data:
   config.yml.template: |
     scheduler:
       cls: remote
@@ -16595,20 +16612,30 @@
   name: objstorage-read-only-rpc-ingress
   namespace: swh
 spec:
   type: ExternalName
   externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
 ---
 # Source: swh/templates/external-services/cname.yaml
 apiVersion: v1
 kind: Service
 metadata:
+  name: objstorage-ro-saam-zfs-rpc-ingress
+  namespace: swh
+spec:
+  type: ExternalName
+  externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
+---
+# Source: swh/templates/external-services/cname.yaml
+apiVersion: v1
+kind: Service
+metadata:
   name: search-rpc-ingress
   namespace: swh
 spec:
   type: ExternalName
   externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
 ---
 # Source: swh/templates/external-services/cname.yaml
 apiVersion: v1
 kind: Service
 metadata:
@@ -16717,20 +16744,35 @@
   namespace: swh
 spec:
   type: ClusterIP
   selector:
     app: objstorage-read-only
   ports:
     - port: 5003
       targetPort: 5003
       name: rpc
 ---
+# Source: swh/templates/objstorage/service.yaml
+apiVersion: v1
+kind: Service
+metadata:
+  name: objstorage-ro-saam-zfs
+  namespace: swh
+spec:
+  type: ClusterIP
+  selector:
+    app: objstorage-ro-saam-zfs
+  ports:
+    - port: 5003
+      targetPort: 5003
+      name: rpc
+---
 # Source: swh/templates/scheduler/rpc-service.yaml
 apiVersion: v1
 kind: Service
 metadata:
   name: scheduler-rpc
   namespace: swh
 spec:
   type: ClusterIP
   selector:
     app: scheduler-rpc
@@ -26934,20 +26976,159 @@
         configMap:
           name: objstorage-read-only-configuration-template
           items:
           - key: "config.yml.template"
             path: "config.yml.template"
       - name: config-utils
         configMap:
           name: config-utils
           defaultMode: 0555
 ---
+# Source: swh/templates/objstorage/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  namespace: swh
+  name: objstorage-ro-saam-zfs
+  labels:
+    app: objstorage-ro-saam-zfs
+spec:
+  revisionHistoryLimit: 2
+  replicas: 2
+  selector:
+    matchLabels:
+      app: objstorage-ro-saam-zfs
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        app: objstorage-ro-saam-zfs
+      annotations:
+        checksum/config: 9216d3d7df2dc2d0ec2cb467c891a45ee3f345b6ea3f491282a7e70a0da7bc08
+        checksum/config-utils: 0cce256531366ac8ea2a0bde2a8f10937284a0f599f45fabe6babbbc096e179d
+    spec:
+      nodeSelector:
+        kubernetes.io/hostname: saam
+      affinity:
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            nodeSelectorTerms:
+            - matchExpressions:
+              - key: swh/objstorage-pathslicing
+                operator: In
+                values:
+                - "true"
+      priorityClassName: swh-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-ro-saam-zfs
+          resources:
+            requests:
+              memory: 1024Mi
+              cpu: 250m
+          image: container-registry.softwareheritage.org/swh/infra/swh-apps/objstorage:20240117.3
+          imagePullPolicy: IfNotPresent
+          ports:
+            - containerPort: 5003
+              name: rpc
+          readinessProbe:
+            httpGet:
+              path: /
+              port: rpc
+            initialDelaySeconds: 15
+            failureThreshold: 30
+            periodSeconds: 5
+          livenessProbe:
+            httpGet:
+              path: /
+              port: rpc
+            initialDelaySeconds: 10
+            periodSeconds: 5
+          command:
+          - /bin/bash
+          args:
+          - -c
+          - /opt/swh/entrypoint.sh
+          env:
+            - name: THREADS
+              value: "2"
+            - name: WORKERS
+              value: "4"
+            - name: TIMEOUT
+              value: "3600"
+            - name: STATSD_HOST
+              value: prometheus-statsd-exporter
+            - name: STATSD_PORT
+              value: "9125"
+            - name: LOG_LEVEL
+              value: "INFO"
+            - 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: pathslicing-ro
+            mountPath: /srv/softwareheritage/objects
+            readOnly: false
+
+      volumes:
+      - name: configuration
+        emptyDir: {}
+      - name: configuration-template
+        configMap:
+          name: objstorage-ro-saam-zfs-configuration-template
+          items:
+          - key: "config.yml.template"
+            path: "config.yml.template"
+      - name: config-utils
+        configMap:
+          name: config-utils
+          defaultMode: 0555
+
+      - name: pathslicing-ro
+
+        hostPath:
+          path: /srv/softwareheritage/objects
+          readOnly: true
+          type: Directory
+---
 # Source: swh/templates/scheduler/extra-services-deployment.yaml
 apiVersion: apps/v1
 kind: Deployment
 metadata:
   namespace: swh
   name: scheduler-listener
   labels:
     app: scheduler-listener
 spec:
   revisionHistoryLimit: 2
@@ -32044,20 +32225,47 @@
     http:
       paths:
       - path: /
         pathType: Prefix
         backend:
           service:
             name: objstorage-read-only
             port:
               number: 5003
 ---
+# Source: swh/templates/objstorage/ingress.yaml
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  namespace: swh
+  name: objstorage-ro-saam-zfs-ingress-default
+  annotations:
+    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.200.0/22
+    nginx.ingress.kubernetes.io/client-body-buffer-size: 128K
+    nginx.ingress.kubernetes.io/proxy-body-size: 4G
+    nginx.ingress.kubernetes.io/proxy-buffering: "on"
+
+spec:
+  ingressClassName: nginx
+  rules:
+  - host: objstorage-ro-saam-zfs-rpc-ingress
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: objstorage-ro-saam-zfs
+            port:
+              number: 5003
+---
 # Source: swh/templates/scheduler/rpc-ingress.yaml
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   namespace: swh
   name: scheduler-rpc-ingress-default
   annotations:
     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.130.221,192.168.200.0/22
     nginx.ingress.kubernetes.io/proxy-body-size: 4G


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

--- /tmp/swh-chart.swh.WEHo0k1x/production-swh-cassandra.before 2024-01-24 10:24:24.229855520 +0100
+++ /tmp/swh-chart.swh.WEHo0k1x/production-swh-cassandra.after  2024-01-24 10:24:24.713854766 +0100
@@ -11254,20 +11254,30 @@
   name: objstorage-read-only-rpc-ingress
   namespace: swh-cassandra
 spec:
   type: ExternalName
   externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
 ---
 # Source: swh/templates/external-services/cname.yaml
 apiVersion: v1
 kind: Service
 metadata:
+  name: objstorage-ro-saam-zfs-rpc-ingress
+  namespace: swh-cassandra
+spec:
+  type: ExternalName
+  externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
+---
+# Source: swh/templates/external-services/cname.yaml
+apiVersion: v1
+kind: Service
+metadata:
   name: search-rpc-ingress
   namespace: swh-cassandra
 spec:
   type: ExternalName
   externalName: archive-production-rke2-ingress-nginx-controller.ingress-nginx.svc.cluster.local
 ---
 # Source: swh/templates/external-services/cname.yaml
 apiVersion: v1
 kind: Service
 metadata:

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

Edited by Antoine R. Dumont

Merge request reports

Loading