openstack-helm-infra/ceph-mon/templates/cronjob-checkPGs.yaml
Matthew Heler e1c82f3465 Fix the checkPGs cronjob
Currently the cronjob is broken due to syntax and
permission issues.

Additionally move the cronjob from once a month to
every 15 minutes, and automatically disable the job
unless explicitly enabled.

Change-Id: Id72bdb286c805ccb0ea4e9fcf65fabca94a180dd
2018-11-06 19:39:23 -06:00

145 lines
4.9 KiB
YAML

{{/*
Copyright 2018 The Openstack-Helm Authors.
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/v1beta1
kind: Role
metadata:
name: {{ $serviceAccountName }}
rules:
- apiGroups:
- ""
resources:
- pods
- pods/exec
verbs:
- get
- list
- watch
- create
---
apiVersion: rbac.authorization.k8s.io/v1beta1
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" }}
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.mon.node_selector_key }}: {{ .Values.labels.mon.node_selector_value }}
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: ceph-mon-bin
mountPath: /tmp/utils-checkPGs.py
subPath: utils-checkPGs.py
readOnly: true
- name: ceph-mon-bin
mountPath: /tmp/utils-checkPGs.sh
subPath: utils-checkPGs.sh
readOnly: true
- name: ceph-mon-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: ceph-mon-bin
configMap:
name: ceph-mon-bin
defaultMode: 0555
- name: ceph-mon-etc
configMap:
name: ceph-mon-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 }}