Skip to content

Commit

Permalink
fix(): configurable ns exclusion list
Browse files Browse the repository at this point in the history
Signed-off-by: Priyank Upadhyay <priyank@aveshasystems.com>
  • Loading branch information
priyank-upadhyay committed Oct 29, 2024
1 parent 10baf04 commit b7815ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/namespace/controllers/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package namespace

import (
"context"
"strings"

"github.com/go-logr/logr"
"github.com/kubeslice/kubeslice-monitoring/pkg/events"
Expand Down Expand Up @@ -48,8 +49,7 @@ type Reconciler struct {
Hubclient *hub.HubClientConfig
}

var excludedNs = []string{"kube-system", "default", "kubeslice-system", "kube-node-lease",
"kube-public", "istio-system"}
var excludedNs []string

var controllerName string = "namespaceReconciler"

Expand All @@ -68,6 +68,9 @@ func (c *Reconciler) getSliceNameFromNs(ns string) (string, error) {
}

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

excludedNsEnv := utils.GetEnvOrDefault("EXCLUDED_NS", "kube-system,default,kubeslice-system,kube-node-lease,kube-public,istio-system")
excludedNs = strings.Split(excludedNsEnv, ",")
for _, v := range excludedNs {
if v == req.Name {
return ctrl.Result{}, nil
Expand Down

0 comments on commit b7815ac

Please sign in to comment.