Merge pull request #3505 from Shopify/watch-pod-lua

Update lua configuration_data when number of controller pod change
This commit is contained in:
Kubernetes Prow Robot 2018-12-17 00:10:30 -08:00 committed by GitHub
commit ee3a8fe581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 113 additions and 19 deletions

View file

@ -28,6 +28,16 @@ import (
"k8s.io/api/core/v1"
)
// ExecIngressPod executes a command inside the first container in ingress controller running pod
func (f *Framework) ExecIngressPod(command string) (string, error) {
pod, err := getIngressNGINXPod(f.IngressController.Namespace, f.KubeClientSet)
if err != nil {
return "", err
}
return f.ExecCommand(pod, command)
}
// ExecCommand executes a command inside a the first container in a running pod
func (f *Framework) ExecCommand(pod *v1.Pod, command string) (string, error) {
var (

View file

@ -149,6 +149,20 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
})
Expect(nginxConfig).ShouldNot(Equal(newNginxConfig))
})
It("sets controllerPodsCount in Lua general configuration", func() {
output, err := f.ExecIngressPod("curl --fail --silent http://127.0.0.1:18080/configuration/general")
Expect(err).ToNot(HaveOccurred())
Expect(output).Should(Equal(`{"controllerPodsCount":1}`))
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 3, nil)
Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync)
output, err = f.ExecIngressPod("curl --fail --silent http://127.0.0.1:18080/configuration/general")
Expect(err).ToNot(HaveOccurred())
Expect(output).Should(Equal(`{"controllerPodsCount":3}`))
})
})
func ensureIngress(f *framework.Framework, host string) *extensions.Ingress {