mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-04 19:17:20 +09:00
#2946 added a startupProbe to capi-controller-manager so it survives the certificate provisioning delay. It edited capi-providers-core/files/core-components.yaml, which is the copy a reviewer reads. The chart mounts files/components.gz, and that blob was never regenerated, so the probe never reached a cluster. The blob is regenerated from the YAML it is supposed to carry: gzip -9 -n -c files/core-components.yaml > files/components.gz The decompressed blob now matches the YAML byte for byte, and the only change it carries is the six lines of #2946. This reaches new installs only. capi-operator re-applies a provider when the hash of its spec and its config Secret changes; the ConfigMap holding the components is in neither, so a cluster that already runs capi-providers-core keeps its manager without the probe until the provider's version moves. Whether existing clusters should get the probe, and how, is left open here on purpose: moving spec.version and the ConfigMap name together would force the re-apply, but that is a version decision for the package, not a side effect of regenerating a blob. .helmignore is corrected in the same change: `files/.*-components.yaml` is a glob, so it matched only names beginning with a dot, and `helm package` shipped the readable YAML alongside the blob that duplicates it. hack/capi-core-components_test.bats holds the two files to the same bytes from now on, so the next edit of one without the other fails in CI. Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua> Assisted-by: LLM
33 lines
1.7 KiB
Bash
33 lines
1.7 KiB
Bash
#!/usr/bin/env bats
|
|
# capi-providers-core ships the Cluster API core manifests twice: as
|
|
# files/core-components.yaml, which a reviewer reads, and as files/components.gz,
|
|
# which the chart mounts into the cluster. Both are edited by hand; this package
|
|
# has no `make components`. An edit to the YAML alone reviews cleanly and changes
|
|
# nothing in a cluster, which is how the startupProbe from #2946 stayed out of
|
|
# the shipped manager. This holds the two files to the same bytes.
|
|
#
|
|
# The comparison is on the decompressed bytes, so the gzip header plays no part
|
|
# in it. `gzip -n` is still the flag to regenerate with: without it the header
|
|
# carries a timestamp and every regeneration rewrites the committed blob even
|
|
# when the input has not changed.
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BATS_TEST_FILENAME:-$0}")/.." && pwd)"
|
|
FILES="$REPO_ROOT/packages/system/capi-providers-core/files"
|
|
|
|
@test "core provider components.gz matches core-components.yaml" {
|
|
[ -f "$FILES/core-components.yaml" ] || { echo "missing core-components.yaml" >&2; return 1; }
|
|
[ -f "$FILES/components.gz" ] || { echo "missing components.gz" >&2; return 1; }
|
|
|
|
local work; work="$(mktemp -d)"
|
|
gzip -dc "$FILES/components.gz" > "$work/decompressed.yaml"
|
|
if ! cmp -s "$work/decompressed.yaml" "$FILES/core-components.yaml"; then
|
|
echo "components.gz does not match core-components.yaml" >&2
|
|
echo "the chart mounts the blob, so the cluster would run what the YAML does not say" >&2
|
|
echo "regenerate: gzip -9 -n -c files/core-components.yaml > files/components.gz" >&2
|
|
diff "$work/decompressed.yaml" "$FILES/core-components.yaml" | head -20 >&2 || true
|
|
rm -rf "$work"
|
|
return 1
|
|
fi
|
|
rm -rf "$work"
|
|
}
|