Skip to content

Commit

Permalink
Remove namespace optimization
Browse files Browse the repository at this point in the history
The admission controller works with secrets from other namespaces. A restriction is not possible at this point.
  • Loading branch information
timuthy committed Jan 5, 2024
1 parent 7e269ba commit 23a6593
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ import (
v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
gardenerhealthz "github.com/gardener/gardener/pkg/healthz"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/component-base/version/verflag"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/cluster"
"sigs.k8s.io/controller-runtime/pkg/healthz"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -103,13 +101,6 @@ func NewAdmissionCommand(ctx context.Context) *cobra.Command {
return err
}
managerOptions.LeaderElectionConfig = sourceClusterConfig
} else {
// Restrict the cache for secrets to the configured namespace to avoid the need for cluster-wide list/watch permissions.
managerOptions.Cache = cache.Options{
ByObject: map[client.Object]cache.ByObject{
&corev1.Secret{}: {Namespaces: map[string]cache.Config{webhookOptions.Server.Completed().Namespace: {}}},
},
}
}

mgr, err := manager.New(restOpts.Completed().Config, managerOptions)
Expand Down

0 comments on commit 23a6593

Please sign in to comment.