Add new toolbox chart
This is a deployment toolbox which for now spawns the swh toolbox image with a scheduler remote configuration. For starters, it will allow to register new scheduler task types.
make helm-diff
happy [1].
helm template swh
actually happy (if called correctly) [2]
[1]
$ cd swh-charts
$ make helm-diff
./helm-diff.sh swh
[swh] Comparing changes between branches production and staging...
Switched to branch 'production'
Your branch is up to date with 'origin/production'.
[swh] Generate config in production branch for swh/values/default.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...
[swh] Generate config in production branch for swh/values/test-staging-rke2.yaml...
Switched to branch 'staging'
Your branch is ahead of 'origin/staging' by 1 commit.
(use "git push" to publish your local commits)
[swh] Generate config in staging branch for swh/values/default.yaml...
[swh] Generate config in staging branch for swh/values/production-cassandra.yaml...
[swh] Generate config in staging branch for swh/values/production.yaml...
[swh] Generate config in staging branch for swh/values/staging-cassandra.yaml...
[swh] Generate config in staging branch for swh/values/staging.yaml...
[swh] Generate config in staging branch for swh/values/test-staging-rke2.yaml...
------------- diff for swh/values/default.yaml -------------
No differences
------------- diff for swh/values/production-cassandra.yaml -------------
No differences
------------- diff for swh/values/production.yaml -------------
No differences
------------- diff for swh/values/staging-cassandra.yaml -------------
No differences
------------- diff for swh/values/staging.yaml -------------
--- /tmp/swh-chart.swh.7Z49sqpR/staging.yaml.before 2023-09-05 12:03:30.719478580 +0200
+++ /tmp/swh-chart.swh.7Z49sqpR/staging.yaml.after 2023-09-05 12:03:31.283478559 +0200
@@ -3210,20 +3210,31 @@
message.max.bytes: 524288000
privileged: true
object_types:
- snapshot
replayer:
error_reporter:
db: 1
host: redis-postgresql.redis
port: 6379
---
+# Source: swh/templates/toolbox/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: toolbox-template
+ namespace: swh
+data:
+ config.yml: |
+ - cls: remote
+ url: http://scheduler0.internal.staging.swh.network:5008
+---
# Source: swh/templates/utils/storage-utils.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: storage-utils
namespace: swh
data:
init-keyspace-py: |
from swh.core import config
from swh.storage.cassandra import create_keyspace
@@ -8715,20 +8726,74 @@
items:
- key: "config.yml.template"
path: "config.yml.template"
- name: storage-utils
configMap:
name: storage-utils
items:
- key: "init-keyspace-py"
path: "init-keyspace.py"
---
+# Source: swh/templates/toolbox/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: swh-toolbox
+ namespace: swh
+ labels:
+ app: swh-toolbox
+spec:
+ revisionHistoryLimit: 2
+ selector:
+ matchLabels:
+ app: swh-toolbox
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxSurge: 1
+ template:
+ metadata:
+ labels:
+ app: swh-toolbox
+ annotations:
+ # Force a rollout upgrade if the configuration changes
+ checksum/config: 0adebcc6762a4ff5e1b6b04cbd96e88e6fca087bba0ba1a4cf4aeef13a3b879b
+ spec:
+ containers:
+ - name: swh-toolbox
+ image: container-registry.softwareheritage.org/swh/infra/swh-apps/toolbox:20230905.1
+ imagePullPolicy: Always
+ resources:
+ requests:
+ memory: 256Mi
+ cpu: 250m
+ command:
+ - /bin/bash
+ args:
+ - -c
+ - /opt/swh/entrypoint.sh
+ - bash
+ env:
+ - name: SWH_CONFIG_FILENAME
+ value: /etc/swh/config.yml
+ volumeMounts:
+ - name: configuration
+ mountPath: /etc/swh
+ volumes:
+ - name: configuration
+ configMap:
+ name: toolbox-template
+ defaultMode: 0777
+ items:
+ - key: "config.yml"
+ path: "config.yml"
+---
# Source: swh/templates/graphql/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: swh
name: graphql-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
------------- diff for swh/values/test-staging-rke2.yaml -------------
--- /tmp/swh-chart.swh.7Z49sqpR/test-staging-rke2.yaml.before 2023-09-05 12:03:30.779478578 +0200
+++ /tmp/swh-chart.swh.7Z49sqpR/test-staging-rke2.yaml.after 2023-09-05 12:03:31.347478557 +0200
@@ -56,20 +56,31 @@
- 0.6
- 0.65
- 0.7
- 0.75
- 0.8
- 0.85
- 0.9
- 0.95
- 1.
---
+# Source: swh/templates/toolbox/configmap.yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: toolbox-template
+ namespace: swh
+data:
+ config.yml: |
+ - cls: remote
+ url: http://scheduler0.internal.staging.swh.network:5008
+---
# Source: swh/templates/utils/storage-utils.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: storage-utils
namespace: swh
data:
init-keyspace-py: |
from swh.core import config
from swh.storage.cassandra import create_keyspace
@@ -134,20 +145,74 @@
volumeMounts:
- name: config
mountPath: /etc/prometheus/statsd-mapping.yml
subPath: config.yml
readOnly: true
volumes:
- name: config
configMap:
name: prometheus-statsd-exporter
---
+# Source: swh/templates/toolbox/deployment.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: swh-toolbox
+ namespace: swh
+ labels:
+ app: swh-toolbox
+spec:
+ revisionHistoryLimit: 2
+ selector:
+ matchLabels:
+ app: swh-toolbox
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxSurge: 1
+ template:
+ metadata:
+ labels:
+ app: swh-toolbox
+ annotations:
+ # Force a rollout upgrade if the configuration changes
+ checksum/config: 0adebcc6762a4ff5e1b6b04cbd96e88e6fca087bba0ba1a4cf4aeef13a3b879b
+ spec:
+ containers:
+ - name: swh-toolbox
+ image: container-registry.softwareheritage.org/swh/infra/swh-apps/toolbox:20230905.1
+ imagePullPolicy: Always
+ resources:
+ requests:
+ memory: 256Mi
+ cpu: 250m
+ command:
+ - /bin/bash
+ args:
+ - -c
+ - /opt/swh/entrypoint.sh
+ - bash
+ env:
+ - name: SWH_CONFIG_FILENAME
+ value: /etc/swh/config.yml
+ volumeMounts:
+ - name: configuration
+ mountPath: /etc/swh
+ volumes:
+ - name: configuration
+ configMap:
+ name: toolbox-template
+ defaultMode: 0777
+ items:
+ - key: "config.yml"
+ path: "config.yml"
+---
# Source: swh/templates/statsd-exporter/servicemonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: swh-statsd-exporter
namespace: swh
spec:
endpoints:
- path: /metrics
port: http
./helm-diff.sh cluster-configuration
[cluster-configuration] Comparing changes between branches production and staging...
Switched to branch 'production'
Your branch is up to date with 'origin/production'.
[cluster-configuration] Generate config in production branch for cluster-configuration/values/admin-rke2.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/archive-production-rke2.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/archive-staging-rke2.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/gitlab-production.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/gitlab-staging.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/rancher.yaml...
[cluster-configuration] Generate config in production branch for cluster-configuration/values/test-staging-rke2.yaml...
Switched to branch 'staging'
Your branch is ahead of 'origin/staging' by 1 commit.
(use "git push" to publish your local commits)
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/admin-rke2.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/archive-production-rke2.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/archive-staging-rke2.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/gitlab-production.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/gitlab-staging.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/rancher.yaml...
[cluster-configuration] Generate config in staging branch for cluster-configuration/values/test-staging-rke2.yaml...
------------- diff for cluster-configuration/values/admin-rke2.yaml -------------
No differences
------------- diff for cluster-configuration/values/archive-production-rke2.yaml -------------
No differences
------------- diff for cluster-configuration/values/archive-staging-rke2.yaml -------------
No differences
------------- diff for cluster-configuration/values/gitlab-production.yaml -------------
No differences
------------- diff for cluster-configuration/values/gitlab-staging.yaml -------------
No differences
------------- diff for cluster-configuration/values/rancher.yaml -------------
No differences
------------- diff for cluster-configuration/values/test-staging-rke2.yaml -------------
No differences
cat helm-diff.sh >helm-diff
chmod a+x helm-diff
[2]
$ cd swh
$ chart=swh; helm template $chart $chart/ --values values-swh-application-versions.yaml --values $chart/values.yaml --values $chart/values/default.yaml --values $chart/values/staging.yaml | grep -i toolbox
install.go:200: [debug] Original chart version: ""
install.go:217: [debug] CHART PATH: /home/tony/work/swh/sysadm-environment/swh-charts/swh
# Source: swh/templates/toolbox/configmap.yaml
name: toolbox-template
# Source: swh/templates/toolbox/deployment.yaml
name: swh-toolbox
app: swh-toolbox
app: swh-toolbox
app: swh-toolbox
- name: swh-toolbox
image: container-registry.softwareheritage.org/swh/infra/swh-apps/toolbox:20230905.1
name: toolbox-template
Another commit adapts the lister configuration to reuse the same scheduler configuration than the one introduced in the new toolbox.
Edited by Antoine R. Dumont