diff --git a/swh/templates/loaders/deployment.yaml b/swh/templates/loaders/deployment.yaml index 2d14791..9d23064 100644 --- a/swh/templates/loaders/deployment.yaml +++ b/swh/templates/loaders/deployment.yaml @@ -1,125 +1,131 @@ {{ if .Values.loaders.enabled -}} {{- $configurationChecksum := include (print $.Template.BasePath "/loaders/configmap.yaml") . -}} {{- range $loader_type, $deployment_config := .Values.loaders.deployments -}} {{- $loader_name := ( print "loader-" $loader_type ) -}} {{- $image_name_key := ( print "swh_loader_" $loader_type "_image" ) -}} {{- $image_version_key := ( print $image_name_key "_version" ) -}} +# if defined at the "typed" loader level +{{- $local_container_image := get $deployment_config "image" }} +{{- $local_container_image_version := ( print $local_container_image "_version" ) }} +# otherwise if the global image is defined {{- $container_image := get $.Values $image_name_key }} {{- $container_image_version := get $.Values $image_version_key }} --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ $loader_name }} namespace: {{ $.Values.namespace }} labels: app: {{ $loader_name }} spec: revisionHistoryLimit: 2 selector: matchLabels: app: {{ $loader_name }} strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 template: metadata: labels: app: {{ $loader_name }} annotations: # Force a rollout upgrade if the configuration changes checksum/config: {{ $configurationChecksum | sha256sum }} spec: {{- if $.Values.loaders.affinity }} affinity: {{ toYaml $.Values.loaders.affinity | nindent 8 }} {{- end }} initContainers: - name: prepare-configuration image: debian:bullseye imagePullPolicy: Always envFrom: - secretRef: # define the ${host) values for configuration "celery > task_broker: " key name: amqp-access-credentials 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 containers: - name: loaders - {{ if $container_image -}} + {{ if $local_container_image -}} + image: {{ $local_container_image }}:{{ $local_container_image_version }} + {{ else if $container_image -}} image: {{ $container_image }}:{{ $container_image_version }} {{ else -}} image: {{ $.Values.swh_loaders_image }}:{{ $.Values.swh_loaders_image_version }} {{ end }} imagePullPolicy: Always command: - /opt/swh/entrypoint.sh resources: requests: memory: {{ get $deployment_config "requestedMemory" | default "512Mi" }} cpu: {{ get $deployment_config "requestedCpu" | default "500m" }} limits: memory: "4000Mi" cpu: "1200m" lifecycle: preStop: exec: command: ["kill", "1"] env: - name: STATSD_HOST value: {{ $.Values.statsdExternalHost | default "prometheus-statsd-exporter" }} - name: STATSD_PORT value: {{ $.Values.statsdPort | default "9125" | quote }} - name: CONCURRENCY value: {{ get $deployment_config "concurrency" | default 1 | quote }} - name: MAX_TASKS_PER_CHILD value: {{ get $deployment_config "maxTasksPerChild" | default 5 | quote }} - name: LOGLEVEL value: {{ get $deployment_config "logLevel" | default "INFO" | quote }} - name: SWH_CONFIG_FILENAME value: /etc/swh/config.yml - name: SWH_SENTRY_ENVIRONMENT value: {{ $.Values.sentry.environment }} - name: SWH_MAIN_PACKAGE value: {{ get $deployment_config "sentrySwhPackage" }} - name: SWH_SENTRY_DSN valueFrom: secretKeyRef: name: {{ $loader_name }}-sentry-secrets key: sentry-dsn # 'name' secret must exist & include key "host" optional: false volumeMounts: - name: configuration mountPath: /etc/swh volumes: - name: configuration emptyDir: {} - name: configuration-template configMap: name: {{ $loader_name }}-template defaultMode: 0777 items: - key: "config.yml.template" path: "config.yml.template" - key: "init-container-entrypoint.sh" path: "init-container-entrypoint.sh" - name: metadata-fetcher-credentials secret: secretName: metadata-fetcher-credentials optional: true {{ end }} {{- end -}} diff --git a/swh/values/staging.yaml b/swh/values/staging.yaml index 68c004a..448556c 100644 --- a/swh/values/staging.yaml +++ b/swh/values/staging.yaml @@ -1,148 +1,149 @@ sentry: environment: staging loaders: enabled: true storage: host: storage1.internal.staging.swh.network port: 5002 amqp: host: scheduler0.internal.staging.swh.network deployments: # bzr: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.bzr.tasks.LoadBazaar # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.bzr # cvs: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.cvs.tasks.LoadCvsRepository # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.cvs # hg: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.mercurial.tasks.LoadArchiveMercurial # - swh.loader.mercurial.tasks.LoadMercurial # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.mercurial highpriority: requestedMemory: 256Mi requestedCpu: 200m queues: - save_code_now:swh.loader.bzr.tasks.LoadBazaar - save_code_now:swh.loader.git.tasks.UpdateGitRepository - save_code_now:swh.loader.git.tasks.LoadDiskGitRepository - save_code_now:swh.loader.git.tasks.UncompressAndLoadDiskGitRepository - save_code_now:swh.loader.mercurial.tasks.LoadArchiveMercurial - save_code_now:swh.loader.mercurial.tasks.LoadMercurial - save_code_now:swh.loader.svn.tasks.LoadSvnRepository - save_code_now:swh.loader.svn.tasks.MountAndLoadSvnRepository - save_code_now:swh.loader.svn.tasks.DumpMountAndLoadSvnRepository - save_code_now:swh.loader.package.archive.tasks.LoadArchive autoScaling: queueThreshold: 10 maxReplicaCount: 3 sentrySwhPackage: swh.loader.highpriority git: requestedMemory: 256Mi requestedCpu: 200m queues: - swh.loader.git.tasks.UpdateGitRepository - swh.loader.git.tasks.LoadDiskGitRepository - swh.loader.git.tasks.UncompressAndLoadDiskGitRepository autoScaling: queueThreshold: 5 # spawn worker per increment of `value` messages maxReplicaCount: 3 sentrySwhPackage: swh.loader.git # maven: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.package.maven.tasks.LoadMaven # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.core # npm: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.package.npm.tasks.LoadNpm # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.core pypi: requestedMemory: 256Mi requestedCpu: 200m + image: swh_loader_highpriority_image queues: - swh.loader.package.pypi.tasks.LoadPyPI autoScaling: queueThreshold: 10 maxReplicaCount: 1 sentrySwhPackage: swh.loader.core # svn: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.svn.tasks.LoadSvnRepository # - swh.loader.svn.tasks.MountAndLoadSvnRepository # - swh.loader.svn.tasks.DumpMountAndLoadSvnRepository # autoScaling: # queueThreshold: 10 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.svn listers: enabled: true sentrySwhPackage: swh.lister storage: host: storage1.internal.staging.swh.network port: 5002 scheduler: host: scheduler0.internal.staging.swh.network port: 5008 amqp: host: scheduler0.internal.staging.swh.network deployments: gnu-full: queues: - swh.lister.gnu.tasks.GNUListerTask autoScaling: queueThreshold: 10 minReplicaCount: 0 maxReplicaCount: 1 graphql: enabled: true sentry_enabled: true backends: storage: host: webapp.internal.staging.swh.network port: 5002 search: host: search0.internal.staging.swh.network port: 5010 replicas: 1 gunicorn: threads: 4 workers: 2 timeout: 3600 ingress: enabled: true httpPath: / host: graphql.staging.swh.network logLevel: DEBUG diff --git a/values-swh-application-versions.yaml b/values-swh-application-versions.yaml index ebb7f65..0d5e47a 100644 --- a/values-swh-application-versions.yaml +++ b/values-swh-application-versions.yaml @@ -1,13 +1,15 @@ # This file references the last version of all the softwareheritage images # It's used to manage the automatic update of the environments swh_storage_replayer_image: softwareheritage/storage-replayer swh_storage_replayer_image_version: "20220819.1" swh_loaders_image: softwareheritage/loaders swh_loaders_image_version: "20220826.1" swh_loader_git_image: softwareheritage/loader_git swh_loader_git_image_version: "20220908.1" +swh_loader_highpriority_image: softwareheritage/loader_highpriority +swh_loader_highpriority_image_version: "20220908.1" swh_graphql_image: softwareheritage/graphql swh_graphql_image_version: "20220826.1" swh_listers_image: softwareheritage/lister swh_listers_image_version: "20220908.1"