mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-05 03:27:07 +09:00
Flux helm-controller v1.5.0 (shipped in Flux v2.8) replaced the legacy
Helm readiness logic with kstatus-based health checking, which polls
Deployment/StatefulSet/Service status and waits for kstatus to assess
rollout-ready. This typically adds 10-30s of latency between resource
apply and HR condition Ready=True compared to v2.7.
Our per-app bats tests had `kubectl wait hr/... --for=condition=ready
--timeout=` budgets of 20s, 30s, 60s, 100s — sized for v2.7's faster
readiness flip and previously masked by the 3x retry on Run E2E tests
(dropped in #2558). Under v2.8 with no retry, every app that runs after
the first few hit its HR wait timeout exactly, surfacing as 13 of 16
test failures on PR #2619.
Standardise on 5m for HR Ready across all app tests. Tight enough to
catch genuine bring-up failures within the per-app job budget, loose
enough to absorb kstatus dispatch jitter on a management cluster that
is concurrently reconciling multiple tenant-test HRs.
Post-HR-Ready checks for app-specific resources (StatefulSet/Service/
PVC/operator CRs) remain — for CR-based apps kstatus only observes
that the chart applied, not that the operator finished. Audit of
which of those are actually redundant under v2.8 kstatus is queued
as a follow-up.
Also bumps the 10s "kamajicontrolplane appears" wait in
run-kubernetes.sh to 2m, and the kubernetes-addon HR Ready loop from
1m to 5m for the same reason.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit 5ef02ee7b3)
82 lines
3.7 KiB
Bash
82 lines
3.7 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
@test "Create Harbor" {
|
|
name='test'
|
|
release="harbor-$name"
|
|
|
|
# Clean up stale resources from previous failed runs
|
|
kubectl -n tenant-test delete harbor.apps.cozystack.io $name 2>/dev/null || true
|
|
kubectl -n tenant-test wait hr $release --timeout=60s --for=delete 2>/dev/null || true
|
|
|
|
kubectl apply -f- <<EOF
|
|
apiVersion: apps.cozystack.io/v1alpha1
|
|
kind: Harbor
|
|
metadata:
|
|
name: $name
|
|
namespace: tenant-test
|
|
spec:
|
|
host: ""
|
|
storageClass: ""
|
|
core:
|
|
resources: {}
|
|
resourcesPreset: "nano"
|
|
registry:
|
|
resources: {}
|
|
resourcesPreset: "nano"
|
|
jobservice:
|
|
resources: {}
|
|
resourcesPreset: "nano"
|
|
trivy:
|
|
enabled: false
|
|
size: 2Gi
|
|
resources: {}
|
|
resourcesPreset: "nano"
|
|
database:
|
|
size: 2Gi
|
|
replicas: 1
|
|
redis:
|
|
size: 1Gi
|
|
replicas: 1
|
|
EOF
|
|
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
|
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get hr $release >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait hr $release --timeout=5m --for=condition=ready
|
|
|
|
# Wait for COSI to provision bucket
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io $release-registry >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait bucketclaims.objectstorage.k8s.io $release-registry \
|
|
--timeout=300s --for=jsonpath='{.status.bucketReady}'=true
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get bucketaccesses.objectstorage.k8s.io $release-registry >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait bucketaccesses.objectstorage.k8s.io $release-registry \
|
|
--timeout=60s --for=jsonpath='{.status.accessGranted}'=true
|
|
|
|
kubectl -n tenant-test wait hr $release-system --timeout=600s --for=condition=ready || {
|
|
echo "=== HelmRelease status ==="
|
|
kubectl -n tenant-test get hr $release-system -o yaml 2>&1 || true
|
|
echo "=== Pods ==="
|
|
kubectl -n tenant-test get pods 2>&1 || true
|
|
echo "=== Events ==="
|
|
kubectl -n tenant-test get events --sort-by='.lastTimestamp' 2>&1 | tail -30 || true
|
|
echo "=== ExternalArtifact ==="
|
|
kubectl -n cozy-system get externalartifact cozystack-harbor-application-default-harbor-system -o yaml 2>&1 || true
|
|
echo "=== BucketClaim status ==="
|
|
kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io $release-registry -o yaml 2>&1 || true
|
|
echo "=== BucketAccess status ==="
|
|
kubectl -n tenant-test get bucketaccesses.objectstorage.k8s.io $release-registry -o yaml 2>&1 || true
|
|
echo "=== BucketAccess Secret ==="
|
|
kubectl -n tenant-test get secret $release-registry-bucket -o jsonpath='{.data.BucketInfo}' 2>&1 | base64 -d 2>&1 || true
|
|
false
|
|
}
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get deploy $release-core >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait deploy $release-core --timeout=120s --for=condition=available
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get deploy $release-registry >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait deploy $release-registry --timeout=120s --for=condition=available
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get deploy $release-portal >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait deploy $release-portal --timeout=120s --for=condition=available
|
|
kubectl -n tenant-test get secret $release-credentials -o jsonpath='{.data.admin-password}' | base64 --decode | grep -q '.'
|
|
kubectl -n tenant-test get secret $release-credentials -o jsonpath='{.data.url}' | base64 --decode | grep -q 'https://'
|
|
kubectl -n tenant-test get svc $release -o jsonpath='{.spec.ports[0].port}' | grep -q '80'
|
|
kubectl -n tenant-test delete harbor.apps.cozystack.io $name
|
|
}
|