2020-06-16 18:23:28 +05:30
|
|
|
#!/usr/bin/env bash
|
2022-03-21 15:14:38 +05:30
|
|
|
# Sets up the cert-manager for CI
|
2021-02-27 19:32:04 +05:30
|
|
|
set -eEo pipefail
|
|
|
|
|
|
2021-05-26 14:44:06 +05:30
|
|
|
function error_log() {
|
|
|
|
|
set +e -x
|
2021-05-26 14:55:27 +05:30
|
|
|
kubectl -n rook-ceph get issuer
|
2021-05-26 14:44:06 +05:30
|
|
|
kubectl -n rook-ceph get certificate
|
|
|
|
|
kubectl -n rook-ceph get secret | grep rook-ceph-admission-controller
|
2021-08-06 12:01:57 +05:30
|
|
|
kubectl -n rook-ceph get validatingwebhookconfigurations.admissionregistration.k8s.io
|
|
|
|
|
kubectl describe validatingwebhookconfigurations.admissionregistration.k8s.io cert-manager-webhook
|
|
|
|
|
kubectl describe validatingwebhookconfigurations.admissionregistration.k8s.io rook-ceph-webhook
|
2021-05-26 14:44:06 +05:30
|
|
|
kubectl -n cert-manager logs deploy/cert-manager-webhook --tail=10
|
|
|
|
|
kubectl -n cert-manager logs deploy/cert-manager-cainjector --tail=10
|
|
|
|
|
set -e +x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap error_log ERR
|
2020-06-16 18:23:28 +05:30
|
|
|
|
|
|
|
|
# Set our known directories and parameters.
|
|
|
|
|
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
|
2021-05-26 14:55:27 +05:30
|
|
|
CERT_VERSION="v1.3.1"
|
2020-06-16 18:23:28 +05:30
|
|
|
|
|
|
|
|
[ -z "${NAMESPACE}" ] && NAMESPACE="rook-ceph"
|
2021-02-27 19:32:04 +05:30
|
|
|
export NAMESPACE
|
|
|
|
|
export WEBHOOK_CONFIG_NAME="rook-ceph-webhook"
|
|
|
|
|
export SERVICE_NAME="rook-ceph-admission-controller"
|
2020-06-16 18:23:28 +05:30
|
|
|
|
|
|
|
|
echo "$BASE_DIR"
|
|
|
|
|
|
2021-05-26 14:44:06 +05:30
|
|
|
echo "Deploying cert-manager"
|
2021-02-27 19:32:04 +05:30
|
|
|
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/$CERT_VERSION/cert-manager.yaml
|
2021-08-06 12:01:57 +05:30
|
|
|
timeout 150 bash <<-'EOF'
|
|
|
|
|
until [ $(kubectl -n cert-manager get pods --field-selector=status.phase=Running | grep -c ^cert-) -eq 3 ]; do
|
|
|
|
|
echo "waiting for cert-manager pods to be in running state"
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
timeout 20 bash <<-'EOF'
|
|
|
|
|
until [ $(kubectl -n cert-manager get pods -o custom-columns=READY:status.containerStatuses[*].ready | grep -c true) -eq 3 ]; do
|
|
|
|
|
echo "waiting for the pods to be in ready state"
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
timeout 25 bash <<-'EOF'
|
|
|
|
|
until [ $(kubectl get validatingwebhookconfigurations cert-manager-webhook -o jsonpath='{.webhooks[*].clientConfig.caBundle}' | wc -c) -gt 1 ]; do
|
|
|
|
|
echo "waiting for caInjector to inject in caBundle for cert-manager validating webhook"
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
timeout 25 bash <<-'EOF'
|
|
|
|
|
until [ $(kubectl get mutatingwebhookconfigurations cert-manager-webhook -o jsonpath='{.webhooks[*].clientConfig.caBundle}' | wc -c) -gt 1 ]; do
|
|
|
|
|
echo "waiting for caInjector to inject in caBundle for cert-managers mutating webhook"
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
EOF
|
2021-02-27 19:32:04 +05:30
|
|
|
|
2021-05-26 14:44:06 +05:30
|
|
|
echo "Successfully deployed cert-manager"
|