Skip to content

Commit fd885b5

Browse files
authored
feat(push): support migration pod annotations (#8105)
Allow operators to configure migration Pod annotations independently of runtime Pod annotations. This lets clusters with automatic sidecar injection opt the migration Job out without changing the gateway Deployment or Helm hook metadata. The new string-map setting defaults to empty. Chart version 0.3.3 is prepared here; publication requires a separate approved chart release PR. ### Validation The full chart render suite and focused migration annotation tests pass. Tests verify unchanged default resources and hooks, independent runtime annotations, and rejection of non-string annotation values. Independent agent review found no blockers. Repository-wide `just ci` exited 1 in unchanged `buzz-acp` tests: idle/stdout keepalive timing and steering assertions (one failure in the first group, four in the second). Subsequent recipes were not reached. No rerun or unrelated code fix was attempted. Human testing remains pending. Signed-off-by: Tom Brow <[email protected]>
1 parent 5173fad commit fd885b5

6 files changed

Lines changed: 40 additions & 1 deletion

File tree

‎deploy/charts/buzz-push-gateway/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ apiVersion: v2
33
# branches (see docs/push-gateway-deployment.md, "Gateway chart release").
44
name: buzz-push-gateway
55
description: Public capability-gated APNs last-hop gateway for Buzz
6-
version: 0.3.2
6+
version: 0.3.3
77
appVersion: "0.1.0"
88
type: application

‎deploy/charts/buzz-push-gateway/templates/migration-job.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ spec:
1111
backoffLimit: 3
1212
template:
1313
metadata:
14+
{{- with .Values.migration.podAnnotations }}
15+
annotations: {{- toYaml . | nindent 8 }}
16+
{{- end }}
1417
labels: {{- include "push.migrationLabels" . | nindent 8 }}
1518
spec:
1619
restartPolicy: Never
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
chart=deploy/charts/buzz-push-gateway
4+
out=$(mktemp -d)
5+
trap 'rm -rf "$out"' EXIT
6+
helm template push "$chart" >"$out/default.yaml"
7+
helm template push "$chart" \
8+
--set-string 'migration.podAnnotations.sidecar\.istio\.io/inject=false' \
9+
--set-string 'podAnnotations.example\.com/runtime=enabled' >"$out/annotated.yaml"
10+
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
11+
base, changed = %w[default annotated].map { |name| YAML.load_stream(File.read("#{ARGV[0]}/#{name}.yaml")).compact }
12+
job = changed.find { |r| r['kind'] == 'Job' }
13+
raise 'migration annotation missing or not a string' unless job.dig('spec', 'template', 'metadata').delete('annotations') == {'sidecar.istio.io/inject' => 'false'}
14+
runtime = changed.find { |r| r['kind'] == 'Deployment' }
15+
raise 'runtime annotations changed' unless runtime.dig('spec', 'template', 'metadata').delete('annotations') == {'example.com/runtime' => 'enabled'}
16+
raise 'annotations changed other resources or hook metadata' unless base == changed
17+
RUBY
18+
for value in true 7; do
19+
if helm template push "$chart" --set "migration.podAnnotations.invalid=$value" >"$out/invalid.log" 2>&1; then
20+
echo 'expected non-string migration annotation to fail schema validation' >&2
21+
exit 1
22+
fi
23+
if ! grep -Eq 'Expected: string|want string' "$out/invalid.log"; then
24+
cat "$out/invalid.log" >&2
25+
exit 1
26+
fi
27+
done

‎deploy/charts/buzz-push-gateway/tests/render.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33
bash deploy/charts/buzz-push-gateway/tests/grant-lifetime.sh
4+
bash deploy/charts/buzz-push-gateway/tests/migration-annotations.sh
45
out=$(mktemp); production_out=$(mktemp); route_out=$(mktemp); datadog_out=$(mktemp)
56
trap 'rm -f "$out" "$production_out" "$route_out" "$datadog_out" "${monitoring_out:-}"' EXIT
67
gateway_origin_arg=(--set 'gatewayOrigin=https://push.example')

‎deploy/charts/buzz-push-gateway/values.schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@
239239
},
240240
"resources": {
241241
"type": "object"
242+
},
243+
"podAnnotations": {
244+
"type": "object",
245+
"additionalProperties": {
246+
"type": "string"
247+
}
242248
}
243249
}
244250
}

‎deploy/charts/buzz-push-gateway/values.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ existingSecret: buzz-push-gateway
1010
# DDL-capable credentials are used only by the pre-install/pre-upgrade migration
1111
# Job. Runtime DATABASE_URL in existingSecret should have DML-only privileges.
1212
migration:
13+
# Applies only to migration Pods, independently of runtime podAnnotations.
14+
podAnnotations: {}
1315
existingSecret: buzz-push-gateway-migrations
1416
databaseUrlKey: DATABASE_URL
1517
# Existing LOGIN role used by runtime DATABASE_URL. Migrations grant it only

0 commit comments

Comments
 (0)