|
67 | 67 | restartOnSecretRefresh bool |
68 | 68 | unpropagatedAnnotations arrayArg |
69 | 69 | excludedNamespaces arrayArg |
| 70 | + includedNamespacesRegex string |
70 | 71 | ) |
71 | 72 |
|
72 | 73 | func init() { |
@@ -98,14 +99,13 @@ func main() { |
98 | 99 | flag.IntVar(&webhookServerPort, "webhook-server-port", 443, "The port that the webhook server serves at.") |
99 | 100 | flag.Var(&unpropagatedAnnotations, "unpropagated-annotation", "An annotation that, if present, will be stripped out of any propagated copies of an object. May be specified multiple times, with each instance specifying one annotation. See the user guide for more information.") |
100 | 101 | flag.Var(&excludedNamespaces, "excluded-namespace", "A namespace that, if present, will be excluded from HNC management. May be specified multiple times, with each instance specifying one namespace. See the user guide for more information.") |
| 102 | + flag.StringVar(&includedNamespacesRegex, "included-namespace-regex", ".*", "Namespace regular expression. Namespaces that match this regexp will be included and handle by HNC. As it is a regex, this parameter cannot be specified multiple times. Implicit wrapping of the expression \"^...$\" is done here") |
101 | 103 | flag.BoolVar(&restartOnSecretRefresh, "cert-restart-on-secret-refresh", false, "Kills the process when secrets are refreshed so that the pod can be restarted (secrets take up to 60s to be updated by running pods)") |
102 | 104 | flag.Parse() |
103 | 105 | // Assign the array args to the configuration variables after the args are parsed. |
104 | 106 | config.UnpropagatedAnnotations = unpropagatedAnnotations |
105 | | - config.ExcludedNamespaces = make(map[string]bool) |
106 | | - for _, exn := range excludedNamespaces { |
107 | | - config.ExcludedNamespaces[exn] = true |
108 | | - } |
| 107 | + |
| 108 | + config.SetNamespaces(includedNamespacesRegex, excludedNamespaces...) |
109 | 109 |
|
110 | 110 | // Enable OpenCensus exporters to export metrics |
111 | 111 | // to Stackdriver Monitoring. |
|
0 commit comments