mirror of
https://github.com/kerberos-io/helm-charts.git
synced 2026-11-13 21:40:23 +00:00
* feat(hub): make the dominant color stage opt-in Add kerberospipeline.dominantColor.enabled (default false). It gates the pipe-dominantcolor deployment and is projected to pipe-analysis as DOMINANTCOLOR_ENABLED, so the producer and consumer follow one value. Requires a hub-pipeline-analysis image that reads DOMINANTCOLOR_ENABLED: older images always publish to kcloud-dominantcolor-queue.fifo, which would back up once the consumer is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(hub): bump analysis to v1.8.22 for DOMINANTCOLOR_ENABLED v1.8.22 is the first hub-pipeline-analysis release that reads the flag (uug-ai/hub-pipeline-analysis#114). Chart version moves to 0.159.0 since 0.158.0 was taken on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
3.5 KiB
Bash
82 lines
3.5 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
CHART_DIR="${1:-charts/hub}"
|
|
|
|
# Supply per-service test overrides without requiring a separate values file.
|
|
WAVE_FLAGS=()
|
|
for setting in event:10 notify:20 throttler:30 analysis:40 thumbnail:50 sprite:50 dominantColor:50 counting:50 sequence:60 monitor:70; do
|
|
service="${setting%%:*}"
|
|
wave="${setting#*:}"
|
|
WAVE_FLAGS+=(--set-string "kerberospipeline.${service}.deploymentAnnotations.argocd\\.argoproj\\.io/sync-wave=${wave}")
|
|
done
|
|
|
|
# Only read Deployment metadata, never pod-template or Service annotations.
|
|
extract_waves() {
|
|
awk '
|
|
/^---/ { deployment=0; metadata=0; name="" }
|
|
/^kind: Deployment$/ { deployment=1 }
|
|
/^metadata:$/ { metadata=1; next }
|
|
/^[^ #]/ { metadata=0 }
|
|
deployment && metadata && /^ name:/ { name=$2 }
|
|
deployment && metadata && /^ argocd.argoproj.io\/sync-wave:/ {
|
|
value=$2
|
|
gsub(/"/, "", value)
|
|
print name, value
|
|
}
|
|
' | sort
|
|
}
|
|
|
|
assert_waves() {
|
|
local rendered="$1"
|
|
local expected="$2"
|
|
local actual
|
|
actual="$(printf '%s\n' "$rendered" | extract_waves)"
|
|
if [[ "$actual" != "$expected" ]]; then
|
|
printf 'Unexpected Deployment waves:\n%s\nExpected:\n%s\n' "$actual" "$expected" >&2
|
|
return 1
|
|
fi
|
|
local all_count expected_count
|
|
all_count="$(printf '%s\n' "$rendered" | grep -c 'argocd.argoproj.io/sync-wave:' || true)"
|
|
expected_count="$(printf '%s\n' "$expected" | awk 'NF { count++ } END { print count+0 }')"
|
|
if [[ "$all_count" != "$expected_count" ]]; then
|
|
echo "Sync-wave annotation leaked outside expected Deployment metadata" >&2
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
expected="$(printf '%s\n' \
|
|
'pipe-event 10' 'pipe-notify 20' 'pipe-throttler 30' 'pipe-analysis 40' \
|
|
'pipe-thumbnail 50' 'pipe-sprite 50' 'pipe-dominantcolor 50' \
|
|
'pipe-counting 50' 'pipe-sequence 60' 'pipe-monitor 70' | sort)"
|
|
|
|
for mode in all pipeline; do
|
|
default_render="$(helm template hub "$CHART_DIR" --set "mode=$mode" --set kerberospipeline.sprite.enabled=true --set kerberospipeline.dominantColor.enabled=true)"
|
|
assert_waves "$default_render" ""
|
|
if printf '%s\n' "$default_render" | grep -q '^ annotations: null'; then
|
|
echo "Empty annotations must be omitted" >&2
|
|
exit 1
|
|
fi
|
|
configured_render="$(helm template hub "$CHART_DIR" "${WAVE_FLAGS[@]}" --set "mode=$mode" --set kerberospipeline.sprite.enabled=true --set kerberospipeline.dominantColor.enabled=true)"
|
|
assert_waves "$configured_render" "$expected"
|
|
echo "OK ($mode): defaults opt out; per-service values assign all ten Deployment waves"
|
|
done
|
|
|
|
disabled_optional="$(helm template hub "$CHART_DIR" "${WAVE_FLAGS[@]}" --set mode=pipeline)"
|
|
assert_waves "$disabled_optional" "$(printf '%s\n' "$expected" | grep -v -e '^pipe-sprite ' -e '^pipe-dominantcolor ')"
|
|
|
|
ui_render="$(helm template hub "$CHART_DIR" "${WAVE_FLAGS[@]}" --set mode=ui --set kerberospipeline.sprite.enabled=true --set kerberospipeline.dominantColor.enabled=true)"
|
|
assert_waves "$ui_render" ""
|
|
|
|
# Exercise zero/negative strings and an unrelated annotation on the same map.
|
|
for wave in 0 -10; do
|
|
override="$(helm template hub "$CHART_DIR" --set mode=pipeline \
|
|
--set-string "kerberospipeline.event.deploymentAnnotations.argocd\\.argoproj\\.io/sync-wave=$wave" \
|
|
--set-string 'kerberospipeline.event.deploymentAnnotations.example\.com/owner=queue-team')"
|
|
assert_waves "$override" "pipe-event $wave"
|
|
printf '%s\n' "$override" | grep -q "^ argocd.argoproj.io/sync-wave: \"$wave\"$"
|
|
printf '%s\n' "$override" | grep -q '^ example.com/owner: queue-team$'
|
|
done
|
|
|
|
echo "All pipeline Deployment annotation checks passed."
|