Kubernetes Caddy Deployment Patching & GCP Redis Configuration#59
Merged
universe-ops merged 13 commits intomainfrom Dec 22, 2025
Merged
Kubernetes Caddy Deployment Patching & GCP Redis Configuration#59universe-ops merged 13 commits intomainfrom
universe-ops merged 13 commits intomainfrom
Conversation
added 13 commits
December 13, 2025 21:51
smecsia
approved these changes
Dec 22, 2025
Cre-eD
added a commit
that referenced
this pull request
Apr 10, 2026
… restarts time.Now() was used at pulumi eval time, so caddy-updated-at always changed on every pulumi up even when the Caddyfile was identical. This dirtied the pod template on every app deployment, causing a Caddy rolling restart each time — which triggered Cloudflare 521 errors due to persistent connections being dropped before Cloudflare rerouted them. History: the original value was the static string "latest" (PR #59 changed it to time.Now() as an "improvement"). The intent was informational — not a rollout trigger. Fix: derive caddy-updated-at from the Caddyfile content hash (same source as caddy-update-hash). The annotation value is now stable across pulumi ups when the Caddyfile hasn't changed, so K8s sees no pod template diff → no rollout. Caddy still rolls when the Caddyfile actually changes (different hash). Confirmed root cause via GCP Cloud Logging: all three Caddy patch events on 2026-04-10 had identical hash (03709a04d391d8ac) but different timestamps, proving time.Now() was the sole cause of every rollout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Enhanced Kubernetes deployment patching for Caddy services and improved GCP Redis configuration handling. This PR introduces native Kubernetes client-based patching to bypass Pulumi's DeploymentPatch validation limitations, enabling reliable annotation updates for Caddy deployments.
Key Changes
1. Native Kubernetes Deployment Patching
PatchDeployment()function using native Kubernetes Go client instead of Pulumi resourcesApplyTWithContextto resolve Pulumi outputs before executing patch2. Caddy Deployment Naming Consistency
GenerateCaddyDeploymentName()exported function for consistent naming across packagescaddy-stagingnotcaddy--staging)DeploymentNameoverride in Caddy config for adoption scenarioskubernetes/naming.go,kubernetes/kube_run.go,gcp/gke_autopilot_stack.go3. Improved Caddy Annotation Updates
4. GCP Redis Configuration
AdoptandClusterNamefields to support adoption of existing Redis instances5. GKE Autopilot Stack Updates
GenerateCaddyDeploymentName()for consistencyDeploymentNameconfig for adopted Caddy deploymentsEnableServerSideApplyfor Kubernetes provider (required for DeploymentPatch)6. Dependencies
timeimport for RFC3339 timestamp formattingsdkK8simport for Kubernetes provider type castingTechnical Details
Deployment Patch Architecture:
Caddy Deployment Naming:
caddy-{environment}across all cloud providersTesting
go build ./...welder run fmtBreaking Changes
None. All changes are backward compatible.
Related Issues