Support cloud-agnostic K8s config variable names - #151
Conversation
… 2026.06 An upcoming LocalStack release renames the Kubernetes runtime config variables to cloud-agnostic names starting with the 2026.07 release: LOCALSTACK_K8S_NAMESPACE -> K8S_NAMESPACE LAMBDA_K8S_LABELS -> K8S_LABELS LAMBDA_K8S_SECURITY_CONTEXT -> K8S_CONTAINER_SECURITY_CONTEXT Add a localstack.useNewK8sVars helper that inspects the CalVer image tag and emits the new names only when the version is > 2026.06, falling back to the legacy names on older versions (where the new names do not exist). Rolling and non-CalVer tags (latest, stable, dev, ...) are treated as newest, consistent with the rest of the chart. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3facf80 to
108a9b9
Compare
|
@localstack/deployx The respective changes will be in the next release and the changes here are backwards compatible. WDYT, can we get this in? |
| {{- $useNew := true -}} | ||
| {{- if $calver -}} | ||
| {{- $parts := splitList "." $calver -}} | ||
| {{- $ym := add (mul (index $parts 0 | int) 100) (index $parts 1 | int) -}} |
There was a problem hiding this comment.
This assumes months are octal and fails for 08 and 09 (august and september are converted to 0) due to base auto-detection.
We should use atoi instead of int.
|
Claude flagged this: |
Motivation
An upcoming LocalStack release renames the Kubernetes runtime configuration variables to cloud-agnostic names, effective from the 2026.07 release. The old names continue to work as deprecated fallbacks on newer versions, but the new names do not exist on older versions — so the chart must choose names based on the image version.
LocalStack now uses CalVer image tags (
2026.06.0,2026.05.4, …), so "higher than 2026.06" maps directly onto the tag'sYYYY.MM.Changes
_helpers.tpl: newlocalstack.useNewK8sVarshelper that parses the image tag's leadingyear.monthand returns truthy only when it is> 2026.06. Rolling / non-CalVer tags (latest,stable,dev, bare year) are treated as newest → new names, consistent with the chart's existing convention for unknown tags.deployment.yaml: the three affected env vars now switch names based on version:LOCALSTACK_K8S_NAMESPACEK8S_NAMESPACELAMBDA_K8S_LABELSK8S_LABELSLAMBDA_K8S_SECURITY_CONTEXTK8S_CONTAINER_SECURITY_CONTEXTThe other
LOCALSTACK_K8S_*vars (SERVICE_NAME,POD_IP,POD_UID,POD_NAME,DEPLOYMENT_METHOD) are not part of the rename and are left untouched.Chart.yaml: version bump0.7.0→0.7.1.Testing
helm templateverified across 13 tag scenarios:latest,stable,dev,2026,2026.07.0,2026.7,2026.12.0,2027.01.02026.06.0,2026.06,2026.6.0,2025.12.0,0.14.0,1.4.0helm lintpasses (default and2026.07.0).Note (pre-existing, out of scope)
The security-context env var is gated on
.Values.lambda.securityContext(camelCase) whilevalues.yamldefineslambda.security_context(snake_case). This mismatch pre-dates this PR and means the var is not emitted when configured via the documented value; left unchanged here to keep the scope limited to the variable renaming.🤖 Generated with Claude Code