diff --git a/ceph-mon/Chart.yaml b/ceph-mon/Chart.yaml index 4294a495b..425783099 100644 --- a/ceph-mon/Chart.yaml +++ b/ceph-mon/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Mon name: ceph-mon -version: 0.1.30 +version: 0.1.31 home: https://github.com/ceph/ceph ... diff --git a/ceph-mon/templates/bin/keys/_storage-keyring-manager.sh.tpl b/ceph-mon/templates/bin/keys/_storage-keyring-manager.sh.tpl index dfa85f437..b8cb6f506 100644 --- a/ceph-mon/templates/bin/keys/_storage-keyring-manager.sh.tpl +++ b/ceph-mon/templates/bin/keys/_storage-keyring-manager.sh.tpl @@ -28,7 +28,17 @@ function kube_ceph_keyring_gen () { sed "s|{{"{{"}} key {{"}}"}}|${CEPH_KEY}|" ${CEPH_TEMPLATES_DIR}/${CEPH_KEY_TEMPLATE} | base64 -w0 | tr -d '\n' } -CEPH_CLIENT_KEY=$(ceph_gen_key) +CEPH_CLIENT_KEY="" +ROOK_CEPH_TOOLS_POD=$(kubectl -n ${DEPLOYMENT_NAMESPACE} get pods --no-headers | awk '/rook-ceph-tools/{print $1}') + +if [[ -n "${ROOK_CEPH_TOOLS_POD}" ]]; then + CEPH_AUTH_KEY_NAME=$(echo "${CEPH_KEYRING_NAME}" | awk -F. '{print $2 "." $3}') + CEPH_CLIENT_KEY=$(kubectl -n ${DEPLOYMENT_NAMESPACE} exec ${ROOK_CEPH_TOOLS_POD} -- ceph auth ls | grep -A1 "${CEPH_AUTH_KEY_NAME}" | awk '/key:/{print $2}') +fi + +if [[ -z "${CEPH_CLIENT_KEY}" ]]; then + CEPH_CLIENT_KEY=$(ceph_gen_key) +fi function create_kube_key () { CEPH_KEYRING=$1 diff --git a/ceph-mon/templates/job-storage-admin-keys.yaml b/ceph-mon/templates/job-storage-admin-keys.yaml index a8812f884..2d782d434 100644 --- a/ceph-mon/templates/job-storage-admin-keys.yaml +++ b/ceph-mon/templates/job-storage-admin-keys.yaml @@ -26,11 +26,14 @@ rules: - apiGroups: - "" resources: + - pods + - pods/exec - secrets verbs: - get - create - patch + - list --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding diff --git a/ceph-mon/templates/service-mon-discovery.yaml b/ceph-mon/templates/service-mon-discovery.yaml index 71066a5aa..04582ff7e 100644 --- a/ceph-mon/templates/service-mon-discovery.yaml +++ b/ceph-mon/templates/service-mon-discovery.yaml @@ -30,7 +30,12 @@ spec: protocol: TCP targetPort: {{ tuple "ceph_mon" "discovery" "mon_msgr2" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: +{{- if .Values.manifests.daemonset_mon }} {{ tuple $envAll "ceph" "mon" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} +{{- else }} + app: rook-ceph-mon + ceph_daemon_type: mon +{{- end }} clusterIP: None publishNotReadyAddresses: true {{- end }} diff --git a/releasenotes/notes/ceph-mon.yaml b/releasenotes/notes/ceph-mon.yaml index e8d4d6699..835e2ede3 100644 --- a/releasenotes/notes/ceph-mon.yaml +++ b/releasenotes/notes/ceph-mon.yaml @@ -31,4 +31,5 @@ ceph-mon: - 0.1.28 Document the use of mon_allow_pool_size_one - 0.1.29 Update Ceph to 17.2.6 - 0.1.30 Use Helm tookkit functions for Ceph probes + - 0.1.31 Add Rook Helm charts for managing Ceph with Rook ... diff --git a/tools/deployment/openstack-support-rook/000-install-packages.sh b/tools/deployment/openstack-support-rook/000-install-packages.sh new file mode 120000 index 000000000..d702c4899 --- /dev/null +++ b/tools/deployment/openstack-support-rook/000-install-packages.sh @@ -0,0 +1 @@ +../common/000-install-packages.sh \ No newline at end of file diff --git a/tools/deployment/openstack-support-rook/000-prepare-k8s.sh b/tools/deployment/openstack-support-rook/000-prepare-k8s.sh new file mode 120000 index 000000000..aa9807064 --- /dev/null +++ b/tools/deployment/openstack-support-rook/000-prepare-k8s.sh @@ -0,0 +1 @@ +../common/prepare-k8s.sh \ No newline at end of file diff --git a/tools/deployment/openstack-support-rook/005-deploy-k8s.sh b/tools/deployment/openstack-support-rook/005-deploy-k8s.sh new file mode 120000 index 000000000..003bfbb8e --- /dev/null +++ b/tools/deployment/openstack-support-rook/005-deploy-k8s.sh @@ -0,0 +1 @@ +../../gate/deploy-k8s.sh \ No newline at end of file diff --git a/tools/deployment/openstack-support-rook/007-namespace-config.sh b/tools/deployment/openstack-support-rook/007-namespace-config.sh new file mode 100755 index 000000000..a52d77254 --- /dev/null +++ b/tools/deployment/openstack-support-rook/007-namespace-config.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# 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 -xe + +#NOTE: Lint and package chart +make namespace-config + +#NOTE: Deploy namespace configs +for NAMESPACE in kube-system ceph openstack; do + helm upgrade --install ${NAMESPACE}-namespace-config ./namespace-config \ + --namespace=${NAMESPACE} +done diff --git a/tools/deployment/openstack-support-rook/010-ingress.sh b/tools/deployment/openstack-support-rook/010-ingress.sh new file mode 100755 index 000000000..ffe3ebc87 --- /dev/null +++ b/tools/deployment/openstack-support-rook/010-ingress.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# 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 -xe + +#NOTE: Lint and package chart +make ingress + +#NOTE: Deploy global ingress with IngressClass nginx-cluster +tee /tmp/ingress-kube-system.yaml < /tmp/ceph-fs-uuid.txt +CEPH_FS_ID="$(cat /tmp/ceph-fs-uuid.txt)" +#NOTE(portdirect): to use RBD devices with Ubuntu kernels < 4.5 this +# should be set to 'hammer' +. /etc/os-release +if [ "x${ID}" == "xcentos" ] || \ + ([ "x${ID}" == "xubuntu" ] && \ + dpkg --compare-versions "$(uname -r)" "lt" "4.5"); then + CRUSH_TUNABLES=hammer +else + CRUSH_TUNABLES=null +fi +tee /tmp/rook.yaml <