Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 27 additions & 33 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ name: E2E Tests

# In-cluster federation e2e (issue #149).
#
# Stands up the full local topology the Taskfile harness builds — three Kind
# clusters (one management/control-plane hosting Karmada, two POP cells) with the
# real production kustomize overlays and hub RBAC — then runs the Chainsaw
# suites against it. This exercises the operators as deployed pods authenticating
# to Karmada as a non-admin identity, not as an in-process test binary.
# Stands up the full topology on the shared test-infra federation foundation —
# three Kind clusters (one management/control-plane hosting Karmada, two POP
# cells) with the real production kustomize overlays and hub RBAC — then runs the
# Chainsaw suites against it. This exercises the operators as deployed pods
# authenticating to Karmada as a non-admin identity, not as an in-process test
# binary.

on:
push:
branches: [main]
pull_request:

# The e2e Taskfile pulls the test-infra foundation in as a remote Taskfile
# include; opt into Task's remote-taskfile support for every step that runs a
# task (paired with `task --yes` for the non-interactive trust prompt).
env:
TASK_X_REMOTE_TASKFILES: "1"

# Cancel a superseded run on the same ref. The e2e job is expensive (three Kind
# clusters + a Karmada control plane), so we don't want stale pushes burning a
# runner. Unlike the cheaper test/lint workflows this only triggers on PRs and
Expand Down Expand Up @@ -58,37 +65,24 @@ jobs:
version: 3.52.0
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Kind is not preinstalled on the runner. Docker, kubectl, and helm already
# are (ubuntu-24.04 image); karmadactl and chainsaw are fetched into ./bin
# by the task tooling. Pinned for reproducibility.
- name: Install kind
run: |
curl -sSfLo ./kind https://kind.sigs.k8s.io/dl/v0.32.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version

# The Karmada kubeconfig rewrite step (_e2e:karmada:build-kubeconfig) shells
# out to python3 + PyYAML. It is normally present on the runner image; guard
# the case where it is not without tripping over PEP 668.
- name: Ensure PyYAML
run: |
if ! python3 -c "import yaml" 2>/dev/null; then
sudo apt-get update
sudo apt-get install -y python3-yaml
fi
# kind, kubectl, helm, and karmadactl are installed by the test-infra
# federation foundation's own ensure-tools; chainsaw is fetched into ./bin
# by the compute task tooling. No harness-side python/PyYAML is used any
# more (the foundation rewrites kubeconfigs with kubectl; the remaining
# python3 calls parse `go list` JSON with the stdlib only).

# Split into env / deploy / test so a failure lands on the phase that broke
# rather than a single opaque "task e2e:up" step. e2e:env:up == e2e:up minus
# the deploy; the two together are exactly what e2e:up runs.
# the deploy; the two together are exactly what e2e:up runs. `--yes` accepts
# Task's one-time trust prompt for the remote test-infra include.
- name: Provision Kind + Karmada environment
run: task e2e:env:up
run: task --yes e2e:env:up

- name: Build image and deploy operators
run: task e2e:deploy
run: task --yes e2e:deploy

- name: Run Chainsaw e2e suites
run: task e2e:test
run: task --yes e2e:test

# Always capture what the clusters looked like when a step failed. The
# runner is ephemeral so teardown is unnecessary; diagnostics are the only
Expand All @@ -98,7 +92,7 @@ jobs:
run: |
set +e
DIAG=tmp/e2e/diagnostics
KDIR=tmp/e2e/kubeconfigs
KDIR=.test-infra/kubeconfigs/federation
mkdir -p "$DIAG"

# Host / kind level: container state plus a full per-cluster export
Expand All @@ -111,7 +105,7 @@ jobs:

# Per-cluster Kubernetes state + the compute-manager operator logs
# (current and previous, all containers) from every plane.
for kc in control-plane pop-dfw pop-ord karmada; do
for kc in compute-control-plane compute-pop-dfw compute-pop-ord karmada; do
cfg="$KDIR/$kc.yaml"
[ -f "$cfg" ] || continue
out="$DIAG/$kc"; mkdir -p "$out"
Expand All @@ -127,11 +121,11 @@ jobs:

# Karmada control-plane pods + component logs (they live in the
# management cluster) and the federation view from the Karmada API.
if [ -f "$KDIR/control-plane.yaml" ]; then
kubectl --kubeconfig="$KDIR/control-plane.yaml" -n karmada-system get pods -o wide \
if [ -f "$KDIR/compute-control-plane.yaml" ]; then
kubectl --kubeconfig="$KDIR/compute-control-plane.yaml" -n karmada-system get pods -o wide \
> "$DIAG/karmada-pods.txt" 2>&1
for d in karmada-apiserver karmada-controller-manager karmada-scheduler; do
kubectl --kubeconfig="$KDIR/control-plane.yaml" -n karmada-system logs deploy/$d \
kubectl --kubeconfig="$KDIR/compute-control-plane.yaml" -n karmada-system logs deploy/$d \
--tail=-1 > "$DIAG/karmada-$d.log" 2>&1
done
fi
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ bin/

# Local e2e environment artefacts (Kind kubeconfigs, etc.)
tmp/

# test-infra federation foundation: its self-clone and the kubeconfigs it writes
.test-infra/

# Task's remote-taskfile cache (populated with TASK_X_REMOTE_TASKFILES=1)
.task/
Loading
Loading