Skip to content

argoci: HCP support (vendored scripts + GCS cross-stage handoff)#13162

Draft
lwr20 wants to merge 5 commits into
projectcalico:masterfrom
lwr20:argoci-hcp
Draft

argoci: HCP support (vendored scripts + GCS cross-stage handoff)#13162
lwr20 wants to merge 5 commits into
projectcalico:masterfrom
lwr20:argoci-hcp

Conversation

@lwr20

@lwr20 lwr20 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Runs the OSS certification pipeline's HCP (hosted control plane) stages on ArgoCI.

HCP uses a multi-cluster bzprofiles tree (not BZ_HOME) and, on Semaphore, hands state between stages via the cache/artifact CLIs that ArgoCI lacks. So this vendors the banzai-utils ocp-hcp/* scripts into .argoci/scripts/hcp/ (env-driven, logic unchanged) and adds phases/hcp.sh, which dispatches on HCP_STAGE (setup-hosting/hosted/destroy-hosting) and replaces the cache/artifact handoff with a single GCS object (the whole tree, tarred).

Scaffold edits: prologue sets BZ_PROFILES_PATH/BZ_SECRETS_PATH; body_standard sources hcp.sh when HCP_ENABLED=true; epilogue skips the single-cluster bz diags/bz destroy for HCP and glob-publishes junit.

Design rationale: .argoci/design/hcp.md (5-round design review; may be removed before merge).

🚧 Stacked on #13153 (faithful-scaffold) — the scaffold edits build on it; the diff will settle once #13153 merges. Cron wiring (HCP_ENABLED/destroy-hosting step in e2e-certification.yaml) rides in #13133.

Release Note

NONE

lwr20 and others added 2 commits July 7, 2026 18:54
The hand-ported .argoci/scripts diverged from .semaphore/end-to-end/scripts
in ways that change what runs. Revert to match Semaphore (keeping only the
behaviour-neutral platform adaptations):

run_tests.sh:
- drop the added '&& -n E2E_TEST_CONFIG' from the binary-acquire and
  make-e2e-run conditions. k8s-e2e jobs with an empty E2E_TEST_CONFIG now run
  the monorepo e2e binary via 'make e2e-run' (as Semaphore does) instead of
  falling through to 'bz tests' (the k8s-e2e image's [sig-calico] suite) -- a
  different test binary/suite.
- restore the aws-iam-authenticator bind-mount (EKS make-e2e-run can't auth
  without it).

global_prologue.sh:
- INSTALLER default operator -> manual.
- restore dropped defaults: K8S_E2E_EXTRA_FLAGS (calicoctl-opensource-image
  pin), K8S_VERSION, HELM_PATCH, CALICOCTL_INSTALL_TYPE.
- restore GOOGLE_REGION randomisation + gcloud-derived GOOGLE_ZONE.

global_epilogue.sh:
- restore the 'always capture diags for ocp-cert' branch (code matched the
  existing comment).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restore the flannel/canal-migration body dropped in the initial port. Faithful
copy of .semaphore/end-to-end/scripts/body_flannel-migration.sh; only the PHASES
path is adapted to the absolute form (matching body_standard.sh). No Semaphore
cache/artifact deps. Wired to the iptables/patch-verification flannel jobs in
the crons PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 8, 2026 10:25
@lwr20 lwr20 requested a review from a team as a code owner July 8, 2026 10:25
@marvin-tigera marvin-tigera added this to the Calico v3.33.0 milestone Jul 8, 2026
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Jul 8, 2026
@lwr20 lwr20 added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ArgoCI support for running the OSS certification pipeline’s HCP (hosted control plane) stages by vendoring the ocp-hcp/* helper scripts and introducing a GCS-backed cross-stage handoff for the multi-cluster bzprofiles tree, while adjusting the ArgoCI scaffold to route HCP jobs through that flow and publish per-cluster JUnit artifacts.

Changes:

  • Add an HCP stage dispatcher (phases/hcp.sh) that switches on HCP_STAGE and pushes/pulls the bzprofiles tree via a single gs://…/bzprofiles.tgz object.
  • Vendor hcp-*.sh scripts into .argoci/scripts/hcp/ and wire scaffold scripts to set BZ_PROFILES_PATH/BZ_SECRETS_PATH and adjust epilogue behavior for HCP.
  • Update test execution plumbing to match Semaphore behavior (notably run_tests.sh selection) and add a flannel-migration body script.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.argoci/scripts/phases/run_tests.sh Align k8s-e2e selection logic with Semaphore; add optional aws-iam-authenticator mount for EKS kubeconfigs.
.argoci/scripts/phases/hcp.sh New HCP stage dispatcher with GCS tarball handoff and per-stage exit behavior.
.argoci/scripts/hcp/hcp-test.sh Vendored HCP test runner (bzprofiles multi-cluster loop + JUnit rename/copy).
.argoci/scripts/hcp/hcp-provision.sh Vendored HCP provision/install loop over hosting + hosted clusters.
.argoci/scripts/hcp/hcp-init.sh Vendored HCP profile initialization and .status file generation.
.argoci/scripts/hcp/hcp-diags.sh Vendored per-cluster diagnostics collection into a shared directory.
.argoci/scripts/hcp/hcp-destroy.sh Vendored per-cluster destroy/cleanup logic for the bzprofiles tree.
.argoci/scripts/global_prologue.sh Add defaults/randomization + HCP env/path wiring for bzprofiles-based flow.
.argoci/scripts/global_epilogue.sh Skip single-cluster diags/destroy for HCP; publish all REPORT_DIR/*.xml JUnit files.
.argoci/scripts/body_standard.sh Route HCP-enabled jobs to phases/hcp.sh and bypass standard phase execution.
.argoci/scripts/body_flannel-migration.sh New flannel-to-Calico migration flow script using legacy bz.sh tests:run.
.argoci/design/hcp.md Design notes explaining the HCP stage split and GCS handoff model.

Comment on lines +51 to +53
export GOOGLE_REGIONS=("us-central1" "us-west1")
export GOOGLE_REGION=${GOOGLE_REGION:-${GOOGLE_REGIONS[RANDOM%${#GOOGLE_REGIONS[@]}]}}
export GOOGLE_ZONE=${GOOGLE_ZONE:-$(gcloud compute zones list --filter="region~'$GOOGLE_REGION'" --format="value(name)" | awk 'BEGIN {srand()} {a[NR]=$0} rand() * NR < 1 {zone=$0} END {print zone}')}
Comment thread .argoci/scripts/phases/hcp.sh Outdated
Comment on lines +10 to +12
# Sourced by body_standard.sh only when HCP_ENABLED=true. Dispatches on
# HCP_STAGE via a case with no default, so a non-HCP job never reaches it.
# Does NOT set an EXIT trap (that would clobber global_epilogue's).
Comment thread .argoci/scripts/phases/hcp.sh Outdated
Comment on lines +27 to +33
pull_tree() {
set -o pipefail
rm -rf "${BZ_PROFILES_PATH}"
gsutil -q stat "${BLOB}" || return 1
echo "[INFO] hcp: pulling profile tree from ${BLOB}"
gsutil cp "${BLOB}" - | tar xzf - -C "$(dirname "${BZ_PROFILES_PATH}")"
}
Comment on lines +72 to +80
terminationGracePeriodSeconds: 0
tolerations:
- effect: NoSchedule
operator: Exists
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
operator: Exists
terminationGracePeriodSeconds: 0
Comment on lines +118 to +121
# Run a basic services test to check that flannel networking is working.
K8S_E2E_FLAGS='--ginkgo.focus=should.serve.a.basic.endpoint.from.pods' \
./bz.sh tests:run |& tee >(gzip --stdout > "${BZ_LOGS_DIR}/e2e-tests-pre.log")

Comment on lines +141 to +142
# Run e2e on uplevel calico.
./bz.sh tests:run |& tee >(gzip --stdout > "${BZ_LOGS_DIR}/e2e-tests.log")
@lwr20 lwr20 marked this pull request as draft July 8, 2026 10:48
…andoff)

The certification pipeline runs HCP as the standard body_standard flow gated by
HCP_STAGE (not the banzai-utils ocp-hcp orchestrator / HCP_ENABLED path, which
OSS does not use). bz provisions the hosting/hosted OpenShift clusters via
OPENSHIFT_CLUSTER_TYPE; only the hosting cluster's state crosses stages, which
Semaphore did via cache+artifact — replaced here with one GCS object.

- body_standard.sh: restore the HCP_STAGE guards from Semaphore (hosting/
  destroy-hosting skip provision+install; *-hosting* stages exit before tests).
- global_prologue.sh: hosted pulls the hosting kubeconfig and sets
  OPENSHIFT_HOSTING_KUBECONFIG; destroy-hosting restores the hosting BZ_HOME.
- global_epilogue.sh: setup-hosting pushes the hosting BZ_HOME (and skips
  bz destroy so the hosting cluster survives); destroy-hosting destroys then
  gsutil-rm's the blob; hosted/non-HCP unchanged.

Supersedes the earlier vendored-ocp-hcp approach. Design: .argoci/design/hcp.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nds)

Confirmed onExit steps get the full globalPrologue/globalEpilogue wrapping, so
destroy-hosting as an onExit handler gets the hosting-BZ_HOME restore + bz destroy
and runs once after the workflow regardless of the hosted matrix outcome — no
fan-in depends to express.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lwr20 added a commit to lwr20/calico-argoci-test that referenced this pull request Jul 8, 2026
The setup-hosting + hosted(matrix) HCP steps already carry HCP_STAGE/
HOSTING_CLUSTER. Add destroy-hosting as an onExit entry so it runs once after
the workflow regardless of the hosted cells' outcomes (no fan-in depends). It
gets the full prologue/epilogue: prologue restores the hosting BZ_HOME, epilogue
runs bz destroy + removes the GCS handoff blob. Pairs with the HCP scaffold in
projectcalico#13162.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nfig object

Local-kind plumbing smoke surfaced that the whole-BZ_HOME handoff carries a
Python venv, which is not relocatable. setup-hosting and destroy-hosting drew
random BZ_HOME paths, so the restored venv's pip vanished. Pin BZ_PROFILE_NAME
for *-hosting stages so both land on one path (mirrors Semaphore's
restore-to-original-path). Also split the handoff to match Semaphore: whole
BZ_HOME for destroy, a separate small kubeconfig object for hosted; clean up
both on destroy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants