From a395d94c6236bed5eb9b6f2add4464b417eb94fb Mon Sep 17 00:00:00 2001 From: DJ Gregor Date: Tue, 13 Dec 2022 21:06:32 -0500 Subject: [PATCH] Wait for CRDs to be active before we add manifests that depend on them See: https://github.com/kubernetes/kubectl/issues/1117#issuecomment-1228699795 --- start-dependencies.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/start-dependencies.sh b/start-dependencies.sh index 1529d7e..d507d41 100755 --- a/start-dependencies.sh +++ b/start-dependencies.sh @@ -77,6 +77,7 @@ fi # Install PostgreSQL if [ "$INSTALL_POSTGRESQL" == "true" ]; then kubectl apply -f https://raw.githubusercontent.com/zalando/postgres-operator/master/manifests/postgresql.crd.yaml + kubectl wait --for condition=established crd postgresqls.acid.zalan.do --timeout=10s kubectl apply -k github.com/zalando/postgres-operator/manifests kubectl create secret generic $PG_USER.onms-db.credentials.postgresql.acid.zalan.do --from-literal="username=$PG_USER" --from-literal="password=$PG_PASSWORD" -n $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic $PG_ONMS_USER.onms-db.credentials.postgresql.acid.zalan.do --from-literal="username=$PG_ONMS_USER" --from-literal="password=$PG_ONMS_PASSWORD" -n $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - @@ -87,6 +88,7 @@ if [ "$INSTALL_KAFKA" == "true" ]; then # Install Kafka via Strimzi kubectl create secret generic kafka-user-credentials --from-literal="$KAFKA_USER=$KAFKA_PASSWORD" -n $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - kubectl apply -f "https://strimzi.io/install/latest?namespace=$NAMESPACE" -n $NAMESPACE + kubectl wait --for condition=established crd kafkas.kafka.strimzi.io -n $NAMESPACE --timeout=10s kubectl apply -f dependencies/kafka.yaml -n $NAMESPACE fi