bug: conversion of `APIExport` from v1alpha2 to v1alpha1 produces invalid permission claims

Aperta
#4,573 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@rida-ghreizy ci sta già lavorando.

Dal 27/11/2026.

  • #4574 di @rida-ghreizy — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go, kubernetes
Ambito
api, backend

Direzione di ricerca

Start by locating the APIExport conversion between apis.kcp.io/v1alpha2 and v1alpha1, then inspect the PermissionClaim conversion and its tests. Reproduce the reported round trip with a claim that has neither all nor resourceSelector after conversion; done means the v1alpha1 result satisfies the validation rule. A pull request is already open for this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/bug
Describe the bug

If an APIExport is created as apis.kcp.io/v1alpha2 and read back as apis.kcp.io/v1alpha1, its permission claims have neither all nor resourceSelector set. Writing back the v1alpha1 object exactly as returned by the server is rejected, because the CEL rule on PermissionClaim requires exactly one of them.

Steps To Reproduce
  1. Create an APIExport as v1alpha2:

    apiVersion: apis.kcp.io/v1alpha2
    kind: APIExport
    metadata:
      name: example.kcp.io
    spec:
      permissionClaims:
        - group: ""
          resource: namespaces
          verbs: ["get"]
    
  2. Read it as v1alpha1:

    kubectl get apiexports.v1alpha1.apis.kcp.io example.kcp.io -o yaml
    
    ...
    spec:
      permissionClaims:
      - resource: namespaces # neither all nor resourceSelector
    
Expected Behaviour

Conversion returns a valid APIExport in v1alpha1.

Additional Context

I hit this issue, when manually adding additional permission claims to an APIExport managed by the api-syncagent. The next update of the APIExport (I created an additional PublishedResource) failed with:

failed to reconcile APIExport: failed to ensure APIExport /example.kcp.io: failed to update object *v1alpha1.APIExport "/example.kcp.io": APIExport.apis.kcp.io "example.kcp.io" is invalid: spec.permissionClaims[1]: Invalid value: either "all" or "resourceSelector" must be set

To work around this issue, I added the following annotation to the v1alpha2 object:

metadata:
  annotations:
    apis.v1alpha2.kcp.io/v1alpha1-permission-claims: '[{"resource":"namespaces","all":true}]'
Lingua principale
Go
Stelle
2.9k
Fork
480
Merge medio
2g 12h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kcp-dev/kcp

Tutte le issue di kcp-dev/kcp

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.