Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/validate-federation-interpreters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Validate Federation Interpreters

on:
pull_request:
paths:
- '.github/workflows/validate-federation-interpreters.yaml'
- 'config/federation/**'
- 'test/federation-interpreters/**'
- 'Taskfile.yaml'
push:
branches:
- main
paths:
- '.github/workflows/validate-federation-interpreters.yaml'
- 'config/federation/**'
- 'test/federation-interpreters/**'
- 'Taskfile.yaml'

permissions:
contents: read

jobs:
run-federation-interpreters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Install Task
uses: arduino/setup-task@c0bc642852239c2689f73f4ea6459c29405f3c52 # v3.0.0
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-go@v7
with:
go-version-file: test/federation-interpreters/go.mod
cache-dependency-path: test/federation-interpreters/go.sum

- name: Run the interpreter scripts against fixtures
run: task test-federation-interpreters
10 changes: 8 additions & 2 deletions Taskfile.test-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ tasks:
- |
{{.KUSTOMIZE}} build --load-restrictor LoadRestrictionsNone config/crd/downstream | \
kubectl --kubeconfig {{.KARMADA_KUBECONFIG}} --context karmada-apiserver apply -f -
# Gateway API kinds are federated through the hub too. Production's hub
# carries these CRDs out of band, so apply the same set the edge gets.
- |
kubectl --kubeconfig {{.KARMADA_KUBECONFIG}} --context karmada-apiserver apply --server-side=true --force-conflicts \
-f config/tools/envoy-gateway-downstream/charts/gateway-helm-{{.ENVOY_GATEWAY_VERSION}}/gateway-helm/charts/crds/crds/gatewayapi-crds.yaml
# ServingLocation is federated through the hub too, and the locations
# service, not config/crd/downstream, owns its CRD.
- |
Expand Down Expand Up @@ -1111,7 +1116,7 @@ tasks:
vars:
# Scenarios authored against this env's cluster names and downstream path.
# Older fixtures targeting the previous cluster names are excluded here.
DEFAULT_SCENARIOS: extension-server-smoke waf-enforcement waf-section-scoping branded-error-page connector-offline-503 atomic-reject-isolation oidc-missing-secret-isolation networkservice-endpoints networkservice-late-vpc-record misdirected-request
DEFAULT_SCENARIOS: extension-server-smoke waf-enforcement waf-section-scoping branded-error-page connector-offline-503 atomic-reject-isolation oidc-missing-secret-isolation networkservice-endpoints networkservice-late-vpc-record misdirected-request federated-status-pending
# CLI_ARGS (after --) wins; else SCENARIOS env; else the default set.
SELECTED: '{{.CLI_ARGS | default .SCENARIOS | default .DEFAULT_SCENARIOS}}'
deps:
Expand All @@ -1138,7 +1143,8 @@ tasks:
{{.CHAINSAW}} test "$dir" \
--parallel 1 \
--cluster {{.UPSTREAM_CLUSTER}}={{.TMP_DIR}}/.kind-{{.UPSTREAM_CLUSTER}}.yaml \
--cluster {{.DOWNSTREAM_CLUSTER}}={{.TMP_DIR}}/.kind-{{.DOWNSTREAM_CLUSTER}}.yaml
--cluster {{.DOWNSTREAM_CLUSTER}}={{.TMP_DIR}}/.kind-{{.DOWNSTREAM_CLUSTER}}.yaml \
--cluster karmada={{.TMP_DIR}}/karmada-{{.UPSTREAM_CLUSTER}}/karmada-apiserver.config
done

test-e2e:
Expand Down
6 changes: 6 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ tasks:
fi
silent: false

test-federation-interpreters:
desc: Run the Karmada resource-interpreter scripts in config/federation against fixtures in Karmada's own Lua VM (no cluster)
dir: test/federation-interpreters
cmds:
- go test -count=1 ./... {{.CLI_ARGS}}

generate:
desc: Run code generation (deepcopy, defaults)
deps:
Expand Down
13 changes: 13 additions & 0 deletions config/federation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ downstream cluster within seconds.
the behavior that caused real "false offline" incidents and is now exercised
directly.

The interpreter rules also decide what a federated resource's status means on
the hub. A condition such as `Programmed` is `True` only when every cluster the
hub has dispatched the resource to reports it `True`. A cluster the scheduler
has chosen but not yet dispatched to is not counted until its copy exists. If
any placed cluster reports `False`, the hub reports `False` with that cluster's
reason and names the cluster in the message. Otherwise the hub reports
`Unknown` with reason `Pending` and names every cluster it is still waiting
on. The set of placed clusters is the
set the propagation policy selects with `infra.datum.net/gateways=enabled`, so
no cluster name appears in a script. To drain a cluster, remove that label
from its hub `Cluster` object. `task test-federation-interpreters` runs every
script against fixtures in Karmada's own Lua VM.

Not here: the per-location policies that deliver a cell its own identity. Every
resource in the policy above goes to *every* labelled edge cluster, and a
location must reach exactly the one cell that serves it. Karmada has no
Expand Down
Loading
Loading