Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.16] Fix WEBHOOK_DISABLE_NAMESPACE_OWNERSHIP env-var #3108

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions webhook/configmaps/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ func NewAdmissionController(
secretInformer := secretinformer.Get(ctx)
options := webhook.GetOptions(ctx)

// if this environment variable is set, it overrides the value in the Options
disableNamespaceOwnership := webhook.DisableNamespaceOwnershipFromEnv()
if disableNamespaceOwnership != nil {
options.DisableNamespaceOwnership = *disableNamespaceOwnership
}

key := types.NamespacedName{Name: name}

wh := &reconciler{
Expand Down
6 changes: 6 additions & 0 deletions webhook/resourcesemantics/defaulting/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ func newController(ctx context.Context, name string, optsFunc ...OptionFunc) *co
f(opts)
}

// if this environment variable is set, it overrides the value in the Options
disableNamespaceOwnership := webhook.DisableNamespaceOwnershipFromEnv()
if disableNamespaceOwnership != nil {
wopts.DisableNamespaceOwnership = *disableNamespaceOwnership
}

key := types.NamespacedName{Name: name}

wh := &reconciler{
Expand Down
6 changes: 6 additions & 0 deletions webhook/resourcesemantics/validation/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func newController(ctx context.Context, name string, optsFunc ...OptionFunc) *co
f(opts)
}

// if this environment variable is set, it overrides the value in the Options
disableNamespaceOwnership := webhook.DisableNamespaceOwnershipFromEnv()
if disableNamespaceOwnership != nil {
woptions.DisableNamespaceOwnership = *disableNamespaceOwnership
}

wh := &reconciler{
LeaderAwareFuncs: pkgreconciler.LeaderAwareFuncs{
// Have this reconciler enqueue our singleton whenever it becomes leader.
Expand Down
6 changes: 0 additions & 6 deletions webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ func New(
return nil, fmt.Errorf("unsupported TLS version: %d", opts.TLSMinVersion)
}

// if the environment variable is set, it overrides the value in the Options
disableNamespaceOwnership := DisableNamespaceOwnershipFromEnv()
if disableNamespaceOwnership != nil {
opts.DisableNamespaceOwnership = *disableNamespaceOwnership
}

syncCtx, cancel := context.WithCancel(context.Background())

webhook = &Webhook{
Expand Down
Loading