Skip to content

Commit 4f7708f

Browse files
committed
Remove waiting loops for kubernetes resources from Makefile
1 parent c885e0a commit 4f7708f

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

.github/actions/kind/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ runs:
3535
EOF'
3636
3737
- name: Setup KinD cluster
38-
uses: helm/kind-action@v1.5.0
38+
uses: helm/kind-action@v1.8.0
3939
with:
4040
cluster_name: cluster
4141
version: v0.17.0

.github/workflows/olm_tests.yaml

+14-5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ jobs:
7272
# wait for a while to be sure CRDs are installed
7373
sleep 1
7474
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/olm.yaml
75+
echo Wait for default CatalogSource to start
76+
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s
77+
env:
78+
CATALOG_SOURCE_NAME: "operatorhubio-catalog"
79+
CATALOG_SOURCE_NAMESPACE: "olm"
7580

7681
- name: Create openshift-operator namespace and OperatorGroup
7782
run: |
@@ -87,15 +92,18 @@ jobs:
8792
envsubst < .github/resources-olm-upgrade/subscription.yaml > ${{ env.TEMP_DIR }}/subscription.yaml
8893
8994
kubectl create -f ${{ env.TEMP_DIR }}/catalogsource.yaml
90-
make wait-for-catalog-source
95+
96+
echo Wait for CatalogSource ${{ env.CATALOG_SOURCE_NAME }} to start
97+
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s
9198
9299
kubectl create -f ${{ env.TEMP_DIR }}/subscription.yaml
93100
94101
echo Waiting for Subscription to be ready
95-
make wait-for-subscription
102+
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s
96103
97104
echo Waiting for Deployment to be ready
98-
make wait-for-deployment -e TIMEOUT=60 -e DEPLOYMENT_NAME="codeflare-operator-manager" -e DEPLOYMENT_NAMESPACE="openshift-operators"
105+
timeout 60 bash -c 'until [[ $(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done'
106+
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/codeflare-operator-manager --for=condition=Available=true --timeout=60s
99107
env:
100108
CATALOG_SOURCE_NAME: "codeflare-olm-test"
101109
CATALOG_SOURCE_NAMESPACE: "olm"
@@ -138,10 +146,11 @@ jobs:
138146
kubectl wait --timeout=120s --for=delete pod/${ORIGINAL_POD_NAME} -n openshift-operators
139147
140148
echo Waiting for Subscription to be ready
141-
make wait-for-subscription
149+
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s
142150
143151
echo Waiting for Deployment to be ready
144-
make wait-for-deployment -e TIMEOUT=60 -e DEPLOYMENT_NAME="codeflare-operator-manager" -e DEPLOYMENT_NAMESPACE="openshift-operators"
152+
timeout 60 bash -c 'until [[ $(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done'
153+
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/codeflare-operator-manager --for=condition=Available=true --timeout=60s
145154
146155
echo Checking that correct CSV is available
147156
CSV_VERSION=$(kubectl get ClusterServiceVersion/codeflare-operator.${VERSION} -n openshift-operators -o json | jq -r .spec.version)

Makefile

-20
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,3 @@ test-e2e: defaults manifests generate fmt vet ## Run e2e tests.
440440
.PHONY: setup-e2e
441441
setup-e2e: ## Set up e2e tests.
442442
KUBERAY_VERSION=$(KUBERAY_VERSION) test/e2e/setup.sh
443-
444-
# Wait until CatalogSource is in "READY" state
445-
.PHONY: wait-for-catalog-source
446-
wait-for-catalog-source:
447-
timeout 120 bash -c 'while [[ "$$(kubectl get catalogsource/'$(CATALOG_SOURCE_NAME)' -n '$(CATALOG_SOURCE_NAMESPACE)' -o json | jq -r .status.connectionState.lastObservedState)" != "READY" ]]; do sleep 5 && echo "$$(kubectl get catalogsource/'$(CATALOG_SOURCE_NAME)' -n '$(CATALOG_SOURCE_NAMESPACE)' -o json | jq -r .status.connectionState.lastObservedState)" ; done'
448-
449-
# Wait until Subscription is in "AtLatestKnown" state
450-
.PHONY: wait-for-subscription
451-
wait-for-subscription:
452-
timeout 300 bash -c 'while [[ "$$(kubectl get subscription/'$(SUBSCRIPTION_NAME)' -n '$(SUBSCRIPTION_NAMESPACE)' -o json | jq -r .status.state)" != "AtLatestKnown" ]]; do sleep 5 && echo "$$(kubectl get subscription/'$(SUBSCRIPTION_NAME)' -n '$(SUBSCRIPTION_NAMESPACE)' -o json | jq -r .status.state)" ; done'
453-
454-
# Default timeout for waiting actions
455-
TIMEOUT ?= 180
456-
457-
# Wait until Deployment is in "Available" state
458-
.PHONY: wait-for-deployment
459-
wait-for-deployment:
460-
# Wait until Deployment exists first, then use kubectl wait
461-
timeout $(TIMEOUT) bash -c 'until [[ $$(kubectl get deployment/'$(DEPLOYMENT_NAME)' -n '$(DEPLOYMENT_NAMESPACE)') ]]; do sleep 5 && echo "$$(kubectl get deployment/'$(DEPLOYMENT_NAME)' -n '$(DEPLOYMENT_NAMESPACE)')"; done'
462-
kubectl wait --timeout=$(TIMEOUT)s --for=condition=Available=true deployment/$(DEPLOYMENT_NAME) -n $(DEPLOYMENT_NAMESPACE)

0 commit comments

Comments
 (0)