gxthrj commented on a change in pull request #715:
URL:
https://github.com/apache/apisix-ingress-controller/pull/715#discussion_r733692082
##########
File path: pkg/ingress/controller.go
##########
@@ -148,12 +153,20 @@ func NewController(cfg *config.Config) (*Controller,
error) {
}
var (
- watchingNamespace map[string]struct{}
+ watchingNamespace = new(sync.Map)
+ watchingLabels = make(map[string]string)
)
if len(cfg.Kubernetes.AppNamespaces) > 1 ||
cfg.Kubernetes.AppNamespaces[0] != v1.NamespaceAll {
- watchingNamespace = make(map[string]struct{},
len(cfg.Kubernetes.AppNamespaces))
for _, ns := range cfg.Kubernetes.AppNamespaces {
- watchingNamespace[ns] = struct{}{}
+ watchingNamespace.Store(ns, struct{}{})
+ }
+ }
+
+ // support namespace label-selector
+ if len(cfg.Kubernetes.NamespaceSelector) > 1 {
+ for _, labels := range cfg.Kubernetes.NamespaceSelector {
+ labelSlice := strings.Split(labels, "=")
Review comment:
Good catch. I added verification of namespaceSelector in
`cobra.validate`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]