Merge pull request #3505 from Shopify/watch-pod-lua
Update lua configuration_data when number of controller pod change
This commit is contained in:
commit
ee3a8fe581
10 changed files with 113 additions and 19 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue