| {{/* |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| */}} |
| |
| {{- if .Values.manifests.deployment_conductor }} |
| {{- $envAll := . }} |
| |
| {{- $mounts_staffeln_conductor := .Values.pod.mounts.staffeln_conductor.staffeln_conductor }} |
| {{- $mounts_staffeln_conductor_init := .Values.pod.mounts.staffeln_conductor.init_container }} |
| |
| {{- $serviceAccountName := "staffeln-conductor" }} |
| {{ tuple $envAll "conductor" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| --- |
| kind: Role |
| apiVersion: rbac.authorization.k8s.io/v1 |
| metadata: |
| name: {{ $serviceAccountName }} |
| rules: |
| - apiGroups: |
| - '' |
| - 'coordination.k8s.io' |
| resources: |
| - leases |
| verbs: |
| - get |
| - list |
| - watch |
| - create |
| - patch |
| - update |
| - delete |
| - deletecollection |
| --- |
| apiVersion: rbac.authorization.k8s.io/v1 |
| kind: RoleBinding |
| metadata: |
| name: {{ $serviceAccountName }}-leases |
| subjects: |
| - kind: ServiceAccount |
| name: {{ $serviceAccountName }} |
| namespace: {{ $envAll.Release.Namespace }} |
| roleRef: |
| kind: Role |
| name: {{ $serviceAccountName }} |
| apiGroup: rbac.authorization.k8s.io |
| --- |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: staffeln-conductor |
| annotations: |
| {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| labels: |
| {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| spec: |
| replicas: {{ .Values.pod.replicas.conductor }} |
| selector: |
| matchLabels: |
| {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| template: |
| metadata: |
| labels: |
| {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| annotations: |
| {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| {{ dict "envAll" $envAll "podName" "staffeln-conductor" "containerNames" (list "init" "staffeln-conductor") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| spec: |
| {{ dict "envAll" $envAll "application" "staffeln" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| {{ with .Values.pod.priorityClassName.staffeln_conductor }} |
| priorityClassName: {{ . }} |
| {{ end }} |
| {{ with .Values.pod.runtimeClassName.staffeln_conductor }} |
| runtimeClassName: {{ . }} |
| {{ end }} |
| serviceAccountName: {{ $serviceAccountName }} |
| affinity: |
| {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| nodeSelector: |
| {{ .Values.labels.conductor.node_selector_key }}: {{ .Values.labels.conductor.node_selector_value }} |
| {{ if $envAll.Values.pod.tolerations.staffeln.enabled }} |
| {{ tuple $envAll "staffeln" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| {{ end }} |
| initContainers: |
| containers: |
| - name: staffeln-conductor |
| {{ tuple $envAll "staffeln_conductor" | include "helm-toolkit.snippets.image" | indent 10 }} |
| {{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| {{ dict "envAll" $envAll "application" "staffeln" "container" "staffeln_conductor" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| command: |
| - /tmp/staffeln-conductor.sh |
| env: |
| {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| - name: REQUESTS_CA_BUNDLE |
| value: "/etc/staffeln/certs/ca.crt" |
| {{- end }} |
| volumeMounts: |
| - name: pod-tmp |
| mountPath: /tmp |
| - name: etcstaffeln |
| mountPath: /etc/staffeln |
| - name: state-tmp |
| mountPath: /var/lib/staffeln |
| - name: staffeln-etc |
| mountPath: /etc/staffeln/staffeln.conf |
| subPath: staffeln.conf |
| readOnly: true |
| - name: staffeln-etc |
| mountPath: /etc/staffeln/openrc |
| subPath: openrc |
| readOnly: true |
| - name: staffeln-bin |
| mountPath: /tmp/staffeln-conductor.sh |
| subPath: staffeln-conductor.sh |
| readOnly: true |
| {{- if eq ( split "://" .Values.conf.staffeln.coordination.backend_url )._0 "file" }} |
| - name: staffeln-coordination |
| mountPath: {{ ( split "://" .Values.conf.staffeln.coordination.backend_url )._1 }} |
| {{- end }} |
| {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| |
| {{ if $mounts_staffeln_conductor.volumeMounts }}{{ toYaml $mounts_staffeln_conductor.volumeMounts | indent 12 }}{{ end }} |
| volumes: |
| - name: pod-tmp |
| emptyDir: {} |
| - name: state-tmp |
| emptyDir: {} |
| - name: etcstaffeln |
| emptyDir: {} |
| - name: staffeln-etc |
| secret: |
| secretName: staffeln-etc |
| defaultMode: 0444 |
| - name: staffeln-bin |
| configMap: |
| name: staffeln-bin |
| defaultMode: 0555 |
| {{- if eq ( split "://" .Values.conf.staffeln.coordination.backend_url )._0 "file" }} |
| - name: staffeln-coordination |
| emptyDir: {} |
| {{- end }} |
| {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| |
| {{ if $mounts_staffeln_conductor.volumes }}{{ toYaml $mounts_staffeln_conductor.volumes | indent 8 }}{{ end }} |
| {{- end }} |