Repository navigation
fix(helm): start cleanly on TLS/Redis defaults, move webhook and registry keys to Secrets - #48
Andrew Grathwohl (agrathwohl) wants to merge 2 commits into
Conversation
…stry keys to Secrets
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 07df1e8. Configure here.
| name: {{ .privateRegistry.existingSecret | default (printf "%s-private-registry" (include "socket-firewall.fullname" $)) }} | ||
| key: {{ .privateRegistry.existingSecretKey }} | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
Secret updates skip pod rollout
Medium Severity
Moving webhook.authHeader and pathRouting.privateRegistry.apiKey out of the ConfigMap means a Helm upgrade that only changes those values no longer touches checksum/config. Pods keep the old WEBHOOK_AUTH_HEADER and PRIVATE_REGISTRY_KEY until they are recreated, so rotated credentials do not take effect.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 07df1e8. Configure here.
The ConfigMap still renders two secrets in plain text. This commit moves them to Secrets. Remove `socket.basicAuthPassword` from the ConfigMap. Store it in the `<fullname>-basic-auth` Secret and pass it as the `SOCKET_BASIC_AUTH_PASSWORD` environment variable. Add `socket.basicAuthExistingSecret` and `socket.basicAuthExistingSecretKey` (defaults to `SOCKET_BASIC_AUTH_PASSWORD`) to support using an existing Secret instead. Remove `pathRouting.privateRegistry.password` from the ConfigMap. Store it in the `<fullname>-private-registry` Secret alongside the API key and pass it as `PATH_ROUTING_PRIVATE_REGISTRY_PASSWORD`. Add `pathRouting.privateRegistry.existingSecretPasswordKey` (defaults to `PATH_ROUTING_PRIVATE_REGISTRY_PASSWORD`). If `pathRouting.privateRegistry.existingSecret` is set and `pathRouting.privateRegistry.username` is present, the chart reads the password key. Otherwise, it reads the API key. Usernames stay in the ConfigMap. No firewall image change is needed. The 2.9.3 config tool checks an environment variable override before `socket.yml` for every key (key path uppercased, dots to underscores). Verified that `socket-proxy-config-tool generate` with the rendered ConfigMap and these two environment variables writes the basic auth password and `PRIVATE_REGISTRY_AUTH_CREDENTIAL` as `username:password` to `/app/config.env`. Add a `checksum/secret` pod annotation using the rendered `templates/secret.yaml`. Without it, changing the webhook auth header or registry API key no longer restarted pods once those values left the ConfigMap. With it, any change to a chart-created Secret value triggers a rollout.
Julian Gruber (juliangruber)
left a comment
There was a problem hiding this comment.
Is there a way to add CI for this, in order to catch future regressions?


Fixes FIRE-322
What was broken and what changed
The chart failed to start in several configurations, including its defaults.
The
generate-certsinit container ran as UID 1000 and wrote a certificate key that the firewall image (UID 1001) could not read, so nginx crash-looped onPermission denied.initContainers.certGenerator.securityContext.runAsUsernow defaults to 1001.Default TLS installs failed because the certificate SAN list was empty. It now always includes the Service name and its DNS forms, plus any configured domains. The cert script runs with
set -e, so a failed step stops it.tls.existingSecretwithouttls.certManagercould not load certificates because the keys did not match the filenames nginx reads.tls.crtandtls.keyalways mount asfullchain.pemandprivkey.pem. The newtls.remapKeysdefaults totrue; setting it tofalsemounts secrets keyedfullchain.pemandprivkey.pemwithout remapping.tls.certManagernow only controls theca.crtprojection.With Redis enabled, Kubernetes service-link environment variables from a Service named
redissetREDIS_PORTand caused aValueErrorat startup.enableServiceLinksis nowfalseon the pod.The default
redis.host: redisfailed to connect because nginx's resolver ignores DNS search domains. Bare hosts now render as<host>.<release namespace>.svc.<clusterDomain>. A newwait-for-redisinit container holds the pod inInituntil Redis accepts TCP connections.webhook.authHeaderandpathRouting.privateRegistry.apiKeyrendered in plain text in the ConfigMap. They move to Secrets, passed as environment variablesWEBHOOK_AUTH_HEADERandPRIVATE_REGISTRY_KEY. NewexistingSecretandexistingSecretKeyoptions support existing Secrets for both.Default single-replica installs had a PodDisruptionBudget with
minAvailable: 1that blocked node drains. The PDB now only renders whenreplicaCount> 1, orautoscaling.minReplicas> 1 with autoscaling on.Upgrade notes
fullchain.pem/privkey.pemthat worked withoutcertManager, settls.remapKeys: false.initContainers.certGenerator.securityContext, itsrunAsUsermust match the firewall UID 1001.How it was validated
Tested on kind with Kubernetes 1.36.1 and firewall image 2.9.3. The chart on
mainreproduced theprivkey.pemPermission denied,fullchain.pemNo such file, andREDIS_PORTValueErrorcrashes.Verified all pods reach Ready state for:
tls.existingSecret(served the secret's certificate)fullchain.pem/privkey.pemwithtls.remapKeys: falseredis(3 client connections inredis-cli client list)/app/config.envfrom Secrets, not the ConfigMap)Set
redis.hostto an invalid address and confirmed the pod remained inInitstate, loggingWaiting for nope.<namespace>.svc.cluster.local/6379.Passed
helm lint,kubeconformagainst Kubernetes 1.30.0 for the default install, examples, and 4 code paths, andhelm unittestwith PR #10's 2 test files, 5 of 5 passing.What is left
cloudformation/firewall-eks.yamlChartVersiondefault is still 0.11.7.Note
Medium Risk
Changes default TLS mounting, Redis connectivity, PDB presence, and secret wiring—upgrades may need
tls.remapKeys: falseor lose single-replica PDBs, but fixes prior crash-loop defaults.Overview
Helm chart 0.12.0 fixes several default-install crash paths and tightens how TLS, Redis, and secrets are handled.
Startup and TLS: The cert generator init container runs as UID 1001 so nginx can read
privkey.pem, always adds Service DNS SANs (plusclusterDomain), and usesset -e. Existing TLS secrets mount viatls.remapKeys(tls.crt/tls.key→fullchain.pem/privkey.pemby default);tls.certManagernow only controls optionalca.crtprojection.Redis: Bare
redis.hostnames are FQDN-qualified for nginx’s resolver, await-for-redisinit container blocks until TCP is up, andenableServiceLinks: falseavoidsREDIS_PORTservice-link env collisions.Secrets:
webhook.authHeaderandpathRouting.privateRegistry.apiKeyare removed from the ConfigMap; chart-created orexistingSecretvalues are injected asWEBHOOK_AUTH_HEADERandPRIVATE_REGISTRY_KEY.Ops: PDB renders only when more than one replica is always running; README documents new values (
clusterDomain, Redis host behavior, TLS/PDB notes).Reviewed by Cursor Bugbot for commit 07df1e8. Configure here.