@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
66You may obtain a copy of the License at
77
8- http://www.apache.org/licenses/LICENSE-2.0
8+ http://www.apache.org/licenses/LICENSE-2.0
99
1010Unless required by applicable law or agreed to in writing, software
1111distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,15 +23,22 @@ import (
2323
2424// Util - struct with 2 fields adminDomain and list of system namespaces
2525type Util struct {
26- adminDomain string
27- systemNamespaces []string
26+ adminDomain string
27+ systemNamespaces []string
28+ excludeNamespaces map [string ]bool
2829}
2930
3031// NewUtil - create new Util object
31- func NewUtil (adminDomain string , systemNamespaces []string ) * Util {
32+ func NewUtil (adminDomain string , systemNamespaces []string , excludeNamespaces []string ) * Util {
33+ excludedNamespaceMap := make (map [string ]bool )
34+ for _ , ns := range excludeNamespaces {
35+ excludedNamespaceMap [ns ] = true
36+ }
37+
3238 return & Util {
33- adminDomain : adminDomain ,
34- systemNamespaces : systemNamespaces ,
39+ adminDomain : adminDomain ,
40+ systemNamespaces : systemNamespaces ,
41+ excludeNamespaces : excludedNamespaceMap ,
3542 }
3643}
3744
@@ -78,6 +85,14 @@ func (u *Util) IsSystemDomain(domain string) bool {
7885 return false
7986}
8087
88+ // IsNamespaceExcluded - check if the current namespace is in the skip namespaces list
89+ func (u * Util ) IsNamespaceExcluded (ns string ) bool {
90+ if _ , ok := u .excludeNamespaces [ns ]; ok {
91+ return true
92+ }
93+ return false
94+ }
95+
8196// IsAdminDomain - check if domain is admin domain
8297func (u * Util ) IsAdminDomain (domain string ) bool {
8398 if domain == u .adminDomain {
0 commit comments