Support cloud-agnostic K8s config variable names#151
Open
alexrashed wants to merge 1 commit into
Open
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
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.
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