feature(geoip2_autoreload): Enable GeoIP2 auto_reload config (#11079)
* feature(geoip2_autoreload): GeoIP Autoreload feature(geoip2_autoreload): fix lint feature(geoip2_autoreload): changing flag interval feature(geoip2_autoreload): tests - up and running feature(geoip2_autoreload): tests - up and running feature(geoip2): testing feature(geoip2): remove typo feature(geoip2_autoreload): fixing tests * feature(geoip2_autoreload): working * feature(geoip2_autoreload): including tests on geoip2 test file
This commit is contained in:
parent
9d251d955e
commit
3c4e78e6b7
4 changed files with 84 additions and 0 deletions
|
|
@ -124,4 +124,52 @@ var _ = framework.DescribeSetting("Geoip2", func() {
|
|||
Expect().
|
||||
Status(http.StatusOK)
|
||||
})
|
||||
|
||||
ginkgo.It("should up and running nginx controller using autoreload flag", func() {
|
||||
edition := "GeoLite2-Country"
|
||||
|
||||
err := f.UpdateIngressControllerDeployment(func(deployment *appsv1.Deployment) error {
|
||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||
args = append(args, "--maxmind-edition-ids="+edition)
|
||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(context.TODO(), deployment, metav1.UpdateOptions{})
|
||||
return err
|
||||
})
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "updating ingress controller deployment flags")
|
||||
|
||||
filename := fmt.Sprintf("/etc/ingress-controller/geoip/%s.mmdb", edition)
|
||||
exec, err := f.ExecIngressPod(fmt.Sprintf(`sh -c "mkdir -p '%s' && wget -O '%s' '%s' 2>&1"`, filepath.Dir(filename), filename, testdataURL))
|
||||
framework.Logf(exec)
|
||||
assert.Nil(ginkgo.GinkgoT(), err, fmt.Sprintln("error downloading test geoip2 db", filename))
|
||||
|
||||
f.SetNginxConfigMapData(map[string]string{
|
||||
"use-geoip2": "true",
|
||||
"geoip2-autoreload-in-minutes": "5",
|
||||
})
|
||||
|
||||
// Check Configmap Autoreload Patterns
|
||||
f.WaitForNginxConfiguration(
|
||||
func(cfg string) bool {
|
||||
return strings.Contains(cfg, fmt.Sprintf("geoip2 %s", filename)) &&
|
||||
strings.Contains(cfg, "auto_reload 5m;")
|
||||
},
|
||||
)
|
||||
|
||||
// Check if Nginx could up, running and routing with auto_reload configs
|
||||
host := "ping.com"
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, host) &&
|
||||
strings.Contains(server, "location /")
|
||||
})
|
||||
|
||||
f.HTTPTestClient().
|
||||
GET("/").
|
||||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Status(http.StatusOK)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue