Skip to content

Commit

Permalink
Fix case where namespace is not watching secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
ciarams87 committed Nov 11, 2022
1 parent 8f3453f commit 07cc09f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
15 changes: 4 additions & 11 deletions examples/custom-resources/certmanager/cafe-virtual-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ spec:
secret: cafe-secret
cert-manager:
cluster-issuer: selfsigned-issuer
upstreams:
- name: tea
service: tea-svc
port: 80
- name: coffee
service: coffee-svc
port: 80
externalDNS:
enable: true
routes:
- path: /tea
action:
pass: tea
route: tea/tea
- path: /coffee
action:
pass: coffee
route: coffee/coffee
3 changes: 3 additions & 0 deletions internal/k8s/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,9 @@ func (lbc *LoadBalancerController) updateAllConfigs() {
// it will report warnings. (See https://github.com/nginxinc/kubernetes-ingress/issues/1448 )
func (lbc *LoadBalancerController) preSyncSecrets() {
for _, ni := range lbc.namespacedInformers {
if !ni.isSecretsEnabledNamespace {
break
}
objects := ni.secretLister.List()
glog.V(3).Infof("PreSync %d Secrets", len(objects))

Expand Down
2 changes: 1 addition & 1 deletion internal/k8s/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ func TestPreSyncSecrets(t *testing.T) {
},
}
nsi := make(map[string]*namespacedInformer)
nsi[""] = &namespacedInformer{secretLister: secretLister}
nsi[""] = &namespacedInformer{secretLister: secretLister, isSecretsEnabledNamespace: true}

lbc := LoadBalancerController{
isNginxPlus: true,
Expand Down

0 comments on commit 07cc09f

Please sign in to comment.