
This is a code improvement to reuse ceph monitor doscovering function in different templates. Calling the mentioned above function from a single place (helm-infra snippets) allows less code maintenance and simlifies further development. Rev. 0.1 Charts version bump for ceph-client, ceph-mon, ceph-osd, ceph-provisioners and helm-toolkit Rev. 0.2 Mon endpoint discovery functionality added for the rados gateway. ClusterRole and ClusterRoleBinding added. Rev. 0.3 checkdns is allowed to correct ceph.conf for RGW deployment. Rev. 0.4 Added RoleBinding to the deployment-rgw. Rev. 0.5 Remove _namespace-client-ceph-config-manager.sh.tpl and the appropriate job, because of duplicated functionality. Related configuration has been removed. Rev. 0.6 RoleBinding logic has been changed to meet rules: checkdns namespace - HAS ACCESS -> RGW namespace(s) Change-Id: Ie0af212bdcbbc3aa53335689deed9b226e5d4d89
131 lines
5.0 KiB
YAML
131 lines
5.0 KiB
YAML
{{/*
|
|
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 and .Values.manifests.deployment_checkdns .Values.deployment.ceph }}
|
|
{{- $envAll := . }}
|
|
|
|
{{- $serviceAccountName := "ceph-checkdns" }}
|
|
{{/*
|
|
We will give different name to the RoleBinding resource (see $cephRoleBindingName variable below).
|
|
This is neccessary, because the RoleBinding with the default name "ceph-checkdns" exists in the system,
|
|
and its reference can not be changed.
|
|
*/}}
|
|
{{- $cephRoleBindingName := "ceph-checkdns-rolebinding" }}
|
|
|
|
{{ tuple $envAll "checkdns" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: clusterrole-checkdns
|
|
rules:
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- pods
|
|
- endpoints
|
|
- pods/exec
|
|
- namespaces
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- create
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: {{ printf "%s-for-%s" $cephRoleBindingName $envAll.Release.Namespace }}
|
|
namespace: {{ $envAll.Release.Namespace }}
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: clusterrole-checkdns
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: {{ $serviceAccountName }}
|
|
namespace: {{ $envAll.Release.Namespace }}
|
|
---
|
|
|
|
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: ceph-checkdns
|
|
annotations:
|
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
labels:
|
|
{{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
{{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
annotations:
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
|
{{ dict "envAll" $envAll "podName" "ceph-checkdns" "containerNames" (list "ceph-checkdns" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
|
spec:
|
|
{{ dict "envAll" $envAll "application" "checkdns" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
affinity:
|
|
{{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
|
|
{{ tuple $envAll "checkdns" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
|
|
nodeSelector:
|
|
{{ .Values.labels.checkdns.node_selector_key }}: {{ .Values.labels.checkdns.node_selector_value }}
|
|
initContainers:
|
|
{{ tuple $envAll "checkdns" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
|
hostNetwork: true
|
|
dnsPolicy: {{ .Values.pod.dns_policy }}
|
|
containers:
|
|
- name: ceph-checkdns
|
|
{{ tuple $envAll "ceph_config_helper" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.checkdns | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
{{ dict "envAll" $envAll "application" "checkdns" "container" "checkdns" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
|
env:
|
|
- name: CLUSTER
|
|
value: "ceph"
|
|
- name: K8S_HOST_NETWORK
|
|
value: "1"
|
|
- name: NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
apiVersion: v1
|
|
fieldPath: metadata.namespace
|
|
- name: MON_PORT
|
|
value: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
|
- name: MON_PORT_V2
|
|
value: {{ tuple "ceph_mon" "internal" "mon_msgr2" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
|
- name: KUBECTL_PARAM
|
|
value: {{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_kubectl_params" }}
|
|
command:
|
|
- /tmp/_start.sh
|
|
volumeMounts:
|
|
- name: pod-tmp
|
|
mountPath: /tmp
|
|
- name: ceph-client-bin
|
|
mountPath: /tmp/_start.sh
|
|
subPath: utils-checkDNS_start.sh
|
|
readOnly: true
|
|
volumes:
|
|
- name: pod-tmp
|
|
emptyDir: {}
|
|
- name: ceph-client-bin
|
|
configMap:
|
|
name: ceph-client-bin
|
|
defaultMode: 0555
|
|
{{- end }}
|