Skip to content

Commit 28a59da

Browse files
authored
test(sdn): drop the serviceexposure chainsaw suite left after the feature removal (#3336)
## What this PR does Removes the dead `serviceexposure` chainsaw suite and its wiring. Commit 3dbc7d3 dropped ExposureClass/ServiceExposure (api/network, the controller, and the `network.cozystack.io` CRDs shipped in `cozystack-controller/definitions`) in favor of the native LoadBalancer path, but the chainsaw port that landed the next day (dd2f89d) brought the suite along, so it tests an API that no longer exists. Since then every full-suite E2E run — any PR touching core paths, and every release cut — fails `serviceexposure-delete` and `serviceexposure-externalips` with `no matches for network.cozystack.io/v1alpha1` (see the crust-gather snapshot of e.g. run 29561399440 on #3333: the network CRDs are absent while sibling CRDs from the same `definitions/` dir, like `tenantgateways.gateway.cozystack.io`, are present, confirming the chart applied and the API is simply gone). Alongside the suite dir this drops the `suite_to_source` case and its core-platform bats test in `hack/select-install*`, the now-unreachable `-` mapping mechanism itself (no suite returns it anymore and its only executable coverage was the removed bats test; re-adding the three lines with the next core-platform-owned suite is cheaper than keeping an untestable dead branch), and the suite list entry in `hack/e2e-chainsaw/README.md`. The `securitygroup` suite from the same port is alive and green and is untouched. If the native LoadBalancer replacement needs E2E coverage, that is a new suite against the new API, not a revival of this one. Verified: `hack/select-install.sh --validate` passes (97 sources), `select-install_test.bats` 17/17, `select-e2e_test.bats` 13/13. ## Release note ```release-note NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Tightened installation suite-to-PackageSource validation: `serviceexposure` no longer has special handling, and mappings to `-` are now treated as invalid unless the referenced PackageSource exists. * **Tests** * Removed Chainsaw E2E fixture coverage and manifests for `serviceexposure`, and updated the listed E2E suites accordingly. * Updated installation mapping tests to match the stricter validation and added a negative validation case for a missing mapped PackageSource. * **Documentation** * Updated contributing guidance to reference the `networking.publishing.externalIPs` → `publishing.loadBalancerClass` migration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents df541b9 + 8282c17 commit 28a59da

6 files changed

Lines changed: 31 additions & 178 deletions

File tree

‎docs/agents/contributing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ The provider is hand-written: every Kind carries a hand-maintained Terraform sch
195195
- Add a required key to `packages/core/installer/values.yaml`, or rename one the role passes (`cozystackOperator.variant`, `cozystack.apiServerHost`, `cozystack.apiServerPort`) → the chart values block in the role's `main.yml` task, and its `defaults/main.yml`.
196196
- Change the `cozy-system` namespace or the PSA pre-install hook contract → the role carries namespace-adoption logic written against the current behaviour of `packages/core/installer/templates/`.
197197
- Add or rename a platform variant → the variant list is hardcoded in Go, in `cmd/cozystack-operator/main.go`; over there it is `cozystack_platform_variant` in `defaults/main.yml` and the README table.
198-
- Change a `packages/core/platform/values.yaml` key the role sets — `networking.podCIDR`, `networking.podGateway`, `networking.serviceCIDR`, `networking.joinCIDR`, `publishing.host`, `publishing.apiServerEndpoint`, `publishing.externalIPs` → the role's platform-package template. The `externalIPs` to `exposureClass` migration in particular needs a coordinated PR there.
198+
- Change a `packages/core/platform/values.yaml` key the role sets — `networking.podCIDR`, `networking.podGateway`, `networking.serviceCIDR`, `networking.joinCIDR`, `publishing.host`, `publishing.apiServerEndpoint`, `publishing.externalIPs` → the role's platform-package template. The `externalIPs` to `publishing.loadBalancerClass` migration in particular needs a coordinated PR there.
199199
- Rename an object the role waits on — `deployment/cozystack-operator`, `crd/packages.cozystack.io`, the root `Tenant` — or change the `<packagesource>.<package>` naming scheme of the Package it applies → the role's tasks and its own CI assertions.
200200
- Change node prerequisites in `hack/e2e-prepare-cluster.bats` — the kernel modules a node must load, the containerd settings, the LVM `global_filter` → those are mirrored by hand into that repo's `examples/ubuntu`, `examples/rhel` and `examples/suse` prepare playbooks. Its CI tests some of them, but never against this repo, so a kernel module added here and not there surfaces as a broken storage layer on a generic cluster.
201201
- Change what Cozystack requires from the Kubernetes distribution (CNI, kube-proxy, cluster domain, max pods) → the k3s flags, which live only in that repo's inventories.

‎hack/e2e-chainsaw/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ hack/e2e-chainsaw/
1818
└── ...
1919
```
2020

21-
Suites: `postgres`, `bucket`, `mariadb`, `mongodb`, `redis`, `qdrant`, `clickhouse`, `kafka`, `etcd`, `openbao`, `harbor`, `foundationdb`, `external-dns`, `kuberture`, `vminstance`, `gateway`, `kubernetes-latest`, `kubernetes-previous`, `kubernetes-oidc-system`, `kubernetes-oidc-customconfig`, `securitygroup`, `serviceexposure`.
21+
Suites: `postgres`, `bucket`, `mariadb`, `mongodb`, `redis`, `qdrant`, `clickhouse`, `kafka`, `etcd`, `openbao`, `harbor`, `foundationdb`, `external-dns`, `kuberture`, `vminstance`, `gateway`, `kubernetes-latest`, `kubernetes-previous`, `kubernetes-oidc-system`, `kubernetes-oidc-customconfig`, `securitygroup`.
2222

2323
## What Chainsaw buys over the BATS suite
2424

‎hack/e2e-chainsaw/serviceexposure/chainsaw-test.yaml‎

Lines changed: 0 additions & 120 deletions
This file was deleted.

‎hack/e2e-chainsaw/serviceexposure/serviceexposure.yaml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎hack/select-install.sh‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# --validate: check the whole graph AND the suite mapping — every dependsOn
2525
# target resolves to a real PackageSource, there are no dependency cycles, and
2626
# every Chainsaw suite under <suites-dir> resolves via suite_to_source() to a
27-
# real PackageSource or to "-". Exit non-zero on any failure. The graph lives
27+
# real PackageSource. Exit non-zero on any failure. The graph lives
2828
# next to the packages and cannot drift from the suite directories; the
2929
# hand-maintained suite mapping is the only part that can, so it is guarded here.
3030
#
@@ -59,11 +59,6 @@ fi
5959

6060
# suite name -> owning PackageSource. Prints:
6161
# - a "cozystack.*" name the suite's primary install target
62-
# - "-" the suite targets a core-platform feature that
63-
# has no separately-enabled package (always
64-
# present via the base install), e.g.
65-
# serviceexposure (ExposureClass/ServiceExposure
66-
# live in packages/core/platform)
6762
# - nothing no mapping is known (caller fails closed)
6863
# Most suites follow the <suite>-application convention; a bare-<suite> fallback
6964
# and the explicit cases cover suites whose source is named differently. Kept in
@@ -82,7 +77,6 @@ suite_to_source() {
8277
echo cozystack.kubernetes-application ; return ;;
8378
vminstance) echo cozystack.vm-instance-application ; return ;;
8479
securitygroup) echo cozystack.securitygroup-controller ; return ;;
85-
serviceexposure) echo - ; return ;;
8680
esac
8781
for cand in "cozystack.$1-application" "cozystack.$1"; do
8882
if echo "$NODES" | grep -Fxq "$cand"; then echo "$cand"; return; fi
@@ -149,8 +143,8 @@ if [ "$MODE" = "validate" ]; then
149143
done
150144
done
151145

152-
# 3. Suite mapping: every Chainsaw suite dir must resolve to a real source or
153-
# "-". The suite universe is auto-discovered while suite_to_source() is
146+
# 3. Suite mapping: every Chainsaw suite dir must resolve to a real source.
147+
# The suite universe is auto-discovered while suite_to_source() is
154148
# hand-maintained, so this is the part that actually drifts. A missing
155149
# suites dir is itself a failure — otherwise a moved/misspelled path would
156150
# make discovery yield nothing and silently pass this whole check.
@@ -163,7 +157,7 @@ if [ "$MODE" = "validate" ]; then
163157
if [ -z "$src" ]; then
164158
echo "select-install: suite '$suite' has no PackageSource mapping (add it to suite_to_source)" >&2
165159
rc=1
166-
elif [ "$src" != "-" ] && ! echo "$NODES" | grep -Fxq "$src"; then
160+
elif ! echo "$NODES" | grep -Fxq "$src"; then
167161
echo "select-install: suite '$suite' maps to '$src', not a PackageSource in $SOURCES_DIR" >&2
168162
rc=1
169163
fi
@@ -181,7 +175,6 @@ for suite in $SUITES; do
181175
[ -z "$suite" ] && continue
182176
src="$(suite_to_source "$suite")"
183177
case "$src" in
184-
"-") continue ;; # core-platform feature — nothing separate to enable
185178
"")
186179
# Fail closed: a suite that maps to nothing must abort, not silently emit
187180
# an empty set. Collect every bad suite so one run reports them all.

‎hack/select-install_test.bats‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,6 @@
101101
echo "$output" | grep -wq cozystack.gateway-api-crds
102102
}
103103

104-
@test "core-platform suite contributes no package and emits no warning" {
105-
# serviceexposure is a core-platform CRD; nothing to enable, no warning.
106-
err=$(hack/select-install.sh "serviceexposure" 2>&1 1>/dev/null)
107-
[ -z "$err" ]
108-
output=$(hack/select-install.sh "serviceexposure" 2>/dev/null)
109-
[ -z "$output" ]
110-
}
111-
112104
@test "validate passes on the real source graph and suite mapping" {
113105
hack/select-install.sh --validate
114106
}
@@ -180,6 +172,31 @@ YAML
180172
fi
181173
}
182174

175+
@test "validate detects a suite mapped to a source absent from the graph" {
176+
# suite_to_source() hardcodes securitygroup -> cozystack.securitygroup-controller;
177+
# a sources dir without that PackageSource must fail validation (fail closed),
178+
# pinning that the elif validates every mapping, including hardcoded ones,
179+
# against the graph.
180+
tmp=$(mktemp -d)
181+
trap 'rm -rf "$tmp"' EXIT
182+
mkdir -p "$tmp/sources" "$tmp/suites/securitygroup"
183+
: > "$tmp/suites/securitygroup/chainsaw-test.yaml"
184+
cat > "$tmp/sources/standalone.yaml" <<'YAML'
185+
apiVersion: cozystack.io/v1alpha1
186+
kind: PackageSource
187+
metadata:
188+
name: cozystack.standalone
189+
spec:
190+
variants:
191+
- name: default
192+
YAML
193+
err=$(hack/select-install.sh --validate "$tmp/sources" "$tmp/suites" 2>&1 1>/dev/null) && {
194+
echo "expected validation to fail on a mapping to a missing source" >&2
195+
exit 1
196+
}
197+
echo "$err" | grep -q "maps to 'cozystack.securitygroup-controller', not a PackageSource"
198+
}
199+
183200
@test "validate fails when the suites dir does not exist" {
184201
tmp=$(mktemp -d)
185202
trap 'rm -rf "$tmp"' EXIT

0 commit comments

Comments
 (0)