[PLT] Fix tenant mutating webhook: aceptar solicitudes v1beta1 via conversion#37
Open
forselli-stratio wants to merge 1 commit into
Conversation
…ersion The mutating webhook rule for Tenants used apiVersions: "*" with matchPolicy: Exact. This causes the API server to forward v1beta1 requests directly to the webhook without version conversion. The webhook handler decodes requests into *v1beta2.Tenant, so it fails with "unable to decode v1beta1 into *v1beta2.Tenant" when clients (e.g. CCT orchestrator) submit Tenants using the v1beta1 API. Change apiVersions from "*" to "v1beta2" and matchPolicy from Exact to Equivalent. With Equivalent, the API server converts any v1beta1 request to v1beta2 via the CRD conversion webhook before forwarding to the admission webhook. This matches the existing behavior of the validating webhook which already uses v1beta2 and Equivalent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Resumen
Este PR corrige un error en la configuracion del webhook mutante de Tenants que provoca que los clientes que envian solicitudes usando la API
v1beta1(como CCT Orchestrator) reciban el siguiente error:Causa raiz
El webhook mutante de Tenants tenia configuradas dos opciones incorrectas en la
CapsuleConfiguration:apiVersions: "*"- El caracter*hace que la regla del webhook coincida con cualquier version directamente. Cuando un cliente envia una solicitudv1beta1, el API server la reenvía al webhook sin conversion, porque el*ya coincide exactamente.matchPolicy: Exact- Con esta politica, el API server solo llama al webhook cuando la solicitud coincide exactamente con la regla. Al combinarlo conapiVersions: "*", el objeto llega al webhook en la version original del cliente (v1beta1).El handler del webhook intenta deserializar el objeto entrante directamente como
*v1beta2.Tenant(verinternal/webhook/tenant/validation/handler.go). Cuando el objeto tieneapiVersion: capsule.clastix.io/v1beta1, la deserializacion falla porque el esquema del runtime no tiene registrada una funcion de conversion para el contexto de admission.Esto contrasta con el webhook validante de Tenants, que ya usaba correctamente
apiVersions: v1beta2.Cambios
charts/capsule/templates/configuration.yamlapiVersions(webhook mutante de tenants)"*"v1beta2charts/capsule/values.yamlwebhooks.hooks.tenants.matchPolicyExactEquivalentComo funciona el fix
Con
apiVersions: v1beta2ymatchPolicy: Equivalent:v1beta1de un cliente.v1beta1, nov1beta2).Equivalent, el API server detecta quev1beta1yv1beta2son el mismo recurso subyacente.v1beta1av1beta2usando el CRD conversion webhook antes de enviarlo al admission webhook.v1beta2y lo deserializa correctamente.Este comportamiento ya era el correcto para el webhook validante (que usaba
v1beta2+Equivalent). Este PR alinea el webhook mutante con el mismo patron.Plan de pruebas
v1beta1(ej. desde CCT Orchestrator).unable to decode v1beta1 into *v1beta2.Tenant.🤖 Generated with Claude Code