fix(k8s): let scope-configurations override the image pull secrets - #256
Open
agustincelentano wants to merge 2 commits into
Open
fix(k8s): let scope-configurations override the image pull secrets#256agustincelentano wants to merge 2 commits into
agustincelentano wants to merge 2 commits into
Conversation
The values.yaml default (ENABLED: true, SECRETS: [ecr-secret]) reaches build_context as the IMAGE_PULL_SECRETS env var, because the workflow includes that file. The env branch ran before the provider branch, so security.image_pull_secrets in scope-configurations was never read and every deployment carried ecr-secret whether the cluster had it or not. Read the provider first and fall back to the included value, the same priority every other setting uses. An empty secret list now disables the block, so naming no secrets stops rendering an imagePullSecrets entry the kubelet cannot resolve. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The k8s values shipped ENABLED: true with ecr-secret, a secret the scope names but never creates, so any cluster without it got a kubelet warning on every pod for a secret it was never going to have. azure and azure-aro already ship ENABLED: false; this aligns k8s with them. BREAKING CHANGE: a cluster that has ecr-secret and relied on the default to inject it must now declare it in the scope-configurations provider under security.image_pull_secrets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Sumé el segundo commit: el default de Con solo el cambio de precedencia, una instalación que no configura el provider seguía igual: el default mandaba y el warning seguía. Y el default nombraba Es breaking para un cluster que tenga ese secret y dependa del default para inyectarlo: ahora lo declara en |
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.
El problema
Todo deployment que crea el scope k8s sale con este bloque, exista o no el secret en el cluster:
En una instalación EKS donde ese secret no existe (la imagen se baja con el rol del nodo), el kubelet emite el aviso en cada pod, para siempre:
Los pods andan, así que no rompe nada: ensucia los eventos de todos los namespaces y manda a investigar un problema que no existe. Lo peor es que no hay forma de desactivarlo: la instalación tiene
security.image_pull_secrets: []en su providerscope-configurationsy no pasa nada.Por qué el provider no se lee
k8s/values.yamltrae el default:Los workflows lo cargan con
include: "$SERVICE_PATH/values.yaml", así que llega abuild_contextcomo variable de entorno. Y ahí la resolución estaba escrita al revés:La rama del env siempre matchea, así que la del provider es código muerto. Es la única variable del script resuelta así: el resto usa
get_config_value --provider ... --env ... --default ..., con prioridad providers → env → default.Qué cambia
Se consulta el provider primero y el valor incluido pasa a ser el default:
Y una lista vacía apaga el bloque:
'{ENABLED: ($enabled and ($secrets | length > 0)), SECRETS: $secrets}'Sin eso,
image_pull_secrets: []conenabledheredado en true rendericaría unimagePullSecrets:sin entradas. Un secret que no se nombra no se puede usar.PULL_SECRETSsigue ganando sobre todo, sin cambios.Y el default deja de nombrar un secret que el scope no crea
Con lo de arriba solo, una instalación que no configura el provider sigue igual: el default de
values.yamlmanda y el warning sigue. Así que el default también cambia:No es una decisión nueva del repo:
azure/values.yamlyazure-aro/values.yamlya vienen conENABLED: false. El overlayk8sera el único que quedaba nombrandoecr-secret, un secret de ECR que el scope no crea y que en GKE, en AKS o en un EKS que usa el rol del nodo no significa nada.Esto es breaking para un caso concreto: un cluster que tiene
ecr-secretcreado y depende de que el scope lo inyecte sin haberlo configurado en ningún lado. Esa instalación tiene que declararlo ahora en el provider:Que es justamente lo que antes no funcionaba.
Compatibilidad
ecr-secret. Es el cambio breaking de arriba.image_pull_secrets: []: deja de emitir el bloque, que es exactamente lo que pedía.Tests
Siete casos en
build_context.bats: el nuevo default deja el bloque apagado; un valor incluido con secrets sigue aplicando sin provider; el provider los enciende sobre un default apagado; el provider reemplaza la lista incluida; una lista vacía en el provider apaga el bloque; sin nada configurado queda apagado. La suite queda en 80/82 — los dos rojos (replica calculation) ya fallan enmainy no los toca este cambio.🤖 Generated with Claude Code