Skip to content

Commit bac6b2b

Browse files
fix(hack): retain controllers and APIs for selective installs
Tenant HelmReleases need a shard reconciler, and the root SeaweedFS release creates COSI resources even when no backup suite is selected. Without those controllers, a fresh reduced install cannot become ready. The Kubernetes suites create worker pools through KubernetesNodes, and MongoDB renders an operator-owned CR. Selecting only the cluster API or application chart drops resources those suites require. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 646dfdc commit bac6b2b

8 files changed

Lines changed: 49 additions & 15 deletions

File tree

‎docs/agents/e2e-testing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ A parent HelmRelease that hit its wait timeout, uninstalled, and reinstalled is
9797

9898
When adding a new app package, confirm `select-e2e.sh` maps it correctly (it has a unit test, `hack/select-e2e_test.bats`). A new app whose suite directory does not yet exist will not be selected — add `hack/e2e-chainsaw/<app>/chainsaw-test.yaml` first.
9999

100-
`src_to_suites()` maps a PackageSource name to the suites it owns and is the inverse of `select-install.sh`'s `suite_to_source()`. A test walks every suite through both tables, so a source whose name fits neither convention — not `<suite>-application`, not the suite name itself — fails there rather than quietly making its own suite unreachable, which turns every change to that package into a full run (#3665).
100+
`src_to_suites()` maps a PackageSource name to the suites it owns and is the inverse of `select-install.sh`'s `suite_to_source()`. A suite can have several owners: the Kubernetes suites create both Kubernetes and KubernetesNodes resources, and the VM suite creates both VMInstance and VMDisk. A test walks every owner through both tables, so a source whose name fits neither convention — not `<suite>-application`, not the suite name itself — fails there rather than quietly making its own suite unreachable, which turns every change to that package into a full run (#3665). Packages needed only by a suite, such as its backup APIs, belong to `suite_runtime_sources()` in the install selector; they do not change reverse ownership.
101101

102102
#### What TIA does and does not do
103103

‎hack/select-e2e.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ src_to_suites() {
240240
# mappings their derived names point at suites that do not exist, so an
241241
# ingress-only package change can omit the suite that exercises it.
242242
ingress-application|ingress-nginx) echo gateway ;;
243-
kubernetes-application) echo "kubernetes-latest kubernetes-previous" ;;
243+
# Each Kubernetes suite creates both the control plane and worker pools.
244+
kubernetes-application|kubernetes-nodes-application) echo "kubernetes-latest kubernetes-previous" ;;
244245
securitygroup-controller) echo securitygroup ;;
245246
# The kafka app source covers both the app suite and the metadata-backup
246247
# roundtrip, so an edit to packages/apps/kafka (or kafka-operator, which

‎hack/select-install.sh‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ fi
108108
# lockstep with select-e2e.sh's src_to_suites() and the hack/e2e-chainsaw/ dirs;
109109
# --validate asserts every suite dir still resolves here.
110110
#
111-
# A suite may have more than one direct owner. In particular, vminstance creates
112-
# both VMInstance and VMDisk resources and observes the DataVolume behind the
113-
# disk, so both application sources are conjunctive inputs. Fixtures which only
114-
# name other app kinds as selectors are not owners.
111+
# A suite may have more than one direct owner. The Kubernetes suites create
112+
# Kubernetes and KubernetesNodes; vminstance creates VMInstance and VMDisk and
113+
# observes the DataVolume behind the disk. Each API needs its application source.
114+
# Fixtures which only name other app kinds as selectors are not owners.
115115
suite_to_source() {
116116
case "$1" in
117117
kubernetes-latest|kubernetes-previous)
118-
echo cozystack.kubernetes-application ; return ;;
118+
echo "cozystack.kubernetes-application cozystack.kubernetes-nodes-application"
119+
return ;;
119120
vminstance)
120121
echo "cozystack.vm-instance-application cozystack.vm-disk-application"
121122
return ;;
@@ -334,8 +335,10 @@ validate_graph || exit 1
334335
# LINSTOR, CDI and MetalLB. The install then waits the CAPI operator plus all four
335336
# providers, and later enables and waits the Keycloak OIDC stack. Kamaji,
336337
# KubeVirt, storage controllers and CRDs remain graph-derived so losing those
337-
# declared edges stays observable in tests.
338+
# declared edges stays observable in tests. Tenant HelmReleases carry a shard
339+
# label excluded by flux-aio, so the shard operator must supply their reconciler.
338340
baseline="cozystack.cozystack-engine
341+
cozystack.flux-shard-operator
339342
cozystack.cozystack-basics
340343
cozystack.tenant-application
341344
cozystack.etcd-application
@@ -395,6 +398,7 @@ cozystack.prometheus-operator-crds
395398
cozystack.vertical-pod-autoscaler
396399
cozystack.reloader
397400
cozystack.snapshot-controller
401+
cozystack.objectstorage-controller
398402
cozystack.gateway-application
399403
cozystack.info-application
400404
cozystack.kamaji

‎hack/select-install_test.bats‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ assert_output_graph_error() {
2525
mode=$1
2626
sources=$2
2727
expected=$3
28+
requested_suite=${4:-postgres}
2829
out=$(mktemp)
2930
err=$(mktemp)
3031
if [ "$mode" = disabled ]; then
31-
if hack/select-install.sh --disabled postgres "$sources" >"$out" 2>"$err"; then
32+
if hack/select-install.sh --disabled "$requested_suite" "$sources" >"$out" 2>"$err"; then
3233
echo "expected disabled mode to reject invalid graph $sources" >&2
3334
exit 1
3435
fi
35-
elif hack/select-install.sh postgres "$sources" >"$out" 2>"$err"; then
36+
elif hack/select-install.sh "$requested_suite" "$sources" >"$out" 2>"$err"; then
3637
echo "expected closure mode to reject invalid graph $sources" >&2
3738
exit 1
3839
fi
@@ -66,9 +67,35 @@ assert_output_graph_error() {
6667
assert_contains_package "$output" cozystack.objectstorage-controller
6768
}
6869

69-
@test "kubernetes suites map back to the kubernetes application source" {
70-
output=$(hack/select-install.sh "kubernetes-latest")
71-
assert_contains_package "$output" cozystack.kubernetes-application
70+
@test "kubernetes suites keep the cluster and worker pool APIs" {
71+
for suite in kubernetes-latest kubernetes-previous; do
72+
output=$(hack/select-install.sh "$suite")
73+
assert_contains_package "$output" cozystack.kubernetes-application
74+
assert_contains_package "$output" cozystack.kubernetes-nodes-application
75+
done
76+
}
77+
78+
@test "mongodb keeps the operator for its PerconaServerMongoDB resources" {
79+
output=$(hack/select-install.sh mongodb)
80+
assert_contains_package "$output" cozystack.mongodb-application
81+
assert_contains_package "$output" cozystack.mongodb-operator
82+
}
83+
84+
@test "root SeaweedFS keeps COSI for suites without backup steps" {
85+
output=$(hack/select-install.sh kuberture)
86+
assert_contains_package "$output" cozystack.seaweedfs-application
87+
assert_contains_package "$output" cozystack.objectstorage-controller
88+
89+
# A backup suite would hide a lost SeaweedFS edge by retaining COSI itself.
90+
tmp=$(mktemp -d)
91+
cp -r packages/core/platform/sources "$tmp/sources"
92+
yq -i '(.spec.variants[].dependsOn) -= ["cozystack.objectstorage-controller"]' \
93+
"$tmp/sources/seaweedfs-application.yaml"
94+
for mode in closure disabled; do
95+
assert_output_graph_error "$mode" "$tmp/sources" \
96+
"runtime baseline dependency closure is missing: cozystack.objectstorage-controller" kuberture
97+
done
98+
rm -rf "$tmp"
7299
}
73100

74101
@test "vminstance keeps both application owners" {
@@ -500,7 +527,7 @@ YAML
500527
# baseline source also reaches them through dependsOn.
501528
@test "disabled mode: never disables the direct runtime baseline" {
502529
drop=$(hack/select-install.sh --disabled "postgres")
503-
for b in cozystack.cozystack-engine cozystack.cozystack-basics \
530+
for b in cozystack.cozystack-engine cozystack.flux-shard-operator cozystack.cozystack-basics \
504531
cozystack.tenant-application cozystack.etcd-application \
505532
cozystack.ingress-application cozystack.monitoring-application \
506533
cozystack.seaweedfs-application cozystack.linstor \

‎packages/core/platform/sources/mongodb-application.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
- name: default
1414
dependsOn:
1515
- cozystack.networking
16+
- cozystack.mongodb-operator
1617
# cozystack-engine ships the ApplicationDefinition CRD rendered by the *-rd component below.
1718
- cozystack.cozystack-engine
1819
libraries:

‎packages/core/platform/sources/seaweedfs-application.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
- name: default
1414
dependsOn:
1515
- cozystack.networking
16+
- cozystack.objectstorage-controller
1617
# cozystack-engine ships the ApplicationDefinition CRD rendered by the *-rd component below.
1718
- cozystack.cozystack-engine
1819
libraries:

‎packages/core/platform/tests/fixtures/selective-install-postgres-values.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ bundles:
1616
- cozystack.external-dns-application
1717
- cozystack.external-secrets-operator
1818
- cozystack.flux-plunger
19-
- cozystack.flux-shard-operator
2019
- cozystack.foundationdb-application
2120
- cozystack.foundationdb-operator
2221
- cozystack.goldpinger

‎packages/core/platform/tests/selective_install_test.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tests:
2525
system: {enabled: true, variant: isp-full}
2626
asserts:
2727
- containsDocument: {apiVersion: cozystack.io/v1alpha1, kind: Package, name: cozystack.cozystack-engine, any: true}
28+
- containsDocument: {apiVersion: cozystack.io/v1alpha1, kind: Package, name: cozystack.flux-shard-operator, any: true}
2829
- containsDocument: {apiVersion: cozystack.io/v1alpha1, kind: Package, name: cozystack.cozystack-basics, any: true}
2930
- containsDocument: {apiVersion: cozystack.io/v1alpha1, kind: Package, name: cozystack.tenant-application, any: true}
3031
- containsDocument: {apiVersion: cozystack.io/v1alpha1, kind: Package, name: cozystack.etcd-application, any: true}

0 commit comments

Comments
 (0)