{{- $root := . }} {{- range .Values.workloads }} {{- $n := .replicas | default 1 | int }} {{- if and .replicaKey (hasKey $root.Values.replicas .replicaKey) }} {{- $n = index $root.Values.replicas .replicaKey | int }} {{- end }} {{- $vols := or .config (not (empty .mounts)) }} --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ .name }} labels: app.kubernetes.io/component: {{ .name }} {{- include "onelab.labels" $root | nindent 4 }} annotations: argocd.argoproj.io/sync-wave: {{ $root.Values.syncWaves.apps | quote }} spec: replicas: {{ $n }} selector: matchLabels: app.kubernetes.io/component: {{ .name }} app.kubernetes.io/name: {{ include "onelab.name" $root }} app.kubernetes.io/instance: {{ $root.Release.Name }} template: metadata: labels: app.kubernetes.io/component: {{ .name }} app.kubernetes.io/name: {{ include "onelab.name" $root }} app.kubernetes.io/instance: {{ $root.Release.Name }} spec: {{- with $root.Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .name }} image: {{ printf "%s/%s:%s" $root.Values.images.registry .image $root.Values.images.tag | quote }} {{- if .port }} ports: - containerPort: {{ .port }} name: http {{- end }} {{- if and .website (not $root.Values.website.ssr) }} env: - name: RENDERING_MODE value: "no-ssr" {{- end }} {{- if $vols }} volumeMounts: {{- if .config }} - name: configurations mountPath: /conf/configurations.yml subPath: configurations.yml readOnly: true {{- end }} {{- if has "logs" .mounts }} - name: logs mountPath: /logs {{- end }} {{- if has "data" .mounts }} - name: data mountPath: /data {{- end }} {{- if has "shared" .mounts }} - name: data mountPath: /shared-inputs subPath: shared/inputs - name: data mountPath: /shared-archived subPath: shared/archived {{- end }} {{- end }} {{- if $vols }} volumes: {{- if .config }} - name: configurations secret: secretName: {{ include "onelab.configurationSecretName" $root }} {{- end }} {{- if eq $root.Values.persistence.mode "hostPath" }} {{- if has "logs" .mounts }} - name: logs hostPath: path: {{ $root.Values.persistence.hostPath.logs }} type: DirectoryOrCreate {{- end }} {{- if or (has "data" .mounts) (has "shared" .mounts) }} - name: data hostPath: path: {{ $root.Values.persistence.hostPath.data }} type: DirectoryOrCreate {{- end }} {{- end }} {{- end }} {{- if and .port (gt (int .port) 0) }} --- apiVersion: v1 kind: Service metadata: name: {{ .name }} labels: app.kubernetes.io/component: {{ .name }} {{- include "onelab.labels" $root | nindent 4 }} spec: type: ClusterIP ports: - port: {{ .port }} targetPort: http name: http selector: app.kubernetes.io/component: {{ .name }} app.kubernetes.io/name: {{ include "onelab.name" $root }} app.kubernetes.io/instance: {{ $root.Release.Name }} {{- end }} {{- end }}