diff --git a/ceph-osd/templates/bin/_bootstrap.sh.tpl b/ceph-osd/templates/bin/_bootstrap.sh.tpl new file mode 100644 index 000000000..533c0a5a3 --- /dev/null +++ b/ceph-osd/templates/bin/_bootstrap.sh.tpl @@ -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'" }} diff --git a/ceph-osd/templates/configmap-bin.yaml b/ceph-osd/templates/configmap-bin.yaml index 6a3b93c7e..8bbda7588 100644 --- a/ceph-osd/templates/configmap-bin.yaml +++ b/ceph-osd/templates/configmap-bin.yaml @@ -25,6 +25,10 @@ data: {{- if .Values.images.local_registry.active }} image-repo-sync.sh: | {{- 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 }} osd-start.sh: | {{ tuple "bin/osd/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} diff --git a/ceph-osd/templates/job-bootstrap.yaml b/ceph-osd/templates/job-bootstrap.yaml new file mode 100644 index 000000000..448f3d664 --- /dev/null +++ b/ceph-osd/templates/job-bootstrap.yaml @@ -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 }} diff --git a/ceph-osd/values.yaml b/ceph-osd/values.yaml index 7f6c62f19..7aabe7a2d 100644 --- a/ceph-osd/values.yaml +++ b/ceph-osd/values.yaml @@ -220,19 +220,18 @@ dependencies: services: - endpoint: internal service: ceph_mon + tests: + jobs: + - ceph-storage-keys-generator + - ceph-osd-keyring-generator + services: + - endpoint: internal + service: ceph_mon bootstrap: - enabled: false + enabled: true script: | 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: cluster_domain_suffix: cluster.local @@ -264,6 +263,7 @@ manifests: configmap_etc: true configmap_test_bin: true daemonset_osd: true + job_bootstrap: false job_image_repo_sync: true helm_tests: true cronjob_defragosds: false diff --git a/tools/deployment/osh-infra-logging/020-ceph.sh b/tools/deployment/osh-infra-logging/020-ceph.sh index f095ae383..f961dfc32 100755 --- a/tools/deployment/osh-infra-logging/020-ceph.sh +++ b/tools/deployment/osh-infra-logging/020-ceph.sh @@ -187,6 +187,7 @@ jobs: manifests: cronjob_checkPGs: true cronjob_defragosds: true + job_bootstrap: false EOF for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do