Ceph-OSD: Restore bootstrap job

At some point the bootrap job was partially removed from the ceph
osd chart, this PS resores it.

Change-Id: I2f51deda64b299fe980e1f191b860bfe173e6aca
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2019-02-05 21:54:06 -06:00
parent cb021c2124
commit 87de515727
5 changed files with 106 additions and 9 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
{{/*
Copyright 2017 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.
*/}}
set -ex
{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }}

View File

@ -25,6 +25,10 @@ data:
{{- if .Values.images.local_registry.active }} {{- if .Values.images.local_registry.active }}
image-repo-sync.sh: | image-repo-sync.sh: |
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}
{{- end }}
{{- if .Values.bootstrap.enabled }}
bootstrap.sh: |
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }} {{- end }}
osd-start.sh: | osd-start.sh: |
{{ tuple "bin/osd/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/osd/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -0,0 +1,72 @@
{{/*
Copyright 2017 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 and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }}
{{- $envAll := . }}
{{- $serviceAccountName := "ceph-osd-bootstrap" }}
{{ tuple $envAll "bootstrap" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: ceph-osd-bootstrap
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
template:
metadata:
labels:
{{ tuple $envAll "ceph" "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers:
{{ tuple $envAll "bootstrap" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: ceph-osd-bootstrap
{{ tuple $envAll "ceph_bootstrap" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.bootstrap | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/bootstrap.sh
volumeMounts:
- name: ceph-osd-bin
mountPath: /tmp/bootstrap.sh
subPath: bootstrap.sh
readOnly: true
- name: ceph-osd-etc
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
readOnly: true
- name: ceph-osd-admin-keyring
mountPath: /etc/ceph/ceph.client.admin.keyring
subPath: ceph.client.admin.keyring
readOnly: true
volumes:
- name: ceph-osd-bin
configMap:
name: ceph-osd-bin
defaultMode: 0555
- name: ceph-osd-etc
configMap:
name: ceph-osd-etc
defaultMode: 0444
- name: ceph-osd-admin-keyring
secret:
secretName: {{ .Values.secrets.keyrings.admin }}
{{- end }}

View File

@ -220,19 +220,18 @@ dependencies:
services: services:
- endpoint: internal - endpoint: internal
service: ceph_mon service: ceph_mon
tests:
jobs:
- ceph-storage-keys-generator
- ceph-osd-keyring-generator
services:
- endpoint: internal
service: ceph_mon
bootstrap: bootstrap:
enabled: false enabled: true
script: | script: |
ceph -s ceph -s
function ensure_pool () {
ceph osd pool stats $1 || ceph osd pool create $1 $2
local test_version=$(ceph tell osd.* version | egrep -c "mimic|luminous" | xargs echo)
if [[ ${test_version} -gt 0 ]]; then
ceph osd pool application enable $1 $3
fi
}
#ensure_pool volumes 8 cinder
endpoints: endpoints:
cluster_domain_suffix: cluster.local cluster_domain_suffix: cluster.local
@ -264,6 +263,7 @@ manifests:
configmap_etc: true configmap_etc: true
configmap_test_bin: true configmap_test_bin: true
daemonset_osd: true daemonset_osd: true
job_bootstrap: false
job_image_repo_sync: true job_image_repo_sync: true
helm_tests: true helm_tests: true
cronjob_defragosds: false cronjob_defragosds: false

View File

@ -187,6 +187,7 @@ jobs:
manifests: manifests:
cronjob_checkPGs: true cronjob_checkPGs: true
cronjob_defragosds: true cronjob_defragosds: true
job_bootstrap: false
EOF EOF
for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do