Skip to content

Commit bda3daf

Browse files
committed
BUG/MINOR: whitelist misconfigured if CM namespace not also whitelisted
1 parent 012b6b4 commit bda3daf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

controller/monitor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,14 @@ func (c *HAProxyController) getWhitelistedNamespaces() []string {
157157
if len(c.Store.NamespacesAccess.Whitelist) == 0 {
158158
return []string{""}
159159
}
160-
namespaces := make([]string, len(c.Store.NamespacesAccess.Whitelist))
160+
// Add one because of potential whitelisting of configmap namespace
161+
namespaces := make([]string, len(c.Store.NamespacesAccess.Whitelist)+1)
161162
for ns := range c.Store.NamespacesAccess.Whitelist {
162163
namespaces = append(namespaces, ns)
163164
}
164165
cfgMapNS := c.OSArgs.ConfigMap.Namespace
165166
if _, ok := c.Store.NamespacesAccess.Whitelist[cfgMapNS]; !ok {
166-
namespaces = []string{cfgMapNS}
167+
namespaces = append(namespaces, cfgMapNS)
167168
logger.Warningf("configmap Namespace '%s' not whitelisted. Whitelisting it anyway", cfgMapNS)
168169
}
169170
logger.Infof("Whitelisted Namespaces: %s", namespaces)

0 commit comments

Comments
 (0)