Rico Lin | d020bc2 | 2023-11-01 01:57:03 +0800 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | */}} |
| 14 | |
| 15 | {{- if .Values.manifests.deployment_conductor }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_staffeln_conductor := .Values.pod.mounts.staffeln_conductor.staffeln_conductor }} |
| 19 | {{- $mounts_staffeln_conductor_init := .Values.pod.mounts.staffeln_conductor.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "staffeln-conductor" }} |
| 22 | {{ tuple $envAll "conductor" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | kind: Role |
| 25 | apiVersion: rbac.authorization.k8s.io/v1 |
| 26 | metadata: |
| 27 | name: {{ $serviceAccountName }} |
| 28 | rules: |
| 29 | - apiGroups: |
| 30 | - '' |
| 31 | - 'coordination.k8s.io' |
| 32 | resources: |
| 33 | - leases |
| 34 | verbs: |
| 35 | - get |
| 36 | - list |
| 37 | - watch |
| 38 | - create |
| 39 | - patch |
| 40 | - update |
| 41 | - delete |
| 42 | - deletecollection |
| 43 | --- |
| 44 | apiVersion: rbac.authorization.k8s.io/v1 |
| 45 | kind: RoleBinding |
| 46 | metadata: |
| 47 | name: {{ $serviceAccountName }}-leases |
| 48 | subjects: |
| 49 | - kind: ServiceAccount |
| 50 | name: {{ $serviceAccountName }} |
| 51 | namespace: {{ $envAll.Release.Namespace }} |
| 52 | roleRef: |
| 53 | kind: Role |
| 54 | name: {{ $serviceAccountName }} |
| 55 | apiGroup: rbac.authorization.k8s.io |
| 56 | --- |
| 57 | apiVersion: apps/v1 |
| 58 | kind: Deployment |
| 59 | metadata: |
| 60 | name: staffeln-conductor |
| 61 | annotations: |
| 62 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 63 | labels: |
| 64 | {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 65 | spec: |
| 66 | replicas: {{ .Values.pod.replicas.conductor }} |
| 67 | selector: |
| 68 | matchLabels: |
| 69 | {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 70 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 71 | template: |
| 72 | metadata: |
| 73 | labels: |
| 74 | {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 75 | annotations: |
| 76 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 77 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 78 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 79 | {{ dict "envAll" $envAll "podName" "staffeln-conductor" "containerNames" (list "init" "staffeln-conductor") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 80 | spec: |
| 81 | {{ dict "envAll" $envAll "application" "staffeln" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
Dong Ma | 9f49d7a | 2025-02-12 04:24:30 +0000 | [diff] [blame] | 82 | {{ with .Values.pod.priorityClassName.staffeln_conductor }} |
| 83 | priorityClassName: {{ . }} |
| 84 | {{ end }} |
| 85 | {{ with .Values.pod.runtimeClassName.staffeln_conductor }} |
| 86 | runtimeClassName: {{ . }} |
| 87 | {{ end }} |
Rico Lin | d020bc2 | 2023-11-01 01:57:03 +0800 | [diff] [blame] | 88 | serviceAccountName: {{ $serviceAccountName }} |
| 89 | affinity: |
| 90 | {{ tuple $envAll "staffeln" "conductor" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 91 | nodeSelector: |
| 92 | {{ .Values.labels.conductor.node_selector_key }}: {{ .Values.labels.conductor.node_selector_value }} |
| 93 | {{ if $envAll.Values.pod.tolerations.staffeln.enabled }} |
| 94 | {{ tuple $envAll "staffeln" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 95 | {{ end }} |
| 96 | initContainers: |
| 97 | containers: |
| 98 | - name: staffeln-conductor |
| 99 | {{ tuple $envAll "staffeln_conductor" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 100 | {{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 101 | {{ dict "envAll" $envAll "application" "staffeln" "container" "staffeln_conductor" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 102 | command: |
| 103 | - /tmp/staffeln-conductor.sh |
| 104 | env: |
| 105 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 106 | - name: REQUESTS_CA_BUNDLE |
| 107 | value: "/etc/staffeln/certs/ca.crt" |
| 108 | {{- end }} |
| 109 | volumeMounts: |
| 110 | - name: pod-tmp |
| 111 | mountPath: /tmp |
| 112 | - name: etcstaffeln |
| 113 | mountPath: /etc/staffeln |
| 114 | - name: state-tmp |
| 115 | mountPath: /var/lib/staffeln |
| 116 | - name: staffeln-etc |
| 117 | mountPath: /etc/staffeln/staffeln.conf |
| 118 | subPath: staffeln.conf |
| 119 | readOnly: true |
| 120 | - name: staffeln-etc |
| 121 | mountPath: /etc/staffeln/openrc |
| 122 | subPath: openrc |
| 123 | readOnly: true |
| 124 | - name: staffeln-bin |
| 125 | mountPath: /tmp/staffeln-conductor.sh |
| 126 | subPath: staffeln-conductor.sh |
| 127 | readOnly: true |
| 128 | {{- if eq ( split "://" .Values.conf.staffeln.coordination.backend_url )._0 "file" }} |
| 129 | - name: staffeln-coordination |
| 130 | mountPath: {{ ( split "://" .Values.conf.staffeln.coordination.backend_url )._1 }} |
| 131 | {{- end }} |
| 132 | {{- 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 }} |
| 133 | |
| 134 | {{ if $mounts_staffeln_conductor.volumeMounts }}{{ toYaml $mounts_staffeln_conductor.volumeMounts | indent 12 }}{{ end }} |
| 135 | volumes: |
| 136 | - name: pod-tmp |
| 137 | emptyDir: {} |
| 138 | - name: state-tmp |
| 139 | emptyDir: {} |
| 140 | - name: etcstaffeln |
| 141 | emptyDir: {} |
| 142 | - name: staffeln-etc |
| 143 | secret: |
| 144 | secretName: staffeln-etc |
| 145 | defaultMode: 0444 |
| 146 | - name: staffeln-bin |
| 147 | configMap: |
| 148 | name: staffeln-bin |
| 149 | defaultMode: 0555 |
| 150 | {{- if eq ( split "://" .Values.conf.staffeln.coordination.backend_url )._0 "file" }} |
| 151 | - name: staffeln-coordination |
| 152 | emptyDir: {} |
| 153 | {{- end }} |
| 154 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 155 | |
| 156 | {{ if $mounts_staffeln_conductor.volumes }}{{ toYaml $mounts_staffeln_conductor.volumes | indent 8 }}{{ end }} |
| 157 | {{- end }} |