0

I am trying to add a admission webhook to validate different resources(e.g.a,b) in the same validation logic. But I meet decode problem when I try to create resource b. Here is my yaml

kind: ValidatingWebhookConfiguration
metadata:
....
webhooks:

- admissionReviewVersions:
  - v1
    clientConfig:
    service:
      name: x-admission-webhooks
      namespace: x
      path: /validate-a
  matchPolicy: Equivalent
  name: a.kb.io
  namespaceSelector: {}
  objectSelector: {}
  rules:
  - apiGroups:
    - ab.sh
    apiVersions:
    - v1alpha1
    operations:
    - CREATE
    - UPDATE
    resources:
    - a,b
  sideEffects: None
  timeoutSeconds: 10

And I also add webhookmanager for a,b separately. But when I create resource b, it says: Error from server: error when creating "b.yaml": admission webhook "a.kb.io" denied the request: unable to decode ab.sh/v1alpha1, Kind=b into *v1alpha1.a

How could I set multiple resources in a single admission webhook?

SpritZhou
  • 56
  • 3

0 Answers0