diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 2092efa..fd84ff1 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -78,7 +78,30 @@ jobs: --filename coturn.yaml \ --filename coturn-relay-service.yaml - "${RUNNER_TEMP}/kubectl" --namespace "${NAMESPACE}" \ - rollout status deployment/coturn --timeout=5m - "${RUNNER_TEMP}/kubectl" --namespace "${NAMESPACE}" \ - wait --for=condition=Ready certificate/coturn --timeout=5m + for attempt in {1..60}; do + IFS='|' read -r generation observed desired updated available unavailable <<< "$( + "${RUNNER_TEMP}/kubectl" --namespace "${NAMESPACE}" \ + get deployment/coturn \ + --output=jsonpath='{.metadata.generation}|{.status.observedGeneration}|{.spec.replicas}|{.status.updatedReplicas}|{.status.availableReplicas}|{.status.unavailableReplicas}' + )" + certificate_ready=$( + "${RUNNER_TEMP}/kubectl" --namespace "${NAMESPACE}" \ + get certificate/coturn \ + --output=jsonpath='{.status.conditions[?(@.type=="Ready")].status}' + ) + + echo "Check ${attempt}/60: deployment generation ${observed}/${generation}, replicas ${updated}/${desired} updated, ${available}/${desired} available; certificate Ready=${certificate_ready:-False}" + if [[ "${observed}" == "${generation}" \ + && "${updated}" == "${desired}" \ + && "${available}" == "${desired}" \ + && ( -z "${unavailable}" || "${unavailable}" == "0" ) \ + && "${certificate_ready}" == "True" ]]; then + echo "coturn deployment and certificate are ready" + exit 0 + fi + + sleep 5 + done + + echo "coturn did not become ready within five minutes" >&2 + exit 1 diff --git a/ci-deployer.yaml b/ci-deployer.yaml index 47bed90..199bd37 100644 --- a/ci-deployer.yaml +++ b/ci-deployer.yaml @@ -45,7 +45,6 @@ rules: - get - patch - update - - watch - apiGroups: - cert-manager.io resources: @@ -56,7 +55,6 @@ rules: - get - patch - update - - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding