Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [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 and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $serviceAccountName := "ceph-client-bootstrap" }} |
| 19 | {{ tuple $envAll "bootstrap" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 20 | --- |
| 21 | apiVersion: batch/v1 |
| 22 | kind: Job |
| 23 | metadata: |
| 24 | name: ceph-client-bootstrap |
| 25 | annotations: |
| 26 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 27 | spec: |
| 28 | template: |
| 29 | metadata: |
| 30 | labels: |
| 31 | {{ tuple $envAll "ceph" "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 32 | spec: |
| 33 | {{ dict "envAll" $envAll "application" "bootstrap" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 34 | serviceAccountName: {{ $serviceAccountName }} |
| 35 | restartPolicy: OnFailure |
| 36 | nodeSelector: |
| 37 | {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} |
| 38 | initContainers: |
| 39 | {{ tuple $envAll "bootstrap" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 40 | containers: |
| 41 | - name: ceph-client-bootstrap |
| 42 | {{ tuple $envAll "ceph_bootstrap" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 43 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.bootstrap | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 44 | {{ dict "envAll" $envAll "application" "bootstrap" "container" "ceph_client_bootstrap" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 45 | command: |
| 46 | - /tmp/bootstrap.sh |
| 47 | volumeMounts: |
| 48 | - name: pod-tmp |
| 49 | mountPath: /tmp |
| 50 | - name: pod-etc-ceph |
| 51 | mountPath: /etc/ceph |
| 52 | - name: ceph-provisioners-bin |
| 53 | mountPath: /tmp/bootstrap.sh |
| 54 | subPath: bootstrap.sh |
| 55 | readOnly: true |
| 56 | - name: ceph-etc |
| 57 | mountPath: /etc/ceph/ceph.conf |
| 58 | subPath: ceph.conf |
| 59 | readOnly: true |
| 60 | - name: ceph-client-admin-keyring |
| 61 | mountPath: /etc/ceph/ceph.client.admin.keyring |
| 62 | subPath: ceph.client.admin.keyring |
| 63 | readOnly: true |
| 64 | volumes: |
| 65 | - name: pod-tmp |
| 66 | emptyDir: {} |
| 67 | - name: pod-etc-ceph |
| 68 | emptyDir: {} |
| 69 | - name: ceph-provisioners-bin |
| 70 | configMap: |
| 71 | name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} |
| 72 | defaultMode: 0555 |
| 73 | - name: ceph-etc |
| 74 | configMap: |
| 75 | {{- if eq .Values.storageclass.csi_rbd.provision_storage_class true }} |
| 76 | name: {{ .Values.storageclass.csi_rbd.ceph_configmap_name }} |
| 77 | {{- else }} |
| 78 | name: {{ .Values.storageclass.rbd.ceph_configmap_name }} |
| 79 | {{- end }} |
| 80 | defaultMode: 0444 |
| 81 | - name: ceph-client-admin-keyring |
| 82 | secret: |
| 83 | secretName: {{ .Values.secrets.keyrings.admin }} |
| 84 | {{- end }} |