kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

Why set namespace with kustomize for cluster-scoped Mutating|ValidatingWebhookConfiguration?

Open davidxia opened this issue 1 year ago • 2 comments
trafficstars

What happened?

Why does kubebuilder use a namespace kustomization transformer to set a namespace for Mutating|ValidatingWebhookConfiguration if these are cluster-scoped resources? Code here

Isn't this unnecessary?

What did you expect to happen?

IIUC, lines of code above shouldn't exist as they don't do anything?

How can we reproduce it (as minimally and precisely as possible)?

Run kubebuilder create webhook --group batch --version v1 --kind CronJob --defaulting --programmatic-validation as described in Implementing defaulting/validating webhooks.

Expected output

# the following config is for teaching kustomize where to look at when substituting vars.
# It requires kustomize v2.1.0 or newer to work properly.
nameReference:
- kind: Service
  version: v1
  fieldSpecs:
  - kind: MutatingWebhookConfiguration
    group: admissionregistration.k8s.io
    path: webhooks/clientConfig/service/name
  - kind: ValidatingWebhookConfiguration
    group: admissionregistration.k8s.io
    path: webhooks/clientConfig/service/name

varReference:
- path: metadata/annotations

Actual output

# the following config is for teaching kustomize where to look at when substituting vars.
# It requires kustomize v2.1.0 or newer to work properly.
nameReference:
- kind: Service
  version: v1
  fieldSpecs:
  - kind: MutatingWebhookConfiguration
    group: admissionregistration.k8s.io
    path: webhooks/clientConfig/service/name
  - kind: ValidatingWebhookConfiguration
    group: admissionregistration.k8s.io
    path: webhooks/clientConfig/service/name

namespace:
- kind: MutatingWebhookConfiguration
  group: admissionregistration.k8s.io
  path: webhooks/clientConfig/service/namespace
  create: true
- kind: ValidatingWebhookConfiguration
  group: admissionregistration.k8s.io
  path: webhooks/clientConfig/service/namespace
  create: true

varReference:
- path: metadata/annotations

Kustomize version

5.1.0

Operating system

Linux

davidxia avatar Dec 11 '23 13:12 davidxia

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Dec 11 '23 13:12 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Mar 10 '24 14:03 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Apr 09 '24 14:04 k8s-triage-robot

@davidxia Thanks for your interest in Kubebuilder and Kustomize. This issue would fit in the Kubebuilder project better. Could you please raise this issue in here: https://github.com/kubernetes-sigs/kubebuilder.

There are a few questions related to the plugin version which you are using, since on the Kubebuilder side we did make a bunch of changes. But I'll follow it up there.

varshaprasad96 avatar Apr 10 '24 16:04 varshaprasad96

Closing this issue as it's not related to Kustomize directly, but to how Kubebuilder is using this project. Please feel free to reopen if you feel otherwise.

varshaprasad96 avatar Apr 10 '24 16:04 varshaprasad96