diff --git a/docs/app-ops.md b/docs/app-ops.md index 241cd29..a3354c7 100644 --- a/docs/app-ops.md +++ b/docs/app-ops.md @@ -8,6 +8,12 @@ native Orange Pi target uses `LAB_CLUSTER_PROFILE=k3s` and complete before `./jeannie apps` runs. The transition command sequences these stages and stops when a prerequisite fails. +The Argo CD application-controller gate waits for the StatefulSet rollout, not +just a Ready pod that might belong to an older revision. Its default budget is +600 seconds; `LAB_ARGOCD_READY_WAIT_SECONDS` changes that bounded wait. Failure +output shows desired/ready/updated counts, revisions and recent warnings without +dumping the full StatefulSet environment. It does not restart the controller. + Application deployment verifies identity, renders scheduling estimates and discovers retained registry placement. A one-core VM is allowed when its reservations and placement permit the rollout; native K3s does not require old diff --git a/docs/templates/app-ops.md.tmpl b/docs/templates/app-ops.md.tmpl index 89fce27..ce63b01 100644 --- a/docs/templates/app-ops.md.tmpl +++ b/docs/templates/app-ops.md.tmpl @@ -8,6 +8,12 @@ native Orange Pi target uses `LAB_CLUSTER_PROFILE=k3s` and complete before `./{{ main_script }} apps` runs. The transition command sequences these stages and stops when a prerequisite fails. +The Argo CD application-controller gate waits for the StatefulSet rollout, not +just a Ready pod that might belong to an older revision. Its default budget is +600 seconds; `LAB_ARGOCD_READY_WAIT_SECONDS` changes that bounded wait. Failure +output shows desired/ready/updated counts, revisions and recent warnings without +dumping the full StatefulSet environment. It does not restart the controller. + Application deployment verifies identity, renders scheduling estimates and discovers retained registry placement. A one-core VM is allowed when its reservations and placement permit the rollout; native K3s does not require old diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 7d1f8a6..8ba4e6c 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -7150,11 +7150,25 @@ require_argocd_application_controller() { local namespace="${TF_VAR_argocd_namespace:-argocd}" local expected_resources="10m|1|2Gi" local actual_resources + local timeout_seconds="${LAB_ARGOCD_READY_WAIT_SECONDS:-600}" - if ! kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" rollout status statefulset/argocd-application-controller --timeout=300s; then + if ! [[ "${timeout_seconds}" =~ ^[1-9][0-9]*$ ]]; then + echo "LAB_ARGOCD_READY_WAIT_SECONDS must be a positive number of seconds." >&2 + return 2 + fi + echo "Waiting up to ${timeout_seconds}s for the Argo CD application-controller rollout..." + if ! kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" rollout status statefulset/argocd-application-controller --timeout="${timeout_seconds}s"; then echo "Argo CD application controller did not become ready; refusing to start application deployment." >&2 - kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" get pods -o wide >&2 || true - kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" describe statefulset argocd-application-controller >&2 || true + kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s -n "${namespace}" \ + get statefulset argocd-application-controller \ + -o custom-columns='NAME:.metadata.name,GEN:.metadata.generation,OBSERVED:.status.observedGeneration,DESIRED:.spec.replicas,READY:.status.readyReplicas,UPDATED:.status.updatedReplicas,CURRENT-REV:.status.currentRevision,TARGET-REV:.status.updateRevision' >&2 || true + kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s -n "${namespace}" get pods \ + -l app.kubernetes.io/name=argocd-application-controller \ + -o custom-columns='NAME:.metadata.name,PHASE:.status.phase,READY:.status.containerStatuses[*].ready,RESTARTS:.status.containerStatuses[*].restartCount,WAITING:.status.containerStatuses[*].state.waiting.reason,REVISION:.metadata.labels.controller-revision-hash' >&2 || true + kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s -n "${namespace}" get events \ + --field-selector type=Warning --sort-by=.lastTimestamp \ + -o custom-columns='REASON:.reason,OBJECT:.involvedObject.name,MESSAGE:.message' 2>/dev/null | + tail -6 | cut -c1-280 >&2 || true exit 1 fi @@ -7903,7 +7917,7 @@ apps() { ensure_pimox_kubeconfig cluster_context_require || return 1 - require_argocd_application_controller + require_argocd_application_controller || return 1 require_pimox_app_worker_capacity "${app_selector}" if [[ "${deploy_website}" == "true" || "${deploy_demos}" == "true" || "${deploy_registry}" == "true" ]]; then reconcile_app_registry_storage || return 1