tao12345666333 commented on code in PR #1238:
URL:
https://github.com/apache/apisix-ingress-controller/pull/1238#discussion_r956876806
##########
test/e2e/suite-ingress/suite-ingress-features/namespace.go:
##########
@@ -189,3 +269,130 @@ spec:
})
})
})
+
+var _ = ginkgo.Describe("suite-ingress-features: namespacing ub-label", func()
{
+ labelName, labelValue := fmt.Sprintf("namespace-selector-%d",
time.Now().Nanosecond()), "watch"
+ s := scaffold.NewScaffold(&scaffold.Options{
+ Name: "un-label",
+ IngressAPISIXReplicas: 1,
+ ApisixResourceVersion: scaffold.ApisixResourceVersion().Default,
+ NamespaceSelectorLabel: map[string]string{
+ labelName: labelValue,
+ },
+ DisableNamespaceLabel: true,
+ })
+ namespace1 := fmt.Sprintf("un-label-%d", time.Now().Nanosecond())
+
+ ginkgo.It("un-label", func() {
+ ns := fmt.Sprintf(`
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: %s
+ labels:
+ %s: %s
+`, namespace1, labelName, labelValue)
+ assert.Nil(ginkgo.GinkgoT(),
s.CreateResourceFromStringWithNamespace(ns, namespace1), "creating namespace")
+ //defer s.DeleteResourceFromStringWithNamespace(ns, namespace1)
+ _, err := s.NewHTTPBINWithNamespace(namespace1)
+ assert.Nil(ginkgo.GinkgoT(), err, "create httpbin service in",
namespace1)
+
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ route1 := fmt.Sprintf(`
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ name: httpbin-route
+spec:
+ ingressClassName: apisix
+ rules:
+ - host: httpbin.com
+ http:
+ paths:
+ - path: /ip
+ pathType: Exact
+ backend:
+ service:
+ name: %s
+ port:
+ number: %d
+`, backendSvc, backendSvcPort[0])
+ assert.Nil(ginkgo.GinkgoT(),
s.CreateResourceFromStringWithNamespace(route1, namespace1), "creating ingress")
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1))
+ time.Sleep(time.Second * 6)
+ _ = s.NewAPISIXClient().GET("/ip").WithHeader("Host",
"httpbin.com").Expect().Status(http.StatusOK).Body().Raw()
+
+ assert.Nil(ginkgo.GinkgoT(),
s.DeleteResourceFromStringWithNamespace(route1, namespace1), "deleting ingress")
+ ns = fmt.Sprintf(`
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: %s
+`, namespace1)
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ns),
"creating namespace")
+ assert.Nil(ginkgo.GinkgoT(), err, "create httpbin service in",
namespace1)
+ time.Sleep(6 * time.Second)
+ routes, err := s.ListApisixRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), routes, 0)
Review Comment:
Patch is simpler, just need to pass one of the following
```
{"metadata":{"labels":{"YOUR Label Name":null}}}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]