Skip to content

Commit

Permalink
fix: initialize default namespace when given
Browse files Browse the repository at this point in the history
Otherwise the controller is not able to delete the vcluster.
  • Loading branch information
johannesfrey committed Jun 13, 2024
1 parent 2e10d10 commit 5888b49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

var namespaces map[string]cache.Config
if namespace != "" {
namespaces = map[string]cache.Config{
namespace: {},
}
}

mgr, err := manager.New(ctrl.GetConfigOrDie(), manager.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
Expand All @@ -87,9 +94,7 @@ func main() {
LeaderElection: enableLeaderElection,
LeaderElectionID: "4012c7fa.cluster.x-k8s.io",
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
namespace: {},
},
DefaultNamespaces: namespaces,
},
})
if err != nil {
Expand Down

0 comments on commit 5888b49

Please sign in to comment.