Skip to content

Commit a4e34de

Browse files
nixpanicmergify[bot]
authored andcommitted
ci: deploy ceph-csi-operator in configurable Namespace
The k8s-storage CI jobs expect a temporary namespace where components are deployed. ceph-csi-operator always used its default namespace. Signed-off-by: Niels de Vos <ndevos@ibm.com>
1 parent 912f5c9 commit a4e34de

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/deploy-ceph-csi-operator.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ OPERATOR_URL="https://raw.githubusercontent.com/ceph/ceph-csi-operator/${CEPH_CS
1717
# operator deployment files
1818
OPERATOR_INSTALL="${OPERATOR_URL}/deploy/all-in-one/install.yaml"
1919

20-
OPERATOR_NAMESPACE="ceph-csi-operator-system"
20+
DEFAULT_OPERATOR_NAMESPACE="ceph-csi-operator-system"
21+
OPERATOR_NAMESPACE=${OPERATOR_NAMESPACE:-"${DEFAULT_OPERATOR_NAMESPACE}"}
2122
IMAGESET_CONFIGMAP_NAME="ceph-csi-imageset"
2223
ENCRYPTION_CONFIGMAP_NAME="ceph-csi-encryption-kms-config"
2324

@@ -32,6 +33,11 @@ K8S_IMAGE_REPO=${K8S_IMAGE_REPO:-"registry.k8s.io/sig-storage"}
3233
TEMP_DIR="$(mktemp -d)"
3334
trap 'rm -rf "$TEMP_DIR"' EXIT
3435

36+
function generate_operator_install() {
37+
curl "${OPERATOR_INSTALL}" | \
38+
sed "s/namespace: ${DEFAULT_OPERATOR_NAMESPACE}/namespace: ${OPERATOR_NAMESPACE}/g"
39+
}
40+
3541
function generate_imageset_configmap() {
3642
cat <<EOF >"${TEMP_DIR}/imageset-configmap.yaml"
3743
apiVersion: v1
@@ -103,7 +109,7 @@ EOF
103109
}
104110

105111
function deploy_operator() {
106-
kubectl_retry create -f "${OPERATOR_INSTALL}"
112+
generate_operator_install | kubectl_retry create -f -
107113
generate_operator_config
108114
generate_driver "${RBD_DRIVER_NAME}"
109115
generate_driver "${CEPHFS_DRIVER_NAME}"
@@ -127,7 +133,7 @@ function cleanup() {
127133

128134
# Delete all the generated files at once
129135
kubectl_retry delete -f "${TEMP_DIR}"
130-
kubectl_retry delete -f "${OPERATOR_INSTALL}"
136+
generate_operator_install | kubectl_retry delete -f -
131137
}
132138

133139
case "${1:-}" in

0 commit comments

Comments
 (0)