mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
A nested <name>-system release takes its install timeout from the template that renders it, not from cozystack-api, and a Package release takes it from cozystack-operator. The external-dns, openbao and qdrant templates set 10m and harbor's sets 15m; the operator gives 10m. Their asserts sat at 5m or 10m, so a failed install reported as a bare timeout. Raise each above its own floor: 11m, and 16m for harbor-test-system. harbor-test was on its 600s floor exactly, which expires first because its clock starts before the install's; it goes to 11m with the generated parents here. kafka keeps its 6m: kafka-rd sets a 7h install timeout that no budget inside the E2E job cap can clear, and the assert now says so. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
197 lines
7.6 KiB
YAML
197 lines
7.6 KiB
YAML
# Chainsaw port of hack/e2e-apps/kuberture.bats. The kuberture addon publishes
|
|
# the default/kubernetes EndpointSlice as annotated headless Services for
|
|
# multiple external-dns instances. Resource readiness is declarative; the
|
|
# annotation-shape checks and the split-horizon log assertions stay scripts.
|
|
#
|
|
# Everything is applied by chainsaw (the cluster-scoped Package, the cluster
|
|
# RBAC, the probe Jobs), so cleanup is automatic — no inlined teardown.
|
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
kind: Test
|
|
metadata:
|
|
name: kuberture
|
|
spec:
|
|
catch:
|
|
- events:
|
|
namespace: cozy-kuberture
|
|
- describe:
|
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
kind: HelmRelease
|
|
name: kuberture
|
|
namespace: cozy-kuberture
|
|
- podLogs:
|
|
namespace: cozy-kuberture
|
|
selector: app.kubernetes.io/name=kuberture
|
|
tail: 100
|
|
# The split-horizon probe pods don't carry the kuberture addon label, so the
|
|
# selector above misses them; capture their stdout on failure too.
|
|
- podLogs:
|
|
namespace: cozy-kuberture
|
|
selector: app.kubernetes.io/name=kuberture-e2e-edns-probe
|
|
tail: 100
|
|
steps:
|
|
- name: create-package
|
|
try:
|
|
- apply:
|
|
file: package.yaml
|
|
|
|
- name: wait-kuberture-ready
|
|
try:
|
|
- assert:
|
|
timeout: 3m
|
|
resource:
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: cozy-kuberture
|
|
# 11m: above the 10m install timeout cozystack-operator gives the
|
|
# HelmRelease of a Package; see "Sizing an HR-Ready budget" in
|
|
# docs/agents/e2e-testing.md.
|
|
- assert:
|
|
timeout: 11m
|
|
resource:
|
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
kind: HelmRelease
|
|
metadata:
|
|
name: kuberture
|
|
namespace: cozy-kuberture
|
|
status:
|
|
(conditions[?type == 'Ready']):
|
|
- status: "True"
|
|
- assert:
|
|
timeout: 3m
|
|
resource:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: kuberture
|
|
namespace: cozy-kuberture
|
|
status:
|
|
(conditions[?type == 'Available']):
|
|
- status: "True"
|
|
|
|
- name: wait-output-services
|
|
try:
|
|
- assert:
|
|
timeout: 2m
|
|
resource:
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: kuberture-e2e-public
|
|
namespace: cozy-kuberture
|
|
- assert:
|
|
timeout: 2m
|
|
resource:
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: kuberture-e2e-internal
|
|
namespace: cozy-kuberture
|
|
|
|
- name: assert-annotation-shape
|
|
try:
|
|
- script:
|
|
timeout: 2m
|
|
content: |
|
|
set -eu
|
|
pub_host=kuberture-e2e-public.cozystack.test
|
|
int_host=kuberture-e2e-internal.cozystack.test
|
|
pub_prefix=external-dns.alpha.kubernetes.io/
|
|
int_prefix=kuberture-e2e-internal-dns.io/
|
|
|
|
# The target annotation is copied off the EndpointSlice asynchronously,
|
|
# so it can lag the Service objects that wait-output-services gated on.
|
|
# Poll until both Services carry it before asserting the annotation
|
|
# shape, rather than failing one-shot under `set -e` on a slow cluster.
|
|
deadline=$(( $(date +%s) + 90 ))
|
|
until
|
|
pub_json=$(kubectl -n cozy-kuberture get service kuberture-e2e-public -o json) &&
|
|
int_json=$(kubectl -n cozy-kuberture get service kuberture-e2e-internal -o json) &&
|
|
[ -n "$(echo "$pub_json" | jq -r --arg k "${pub_prefix}target" '.metadata.annotations[$k] // ""')" ] &&
|
|
[ -n "$(echo "$int_json" | jq -r --arg k "${int_prefix}target" '.metadata.annotations[$k] // ""')" ]
|
|
do
|
|
if [ "$(date +%s)" -ge "$deadline" ]; then
|
|
echo "kuberture target annotation not populated within 90s" >&2
|
|
kubectl -n cozy-kuberture get service kuberture-e2e-public kuberture-e2e-internal -o yaml >&2 || true
|
|
exit 1
|
|
fi
|
|
sleep 3
|
|
done
|
|
|
|
# Both Services must be headless.
|
|
test "$(echo "$pub_json" | jq -r '.spec.clusterIP')" = "None"
|
|
test "$(echo "$int_json" | jq -r '.spec.clusterIP')" = "None"
|
|
|
|
# hostname/ttl carry the configured per-output values.
|
|
test "$(echo "$pub_json" | jq -r --arg k "${pub_prefix}hostname" '.metadata.annotations[$k]')" = "$pub_host"
|
|
test "$(echo "$int_json" | jq -r --arg k "${int_prefix}hostname" '.metadata.annotations[$k]')" = "$int_host"
|
|
test "$(echo "$pub_json" | jq -r --arg k "${pub_prefix}ttl" '.metadata.annotations[$k]')" = "60"
|
|
test "$(echo "$int_json" | jq -r --arg k "${int_prefix}ttl" '.metadata.annotations[$k]')" = "300"
|
|
|
|
# Per-output isolation: neither Service carries the other prefix.
|
|
test "$(echo "$pub_json" | jq -r --arg k "${int_prefix}hostname" '.metadata.annotations[$k] // "absent"')" = "absent"
|
|
test "$(echo "$int_json" | jq -r --arg k "${pub_prefix}hostname" '.metadata.annotations[$k] // "absent"')" = "absent"
|
|
check:
|
|
($error == null): true
|
|
|
|
- name: split-horizon-routing-proof
|
|
try:
|
|
- apply:
|
|
file: probes.yaml
|
|
# Assert each single-shot probe Job reaches Complete rather than polling a
|
|
# fixed Pod name. The Job re-creates its pod on a fresh IP if the Cilium
|
|
# reserved:ingress race wedges one and the leak-healer deletes it, so the
|
|
# proof survives that infra flake instead of failing on a vanished Pod.
|
|
- assert:
|
|
timeout: 4m
|
|
resource:
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: kuberture-e2e-edns-public
|
|
namespace: cozy-kuberture
|
|
status:
|
|
(conditions[?type == 'Complete']):
|
|
- status: "True"
|
|
- assert:
|
|
timeout: 4m
|
|
resource:
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: kuberture-e2e-edns-internal
|
|
namespace: cozy-kuberture
|
|
status:
|
|
(conditions[?type == 'Complete']):
|
|
- status: "True"
|
|
- script:
|
|
timeout: 1m
|
|
content: |
|
|
set -eu
|
|
pub_host=kuberture-e2e-public.cozystack.test
|
|
int_host=kuberture-e2e-internal.cozystack.test
|
|
|
|
# Read each Job's succeeded pod by its job-name label. The healer may
|
|
# have deleted earlier wedged pods, but the Complete condition asserted
|
|
# above guarantees one succeeded pod remains to carry the logs.
|
|
pub_logs=$(kubectl -n cozy-kuberture logs --tail=-1 --max-log-requests=8 -l batch.kubernetes.io/job-name=kuberture-e2e-edns-public)
|
|
int_logs=$(kubectl -n cozy-kuberture logs --tail=-1 --max-log-requests=8 -l batch.kubernetes.io/job-name=kuberture-e2e-edns-internal)
|
|
|
|
# The default-prefix probe sees only the public hostname; the internal-
|
|
# prefix probe sees only the internal hostname.
|
|
echo "$pub_logs" | grep -Fq "$pub_host"
|
|
# Fail-loud negations: under `set -e` a pipeline beginning with `!`
|
|
# suppresses errexit, so `! ... | grep` silently passes when the
|
|
# leak occurs (the vacuous-negation bug 12fe3256f fixed in bats).
|
|
if echo "$pub_logs" | grep -Fq "$int_host"; then
|
|
echo "FAIL: public-prefix probe must NOT see the internal hostname $int_host" >&2
|
|
exit 1
|
|
fi
|
|
echo "$int_logs" | grep -Fq "$int_host"
|
|
if echo "$int_logs" | grep -Fq "$pub_host"; then
|
|
echo "FAIL: internal-prefix probe must NOT see the public hostname $pub_host" >&2
|
|
exit 1
|
|
fi
|
|
check:
|
|
($error == null): true
|