mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-05 22:53:43 +09:00
cozystack-basics wrote seaweedfs: tenant-root into the root values unconditionally, so every tenant without its own SeaweedFS inherited tenant-root as its S3 even when Tenant/root runs none. A Bucket there got a BucketClaim for a bucket class that never appears, and Harbor got its registry bucket the same way. seaweedfs.rootEnabled records that choice the way monitoring.rootEnabled does for monitoring, and the bucket and harbor charts refuse to render without S3 up the tenant chain rather than wait on a class that does not exist. Older configurations have no SeaweedFS flag. Keep their root S3 enabled. For an explicit value only true or the string "true" enables it. Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
90 lines
2.8 KiB
Bash
Executable File
90 lines
2.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# Render app charts on their defaults plus injected cluster/namespace values.
|
|
# helm-unittest renders only templates selected by a suite; this smoke check
|
|
# also reaches templates with no assertions. It checks rendering, not Kubernetes
|
|
# schema validity or runtime behavior. See testdata/render-fixtures/README.md.
|
|
# Usage (from the repository root): hack/check-render-matrix.sh [chart-dir ...]
|
|
set -eu
|
|
|
|
FIXTURE_DIR="hack/testdata/render-fixtures"
|
|
|
|
# Empty lookup results are the only accepted reason to skip a chart. Match the
|
|
# actual diagnostic, so another error cannot keep an obsolete skip alive.
|
|
skip_reason() {
|
|
case "$1" in
|
|
vm-instance) echo 'Specified instanceType does not exist in the cluster: u1.medium' ;;
|
|
kubernetes-nodes) echo 'specified instanceType "u1.medium" not found in cluster' ;;
|
|
*) echo "" ;;
|
|
esac
|
|
}
|
|
|
|
render_chart() {
|
|
chart=$1 fixture=$2
|
|
name=$(basename "$chart")
|
|
case "$name" in
|
|
tenant) set -- tenant-sub --api-versions v1.edp.epam.com/v1 ;;
|
|
# Satisfy the parent-cluster and release-name contract before the lookup.
|
|
kubernetes-nodes) set -- kubernetes-nodes-render-check --set-string cluster=render ;;
|
|
# Both refuse to render without S3 up the tenant chain.
|
|
bucket|harbor) set -- "$name-render-check" --set-string _namespace.seaweedfs=tenant-root ;;
|
|
*) set -- "$name-render-check" ;;
|
|
esac
|
|
helm template "$@" "$chart" -n tenant-test -f "$fixture"
|
|
}
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
set -- packages/apps/*/
|
|
if [ ! -d "$1" ]; then
|
|
echo "check-render-matrix: found no charts under packages/apps" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check exactly the files the render loop will consume, not nested fixtures.
|
|
fixtures=0
|
|
for fixture in "$FIXTURE_DIR"/*.yaml; do
|
|
[ -f "$fixture" ] || continue
|
|
fixtures=$((fixtures + 1))
|
|
done
|
|
if [ "$fixtures" -eq 0 ]; then
|
|
echo "check-render-matrix: no fixtures under $FIXTURE_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
errors=$(mktemp)
|
|
trap 'rm -f "$errors"' EXIT
|
|
rc=0 rendered=0 skipped=0
|
|
for dir in "$@"; do
|
|
name=$(basename "$dir")
|
|
reason=$(skip_reason "$name")
|
|
chart_failed=0
|
|
for fixture in "$FIXTURE_DIR"/*.yaml; do
|
|
[ -f "$fixture" ] || continue
|
|
state=$(basename "$fixture" .yaml)
|
|
if render_chart "$dir" "$fixture" >/dev/null 2>"$errors"; then
|
|
if [ -z "$reason" ]; then
|
|
continue
|
|
fi
|
|
echo "FAIL $name ($state): chart now renders; remove its skip"
|
|
else
|
|
if [ -n "$reason" ] && grep -Fq "$reason" "$errors"; then
|
|
continue
|
|
fi
|
|
echo "FAIL $name ($state)"
|
|
sed -n '/^level=INFO/d; s/^/ /; p' "$errors"
|
|
fi
|
|
rc=1
|
|
chart_failed=1
|
|
done
|
|
[ "$chart_failed" -eq 0 ] || continue
|
|
if [ -n "$reason" ]; then
|
|
echo "SKIP $name ($reason)"
|
|
skipped=$((skipped + 1))
|
|
else
|
|
rendered=$((rendered + 1))
|
|
fi
|
|
done
|
|
|
|
echo "check-render-matrix: $rendered rendered, $skipped skipped"
|
|
exit "$rc"
|