@@ -37,6 +37,7 @@ func init() {
3737 flag .BoolVar (& f .ReplicateRoleBindings , "replicate-role-bindings" , true , "Enable replication of role bindings" )
3838 flag .BoolVar (& f .ReplicateServiceAccounts , "replicate-service-accounts" , true , "Enable replication of service accounts" )
3939 flag .BoolVar (& f .SyncByContent , "sync-by-content" , false , "Always compare the contents of source and target resources and force them to be the same" )
40+ flag .StringVar (& f .ExcludeNamespaces , "exclude-namespaces" , "" , "Comma-separated list of regex patterns for namespaces to exclude from replication" )
4041 flag .Parse ()
4142
4243 switch strings .ToUpper (strings .TrimSpace (f .LogLevel )) {
@@ -88,14 +89,17 @@ func main() {
8889
8990 client = kubernetes .NewForConfigOrDie (config )
9091
92+ excludePatterns := strings .Split (f .ExcludeNamespaces , "," )
93+ filter := common .NewNamespaceFilter (excludePatterns )
94+
9195 if f .ReplicateSecrets {
92- secretRepl := secret .NewReplicator (client , f .ResyncPeriod , f .AllowAll , f .SyncByContent )
96+ secretRepl := secret .NewReplicator (client , f .ResyncPeriod , f .AllowAll , f .SyncByContent , filter )
9397 go secretRepl .Run ()
9498 enabledReplicators = append (enabledReplicators , secretRepl )
9599 }
96100
97101 if f .ReplicateConfigMaps {
98- configMapRepl := configmap .NewReplicator (client , f .ResyncPeriod , f .AllowAll , f .SyncByContent )
102+ configMapRepl := configmap .NewReplicator (client , f .ResyncPeriod , f .AllowAll , f .SyncByContent , filter )
99103 go configMapRepl .Run ()
100104 enabledReplicators = append (enabledReplicators , configMapRepl )
101105 }
0 commit comments