openstack-helm-infra/ceph-client/templates/cronjob-checkPGs.yaml
Stephen Taylor ea2c0115c4 Move ceph-mgr deployment to the ceph-mon chart
This change moves the ceph-mgr deployment from the ceph-client
chart to the ceph-mon chart. Its purpose is to facilitate the
proper Ceph upgrade procedure, which prescribes restarting mgr
daemons before mon daemons.

There will be additional work required to implement the correct
daemon restart procedure for upgrades. This change only addresses
the move of the ceph-mgr deployment.

Change-Id: I3ac4a75f776760425c88a0ba1edae5fb339f128d
2022-02-05 05:02:18 +00:00

151 lines
5.2 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 .Values.manifests.cronjob_checkPGs }}
{{- $envAll := . }}
{{- $serviceAccountName := "ceph-pool-checkpgs" }}
{{ tuple $envAll "pool_checkpgs" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $serviceAccountName }}
rules:
- apiGroups:
- ""
resources:
- pods
- pods/exec
verbs:
- get
- list
- watch
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $serviceAccountName }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ $serviceAccountName }}
subjects:
- kind: ServiceAccount
name: {{ $serviceAccountName }}
namespace: {{ $envAll.Release.Namespace }}
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ $serviceAccountName }}
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll "ceph" "pool-checkpgs" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
schedule: {{ .Values.jobs.pool_checkPGs.cron | quote }}
successfulJobsHistoryLimit: {{ .Values.jobs.pool_checkPGs.history.successJob }}
failedJobsHistoryLimit: {{ .Values.jobs.pool_checkPGs.history.failJob }}
concurrencyPolicy: {{ .Values.jobs.pool_checkPGs.concurrency.execPolicy }}
startingDeadlineSeconds: {{ .Values.jobs.pool_checkPGs.startingDeadlineSecs }}
jobTemplate:
metadata:
labels:
{{ tuple $envAll "ceph" "pool-checkpgs" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
template:
metadata:
labels:
{{ tuple $envAll "ceph" "pool-checkpgs" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.mgr.node_selector_key }}: {{ .Values.labels.mgr.node_selector_value }}
initContainers:
{{ tuple $envAll "pool_checkpgs" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
containers:
- name: {{ $serviceAccountName }}
{{ tuple $envAll "ceph_config_helper" | include "helm-toolkit.snippets.image" | indent 12 }}
env:
- name: DEPLOYMENT_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command:
- /tmp/utils-checkPGs.sh
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: pod-etc-ceph
mountPath: /etc/ceph
- name: ceph-client-bin
mountPath: /tmp/utils-checkPGs.sh
subPath: utils-checkPGs.sh
readOnly: true
- name: ceph-client-etc
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
readOnly: true
- mountPath: /etc/ceph/ceph.client.admin.keyring
name: ceph-client-admin-keyring
readOnly: true
subPath: ceph.client.admin.keyring
- mountPath: /etc/ceph/ceph.mon.keyring.seed
name: ceph-mon-keyring
readOnly: true
subPath: ceph.mon.keyring
- mountPath: /var/lib/ceph/bootstrap-osd/ceph.keyring
name: ceph-bootstrap-osd-keyring
readOnly: true
subPath: ceph.keyring
- mountPath: /var/lib/ceph/bootstrap-mds/ceph.keyring
name: ceph-bootstrap-mds-keyring
readOnly: true
subPath: ceph.keyring
restartPolicy: Never
hostNetwork: true
volumes:
- name: pod-tmp
emptyDir: {}
- name: pod-etc-ceph
emptyDir: {}
- name: ceph-client-bin
configMap:
name: ceph-client-bin
defaultMode: 0555
- name: ceph-client-etc
configMap:
name: ceph-client-etc
defaultMode: 0444
- name: ceph-client-admin-keyring
secret:
defaultMode: 420
secretName: ceph-client-admin-keyring
- name: ceph-mon-keyring
secret:
defaultMode: 420
secretName: ceph-mon-keyring
- name: ceph-bootstrap-osd-keyring
secret:
defaultMode: 420
secretName: ceph-bootstrap-osd-keyring
- name: ceph-bootstrap-mds-keyring
secret:
defaultMode: 420
secretName: ceph-bootstrap-mds-keyring
{{- end }}