{{/* 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_utility }} {{- $envAll := . }} {{- $serviceAccountName := printf "%s" $envAll.Release.Name }} {{ tuple $envAll "utility" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ $serviceAccountName }} rules: - apiGroups: - "" resources: - namespaces - persistentvolumeclaims - persistentvolumes verbs: - get - list - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ $serviceAccountName }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ $serviceAccountName }} subjects: - kind: ServiceAccount name: {{ $serviceAccountName }} namespace: {{ $envAll.Release.Namespace }} --- kind: Deployment apiVersion: apps/v1 metadata: name: {{ printf "%s" $envAll.Release.Name }} labels: {{ tuple $envAll "ceph" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: replicas: {{ .Values.pod.replicas.utility }} selector: matchLabels: {{ tuple $envAll "ceph" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} template: metadata: name: {{ printf "%s" $envAll.Release.Name }} annotations: {{ tuple . | include "helm-toolkit.snippets.release_uuid" }} {{ dict "envAll" $envAll "podName" "ceph-utility" "containerNames" (list "ceph-utility") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} labels: {{ tuple $envAll "ceph" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: {{ dict "envAll" $envAll "application" "ceph" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "ceph" "utility" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.utility.node_selector_key }}: {{ .Values.labels.utility.node_selector_value }} containers: - name: ceph-utility {{ tuple $envAll "ceph_utility" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.ceph_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "ceph" "container" "ceph_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/bootstrap.sh volumeMounts: - name: ceph-utility-bin mountPath: /tmp/bootstrap.sh subPath: bootstrap.sh readOnly: true - name: ceph-utility-bin mountPath: /tmp/managekey.sh subPath: managekey.sh readOnly: true - name: ceph-utility-bin mountPath: /usr/local/bin/utilscli subPath: utilscli readOnly: true - name: ceph-utility-bin mountPath: /usr/local/bin/ceph-utility-rootwrap subPath: ceph-utility-rootwrap readOnly: true - name: ceph-utility-bin mountPath: /tmp/osd-maintenance subPath: osd-maintenance readOnly: true - name: ceph-utility-bin mountPath: /tmp/help subPath: help readOnly: true - name: ceph-utility-bin mountPath: /tmp/rbd_pv subPath: rbd_pv readOnly: true - name: ceph-utility-sudoers mountPath: /etc/sudoers.d/utilscli-sudo subPath: utilscli-sudo readOnly: true - name: ceph-etc mountPath: /etc/ceph/ceph.conf subPath: ceph.conf readOnly: true - name: ceph-client-admin-keyring mountPath: /opt/client-keyring subPath: key - name: ceph-utility-etc mountPath: /etc/ceph/rootwrap.d/ceph-rootwrap-filter subPath: ceph-rootwrap-filter readOnly: true - name: ceph-utility-etc mountPath: /etc/ceph/rootwrap.conf subPath: rootwrap.conf readOnly: true - name: pod-ceph-backup mountPath: /backup readOnly: false volumes: - name: ceph-utility-sudoers configMap: name: {{ printf "%s-%s" $envAll.Release.Name "sudoers" }} defaultMode: 0644 - name: ceph-utility-bin configMap: name: {{ printf "%s-%s" $envAll.Release.Name "bin" }} defaultMode: 0555 - name: ceph-utility-etc configMap: name: {{ printf "%s-%s" $envAll.Release.Name "etc" }} defaultMode: 0555 - name: ceph-etc configMap: name: {{ .Values.conf.cephconf.etc }} defaultMode: 0600 - name: ceph-client-admin-keyring secret: secretName: {{ .Values.secrets.keyrings.admin | quote }} defaultMode: 0600 - name: pod-ceph-backup hostPath: path: {{ .Values.conf.storage.utility.backup_target }} type: DirectoryOrCreate {{- end }}