Update client-go methods to support context and and new create and delete options

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-03-24 10:44:13 -03:00
parent f4b17d345f
commit a46126a034
32 changed files with 167 additions and 132 deletions

View file

@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
config, err := f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Get("tcp-services", metav1.GetOptions{})
Get(context.TODO(), "tcp-services", metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error obtaining tcp-services configmap")
assert.NotNil(ginkgo.GinkgoT(), config, "expected a configmap but none returned")
@ -56,13 +56,13 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(config)
Update(context.TODO(), config, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error updating configmap")
svc, err := f.KubeClientSet.
CoreV1().
Services(f.Namespace).
Get("nginx-ingress-controller", metav1.GetOptions{})
Get(context.TODO(), "nginx-ingress-controller", metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error obtaining ingress-nginx service")
assert.NotNil(ginkgo.GinkgoT(), svc, "expected a service but none returned")
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
_, err = f.KubeClientSet.
CoreV1().
Services(f.Namespace).
Update(svc)
Update(context.TODO(), svc, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error updating service")
// wait for update and nginx reload and new endpoint is available
@ -126,7 +126,7 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
svc, err := f.KubeClientSet.
CoreV1().
Services(f.Namespace).
Get("nginx-ingress-controller", metav1.GetOptions{})
Get(context.TODO(), "nginx-ingress-controller", metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error obtaining ingress-nginx service")
assert.NotNil(ginkgo.GinkgoT(), svc, "expected a service but none returned")
@ -138,14 +138,14 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
_, err = f.KubeClientSet.
CoreV1().
Services(f.Namespace).
Update(svc)
Update(context.TODO(), svc, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error updating service")
// Update the TCP configmap to link port 5353 to the DNS external name service
config, err := f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Get("tcp-services", metav1.GetOptions{})
Get(context.TODO(), "tcp-services", metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error obtaining tcp-services configmap")
assert.NotNil(ginkgo.GinkgoT(), config, "expected a configmap but none returned")
@ -158,7 +158,7 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
_, err = f.KubeClientSet.
CoreV1().
ConfigMaps(f.Namespace).
Update(config)
Update(context.TODO(), config, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error updating configmap")
// Validate that the generated nginx config contains the expected `proxy_upstream_name` value