Skip to content

Commit 014c85b

Browse files
committed
fix(cpex): roll rebuilt images on make deploy (same-tag :dev footgun)
make deploy rebuilds + kind-loads the local :dev images, but a Deployment whose pod template is unchanged won't roll on its own (imagePullPolicy: Never, no spec diff), so a code-only rebuild kept running the previous image until a manual 'kubectl rollout restart'. deploy now: waits for Keycloak to settle first, then 'rollout restart's the two locally-built workloads (hr-mcp; hr-cpex-agent, which carries the agent + authbridge-cpex sidecar) so a rebuild always lands. Keycloak is left alone (upstream pinned image; restarting it regenerates realm keys and re-triggers the stale-JWKS / cpex.auth_unknown_kid race the settle-wait guards against). Verified: 'make deploy' then 'make scenarios' (no manual rollout) -> 9/9, 0 auth_unknown_kid. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 8898128 commit 014c85b

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

authbridge/demos/hr-cpex/Makefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,24 @@ apply: ## kubectl apply the manifests (assumes images already loaded)
116116

117117
deploy: build-images load-images apply ## Full bring-up: build, load, apply
118118
@echo
119-
@echo "Waiting for rollouts to finish..."
120-
@# rollout status follows the new ReplicaSet, so it's correct even when the
121-
@# `set env` in `apply` rolls the agent pod (a plain label wait can race a
122-
@# terminating old pod against the new one).
123-
kubectl -n $(NAMESPACE) rollout status deployment/keycloak --timeout=180s
124-
kubectl -n $(NAMESPACE) rollout status deployment/hr-mcp --timeout=120s
125-
kubectl -n $(NAMESPACE) rollout status deployment/hr-cpex-agent --timeout=120s
119+
@# Settle Keycloak FIRST so the cpex sidecar (restarted below) fetches a
120+
@# current JWKS. `apply` rolls Keycloak only when its manifest changed; this
121+
@# waits either way. We do NOT restart Keycloak — it's an upstream pinned
122+
@# image, and restarting it regenerates the realm signing keys, which would
123+
@# leave any already-running sidecar serving cpex.auth_unknown_kid.
124+
@echo "Waiting for Keycloak to settle..."
125+
kubectl -n $(NAMESPACE) rollout status deployment/keycloak --timeout=180s
126+
@echo
127+
@# Force the locally-built :dev images to reload. `kind load` overwrites the
128+
@# image in the node store, but a Deployment whose pod template is unchanged
129+
@# won't roll on its own (imagePullPolicy: Never, no spec diff) — so a
130+
@# code-only rebuild would otherwise keep running the PREVIOUS image. Restart
131+
@# the two locally-built workloads (hr-mcp; hr-cpex-agent carries both the
132+
@# agent and the authbridge-cpex sidecar) so a rebuild always lands.
133+
@echo "Rolling the locally-built workloads onto the freshly-loaded images..."
134+
kubectl -n $(NAMESPACE) rollout restart deployment/hr-mcp deployment/hr-cpex-agent
135+
kubectl -n $(NAMESPACE) rollout status deployment/hr-mcp --timeout=120s
136+
kubectl -n $(NAMESPACE) rollout status deployment/hr-cpex-agent --timeout=120s
126137
@echo
127138
@printf "\033[1;32mDeploy complete.\033[0m Next:\n"
128139
@printf " make port-forward # in another terminal\n"

0 commit comments

Comments
 (0)