From 00618a60c3419348411df4ba805a9827e3e8520a Mon Sep 17 00:00:00 2001 From: Lorcan McVeigh Date: Fri, 7 Aug 2020 11:47:35 +0100 Subject: [PATCH] Implement ingress changes --- deployments/helm-chart/templates/rbac.yaml | 4 +- deployments/rbac/rbac.yaml | 4 +- ...advanced-configuration-with-annotations.md | 2 +- .../advanced-configuration-with-snippets.md | 2 +- .../ingress-resources/basic-configuration.md | 28 ++- .../ingress-resources/custom-annotations.md | 2 +- examples/appprotect/cafe-ingress.yaml | 2 +- examples/complete-example/cafe-ingress.yaml | 2 +- examples/custom-annotations/README.md | 2 +- examples/externalname-services/README.md | 2 +- examples/grpc-services/README.md | 2 +- examples/health-checks/README.md | 2 +- examples/jwt/README.md | 8 +- .../mergeable-ingress-types/cafe-master.yaml | 2 +- .../coffee-minion.yaml | 2 +- .../mergeable-ingress-types/tea-minion.yaml | 2 +- examples/rewrites/README.md | 2 +- examples/session-persistence/README.md | 2 +- ...cafe-ingress-with-session-persistence.yaml | 2 +- examples/ssl-services/README.md | 2 +- examples/websocket/README.md | 2 +- examples/wildcard-tls-certificate/README.md | 4 +- internal/configs/configurator.go | 6 +- internal/configs/ingress.go | 30 ++- internal/configs/ingress_test.go | 40 +++- internal/configs/parsing_helpers_test.go | 2 +- internal/k8s/controller.go | 82 ++++---- internal/k8s/controller_test.go | 176 +++++++++--------- internal/k8s/handlers.go | 2 +- internal/k8s/status.go | 8 +- internal/k8s/status_test.go | 24 +-- internal/k8s/task_queue.go | 2 +- internal/k8s/utils.go | 2 +- 33 files changed, 265 insertions(+), 191 deletions(-) diff --git a/deployments/helm-chart/templates/rbac.yaml b/deployments/helm-chart/templates/rbac.yaml index a2bf535ffb..9e8cdf8433 100644 --- a/deployments/helm-chart/templates/rbac.yaml +++ b/deployments/helm-chart/templates/rbac.yaml @@ -62,7 +62,7 @@ rules: - patch - list - apiGroups: - - extensions + - networking.k8s.io resources: - ingresses verbs: @@ -71,7 +71,7 @@ rules: - watch {{- if .Values.controller.reportIngressStatus.enable }} - apiGroups: - - extensions + - networking.k8s.io resources: - ingresses/status verbs: diff --git a/deployments/rbac/rbac.yaml b/deployments/rbac/rbac.yaml index 05ec9ef1e3..e22f70efcc 100644 --- a/deployments/rbac/rbac.yaml +++ b/deployments/rbac/rbac.yaml @@ -46,7 +46,7 @@ rules: - patch - list - apiGroups: - - extensions + - networking.k8s.io resources: - ingresses verbs: @@ -54,7 +54,7 @@ rules: - watch - get - apiGroups: - - "extensions" + - networking.k8s.io resources: - ingresses/status verbs: diff --git a/docs-web/configuration/ingress-resources/advanced-configuration-with-annotations.md b/docs-web/configuration/ingress-resources/advanced-configuration-with-annotations.md index 81f8f0053d..594bc94adb 100644 --- a/docs-web/configuration/ingress-resources/advanced-configuration-with-annotations.md +++ b/docs-web/configuration/ingress-resources/advanced-configuration-with-annotations.md @@ -12,7 +12,7 @@ Customization and fine-tuning is also available through the [ConfigMap](/nginx-i Here is an example of using annotations to customize the configuration for a particular Ingress resource: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-with-annotations diff --git a/docs-web/configuration/ingress-resources/advanced-configuration-with-snippets.md b/docs-web/configuration/ingress-resources/advanced-configuration-with-snippets.md index 487b28fdfe..bc03114b82 100644 --- a/docs-web/configuration/ingress-resources/advanced-configuration-with-snippets.md +++ b/docs-web/configuration/ingress-resources/advanced-configuration-with-snippets.md @@ -8,7 +8,7 @@ Snippets are also available through the [ConfigMap](/nginx-ingress-controller/co The example below shows how to use snippets to customize the NGINX configuration template using annotations. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-with-snippets diff --git a/docs-web/configuration/ingress-resources/basic-configuration.md b/docs-web/configuration/ingress-resources/basic-configuration.md index 0200160d6f..6427430afd 100644 --- a/docs-web/configuration/ingress-resources/basic-configuration.md +++ b/docs-web/configuration/ingress-resources/basic-configuration.md @@ -2,7 +2,7 @@ The example below shows a basic Ingress resource definition. It load balances requests for two services -- coffee and tea -- comprising a hypothetical *cafe* app hosted at `cafe.example.com`: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress @@ -32,7 +32,7 @@ Here is a breakdown of what this Ingress resource definition means: * In the `hosts` field, we apply the certificate and key to our `cafe.example.com` host. * In the `spec.rules` field, we define a host with domain name `cafe.example.com`. * In the `paths` field, we define two path‑based rules: - * The rule with the path `/tea` instructs NGINX to distribute the requests with the `/tea` URI among the pods of the *tea* service, which is deployed with the name `tea‑svc` in the cluster. + * The rule with the path `/tea` instructs NGINX to distribute the requests with the `/tea` URI among the pods of the *tea* service, which is deployed with the name `tea‑svc` in the cluster. * The rule with the path `/coffee` instructs NGINX to distribute the requests with the `/coffee` URI among the pods of the *coffee* service, which is deployed with the name `coffee‑svc` in the cluster. * Both rules instruct NGINX to distribute the requests to `port 80` of the corresponding service (the `servicePort` field). @@ -40,6 +40,30 @@ Here is a breakdown of what this Ingress resource definition means: > To learn more about the Ingress resource, see the [Ingress resource documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/) in the Kubernetes docs. +## New Features Available in Kubernetes 1.18 and Above + +Starting from Kubernetes 1.18, you can use the following new features: + +* The host field supports wildcard domain names, such as `*.example.com`. +* The path supports different matching rules with the new field `PathType`, which takes the following values: `Prefix` for prefix-based matching, `Exact` for exact matching and `ImplementationSpecific`, which is the default type and is the same as `Prefix`. For example: + ```yaml + - path: /tea + pathType: Prefix + backend: + serviceName: tea-svc + servicePort: 80 + - path: /tea/green + pathType: Exact + backend: + serviceName: tea-svc + servicePort: 80 + - path: /coffee + pathType: ImplementationSpecific # default + backend: + serviceName: coffee-svc + servicePort: 80 + ``` + ## Restrictions The NGINX Ingress Controller imposes the following restrictions on Ingress resources: diff --git a/docs-web/configuration/ingress-resources/custom-annotations.md b/docs-web/configuration/ingress-resources/custom-annotations.md index 334f805d98..480283429c 100644 --- a/docs-web/configuration/ingress-resources/custom-annotations.md +++ b/docs-web/configuration/ingress-resources/custom-annotations.md @@ -33,7 +33,7 @@ Consider the following excerpt from the template, which was extended to support Consider the following Ingress resource and note how we set two annotations: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: example-ingress diff --git a/examples/appprotect/cafe-ingress.yaml b/examples/appprotect/cafe-ingress.yaml index befdc45f8d..6391a60496 100644 --- a/examples/appprotect/cafe-ingress.yaml +++ b/examples/appprotect/cafe-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/complete-example/cafe-ingress.yaml b/examples/complete-example/cafe-ingress.yaml index 5e96e5d9f4..89e955bf94 100644 --- a/examples/complete-example/cafe-ingress.yaml +++ b/examples/complete-example/cafe-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/custom-annotations/README.md b/examples/custom-annotations/README.md index d755b0753c..04ceb86263 100644 --- a/examples/custom-annotations/README.md +++ b/examples/custom-annotations/README.md @@ -81,7 +81,7 @@ Customize the template for Ingress resources to include the logic to handle and 1. Create a file with the following Ingress resource (`cafe-ingress.yaml`) and use the custom annotations to enable rate-limiting: ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/externalname-services/README.md b/examples/externalname-services/README.md index 390d2ca8ab..a2a3e2faf2 100644 --- a/examples/externalname-services/README.md +++ b/examples/externalname-services/README.md @@ -40,7 +40,7 @@ spec: In the following Ingress resource we use my-service: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: example-ingress diff --git a/examples/grpc-services/README.md b/examples/grpc-services/README.md index b3fbd9bb2a..c6ff28fcfa 100644 --- a/examples/grpc-services/README.md +++ b/examples/grpc-services/README.md @@ -18,7 +18,7 @@ nginx.org/grpc-services: "service1[,service2,...]" In the following example we load balance three applications, one of which is using gRPC: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: grpc-ingress diff --git a/examples/health-checks/README.md b/examples/health-checks/README.md index eeede51cd9..877b3554bd 100644 --- a/examples/health-checks/README.md +++ b/examples/health-checks/README.md @@ -15,7 +15,7 @@ The Ingress controller provides the following annotations for configuring active In the following example we enable active health checks in the cafe-ingress Ingress: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/jwt/README.md b/examples/jwt/README.md index 3bcfe221d3..27c60d9921 100644 --- a/examples/jwt/README.md +++ b/examples/jwt/README.md @@ -13,7 +13,7 @@ The Ingress controller provides the following 4 annotations for configuring JWT In the following example we enable JWT validation for the cafe-ingress Ingress for all paths using the same key `cafe-jwk`: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress @@ -51,7 +51,7 @@ In the following example we enable JWT validation for the [mergeable Ingresses]( * Master: ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-master @@ -69,7 +69,7 @@ In the following example we enable JWT validation for the [mergeable Ingresses]( * Tea minion: ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-tea-minion @@ -93,7 +93,7 @@ In the following example we enable JWT validation for the [mergeable Ingresses]( * Coffee minion: ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-coffee-minion diff --git a/examples/mergeable-ingress-types/cafe-master.yaml b/examples/mergeable-ingress-types/cafe-master.yaml index 17df22acae..fb1bb66988 100644 --- a/examples/mergeable-ingress-types/cafe-master.yaml +++ b/examples/mergeable-ingress-types/cafe-master.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-master diff --git a/examples/mergeable-ingress-types/coffee-minion.yaml b/examples/mergeable-ingress-types/coffee-minion.yaml index 87e8efdb4b..2acfd9b0a2 100644 --- a/examples/mergeable-ingress-types/coffee-minion.yaml +++ b/examples/mergeable-ingress-types/coffee-minion.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-coffee-minion diff --git a/examples/mergeable-ingress-types/tea-minion.yaml b/examples/mergeable-ingress-types/tea-minion.yaml index 1aecb80afb..45dd037f8b 100644 --- a/examples/mergeable-ingress-types/tea-minion.yaml +++ b/examples/mergeable-ingress-types/tea-minion.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-tea-minion diff --git a/examples/rewrites/README.md b/examples/rewrites/README.md index 46fc238cd9..760888ec03 100644 --- a/examples/rewrites/README.md +++ b/examples/rewrites/README.md @@ -13,7 +13,7 @@ nginx.org/rewrites: "serviceName=service1 rewrite=rewrite1[;serviceName=service2 In the following example we load balance two applications that require URI rewriting: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/session-persistence/README.md b/examples/session-persistence/README.md index bc8dbde826..7e1873b129 100644 --- a/examples/session-persistence/README.md +++ b/examples/session-persistence/README.md @@ -20,7 +20,7 @@ The syntax of the *cookieName*, *expires*, *domain*, *httponly*, *secure* and *p In the following example we enable session persistence for two services -- the *tea-svc* service and the *coffee-svc* service: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-with-session-persistence diff --git a/examples/session-persistence/cafe-ingress-with-session-persistence.yaml b/examples/session-persistence/cafe-ingress-with-session-persistence.yaml index a394687c9e..6c5121ddad 100644 --- a/examples/session-persistence/cafe-ingress-with-session-persistence.yaml +++ b/examples/session-persistence/cafe-ingress-with-session-persistence.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress-with-session-persistence diff --git a/examples/ssl-services/README.md b/examples/ssl-services/README.md index 88683bc555..09f42de3bc 100644 --- a/examples/ssl-services/README.md +++ b/examples/ssl-services/README.md @@ -8,7 +8,7 @@ nginx.org/ssl-services: "service1[,service2,...]" In the following example we load balance three applications, one of which requires HTTPS: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/websocket/README.md b/examples/websocket/README.md index 337f568880..1f3db6cc6a 100644 --- a/examples/websocket/README.md +++ b/examples/websocket/README.md @@ -7,7 +7,7 @@ nginx.org/websocket-services: "service1[,service2,...]" In the following example we load balance three applications, one of which is using WebSocket: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: cafe-ingress diff --git a/examples/wildcard-tls-certificate/README.md b/examples/wildcard-tls-certificate/README.md index 17ae5e328a..56baecfb09 100644 --- a/examples/wildcard-tls-certificate/README.md +++ b/examples/wildcard-tls-certificate/README.md @@ -21,7 +21,7 @@ In the example below we configure TLS termination for two Ingress resources for `foo-ingress` from the namespace `foo-namespace`: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: foo-ingress @@ -45,7 +45,7 @@ spec: `bar-ingress` from the namespace `bar-namespace`: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: bar-ingress diff --git a/internal/configs/configurator.go b/internal/configs/configurator.go index 79b8653b1e..4998e9083b 100644 --- a/internal/configs/configurator.go +++ b/internal/configs/configurator.go @@ -19,7 +19,7 @@ import ( "github.com/golang/glog" api_v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/nginxinc/kubernetes-ingress/internal/configs/version1" @@ -1019,14 +1019,14 @@ func getFileNameForTransportServerFromKey(key string) string { } // HasIngress checks if the Ingress resource is present in NGINX configuration. -func (cnf *Configurator) HasIngress(ing *extensions.Ingress) bool { +func (cnf *Configurator) HasIngress(ing *networking.Ingress) bool { name := objectMetaToFileName(&ing.ObjectMeta) _, exists := cnf.ingresses[name] return exists } // HasMinion checks if the minion Ingress resource of the master is present in NGINX configuration. -func (cnf *Configurator) HasMinion(master *extensions.Ingress, minion *extensions.Ingress) bool { +func (cnf *Configurator) HasMinion(master *networking.Ingress, minion *networking.Ingress) bool { masterName := objectMetaToFileName(&master.ObjectMeta) if _, exists := cnf.minions[masterName]; !exists { diff --git a/internal/configs/ingress.go b/internal/configs/ingress.go index a308ec890e..98055f6bc1 100644 --- a/internal/configs/ingress.go +++ b/internal/configs/ingress.go @@ -7,7 +7,7 @@ import ( "github.com/golang/glog" api_v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -20,7 +20,7 @@ const appProtectLogConfKey = "logconf" // IngressEx holds an Ingress along with the resources that are referenced in this Ingress. type IngressEx struct { - Ingress *extensions.Ingress + Ingress *networking.Ingress TLSSecrets map[string]*api_v1.Secret JWTKey JWTKey Endpoints map[string][]string @@ -184,7 +184,7 @@ func generateNginxCfg(ingEx *IngressEx, pems map[string]string, apResources map[ ssl := isSSLEnabled(sslServices[path.Backend.ServiceName], cfgParams, staticParams) proxySSLName := generateProxySSLName(path.Backend.ServiceName, ingEx.Ingress.Namespace) loc := createLocation(pathOrDefault(path.Path), upstreams[upsName], &cfgParams, wsServices[path.Backend.ServiceName], rewrites[path.Backend.ServiceName], - ssl, grpcServices[path.Backend.ServiceName], proxySSLName) + ssl, grpcServices[path.Backend.ServiceName], proxySSLName, path.PathType) if isMinion && ingEx.JWTKey.Name != "" { loc.JWTAuth = &version1.JWTAuth{ Key: jwtKeyFileName, @@ -211,9 +211,10 @@ func generateNginxCfg(ingEx *IngressEx, pems map[string]string, apResources map[ upsName := getNameForUpstream(ingEx.Ingress, emptyHost, ingEx.Ingress.Spec.Backend) ssl := isSSLEnabled(sslServices[ingEx.Ingress.Spec.Backend.ServiceName], cfgParams, staticParams) proxySSLName := generateProxySSLName(ingEx.Ingress.Spec.Backend.ServiceName, ingEx.Ingress.Namespace) + pathtype := networking.PathTypePrefix loc := createLocation(pathOrDefault("/"), upstreams[upsName], &cfgParams, wsServices[ingEx.Ingress.Spec.Backend.ServiceName], rewrites[ingEx.Ingress.Spec.Backend.ServiceName], - ssl, grpcServices[ingEx.Ingress.Spec.Backend.ServiceName], proxySSLName) + ssl, grpcServices[ingEx.Ingress.Spec.Backend.ServiceName], proxySSLName, &pathtype) locations = append(locations, loc) if cfgParams.HealthCheckEnabled { @@ -252,9 +253,20 @@ func generateNginxCfg(ingEx *IngressEx, pems map[string]string, apResources map[ } } -func createLocation(path string, upstream version1.Upstream, cfg *ConfigParams, websocket bool, rewrite string, ssl bool, grpc bool, proxySSLName string) version1.Location { +func generateIngressPath(path string, pathType *networking.PathType) string { + if pathType == nil { + return path + } + if *pathType == networking.PathTypeExact { + path = "= " + path + } + + return path +} + +func createLocation(path string, upstream version1.Upstream, cfg *ConfigParams, websocket bool, rewrite string, ssl bool, grpc bool, proxySSLName string, pathType *networking.PathType) version1.Location { loc := version1.Location{ - Path: path, + Path: generateIngressPath(path, pathType), Upstream: upstream, ProxyConnectTimeout: cfg.ProxyConnectTimeout, ProxyReadTimeout: cfg.ProxyReadTimeout, @@ -287,7 +299,7 @@ func upstreamRequiresQueue(name string, ingEx *IngressEx, cfg *ConfigParams) (n return 0, 0 } -func createUpstream(ingEx *IngressEx, name string, backend *extensions.IngressBackend, stickyCookie string, cfg *ConfigParams, +func createUpstream(ingEx *IngressEx, name string, backend *networking.IngressBackend, stickyCookie string, cfg *ConfigParams, isPlus bool, isResolverConfigured bool) version1.Upstream { var ups version1.Upstream @@ -365,11 +377,11 @@ func pathOrDefault(path string) string { return path } -func getNameForUpstream(ing *extensions.Ingress, host string, backend *extensions.IngressBackend) string { +func getNameForUpstream(ing *networking.Ingress, host string, backend *networking.IngressBackend) string { return fmt.Sprintf("%v-%v-%v-%v-%v", ing.Namespace, ing.Name, host, backend.ServiceName, backend.ServicePort.String()) } -func getNameForRedirectLocation(ing *extensions.Ingress) string { +func getNameForRedirectLocation(ing *networking.Ingress) string { return fmt.Sprintf("@login_url_%v-%v", ing.Namespace, ing.Name) } diff --git a/internal/configs/ingress_test.go b/internal/configs/ingress_test.go index 6554e53bca..5e2eeef397 100644 --- a/internal/configs/ingress_test.go +++ b/internal/configs/ingress_test.go @@ -6,7 +6,7 @@ import ( "testing" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -127,6 +127,44 @@ func TestPathOrDefaultReturnActual(t *testing.T) { } } +func TestGenerateIngressPath(t *testing.T) { + exact := v1beta1.PathTypeExact + prefix := v1beta1.PathTypePrefix + impSpec := v1beta1.PathTypeImplementationSpecific + tests := []struct { + pathType *v1beta1.PathType + path string + expected string + }{ + { + pathType: &exact, + path: "/path/to/resource", + expected: "= /path/to/resource", + }, + { + pathType: &prefix, + path: "/path/to/resource", + expected: "/path/to/resource", + }, + { + pathType: &impSpec, + path: "/path/to/resource", + expected: "/path/to/resource", + }, + { + pathType: nil, + path: "/path/to/resource", + expected: "/path/to/resource", + }, + } + for _, test := range tests { + result := generateIngressPath(test.path, test.pathType) + if result != test.expected { + t.Errorf("generateIngressPath(%v, %v) returned %v, but expected %v", test.path, test.pathType, result, test.expected) + } + } +} + func createExpectedConfigForCafeIngressEx() version1.IngressNginxConfig { coffeeUpstream := version1.Upstream{ Name: "default-cafe-ingress-cafe.example.com-coffee-svc-80", diff --git a/internal/configs/parsing_helpers_test.go b/internal/configs/parsing_helpers_test.go index 14dedec908..94846f47bf 100644 --- a/internal/configs/parsing_helpers_test.go +++ b/internal/configs/parsing_helpers_test.go @@ -5,7 +5,7 @@ import ( "testing" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/internal/k8s/controller.go b/internal/k8s/controller.go index 03960932d5..157cbae425 100644 --- a/internal/k8s/controller.go +++ b/internal/k8s/controller.go @@ -27,7 +27,7 @@ import ( "github.com/golang/glog" "github.com/spiffe/go-spiffe/workload" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/intstr" @@ -44,7 +44,7 @@ import ( "sort" api_v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" @@ -343,11 +343,11 @@ func (lbc *LoadBalancerController) addServiceHandler(handlers cache.ResourceEven func (lbc *LoadBalancerController) addIngressHandler(handlers cache.ResourceEventHandlerFuncs) { lbc.ingressLister.Store, lbc.ingressController = cache.NewInformer( cache.NewListWatchFromClient( - lbc.client.ExtensionsV1beta1().RESTClient(), + lbc.client.NetworkingV1beta1().RESTClient(), "ingresses", lbc.namespace, fields.Everything()), - &extensions.Ingress{}, + &networking.Ingress{}, lbc.resync, handlers, ) @@ -730,9 +730,9 @@ func (lbc *LoadBalancerController) syncConfig(task task) { } // GetManagedIngresses gets Ingress resources that the IC is currently responsible for -func (lbc *LoadBalancerController) GetManagedIngresses() ([]extensions.Ingress, map[string]*configs.MergeableIngresses) { +func (lbc *LoadBalancerController) GetManagedIngresses() ([]networking.Ingress, map[string]*configs.MergeableIngresses) { mergeableIngresses := make(map[string]*configs.MergeableIngresses) - var managedIngresses []extensions.Ingress + var managedIngresses []networking.Ingress ings, _ := lbc.ingressLister.List() for i := range ings.Items { ing := ings.Items[i] @@ -766,7 +766,7 @@ func (lbc *LoadBalancerController) GetManagedIngresses() ([]extensions.Ingress, return managedIngresses, mergeableIngresses } -func (lbc *LoadBalancerController) ingressesToIngressExes(ings []extensions.Ingress) []*configs.IngressEx { +func (lbc *LoadBalancerController) ingressesToIngressExes(ings []networking.Ingress) []*configs.IngressEx { var ingExes []*configs.IngressEx for i := range ings { ingEx, err := lbc.createIngress(&ings[i]) @@ -1305,7 +1305,7 @@ func (lbc *LoadBalancerController) syncIngMinion(task task) { } glog.V(2).Infof("Adding or Updating Minion: %v\n", key) - minion := obj.(*extensions.Ingress) + minion := obj.(*networking.Ingress) master, err := lbc.FindMasterForMinion(minion) if err != nil { @@ -1536,7 +1536,7 @@ func (lbc *LoadBalancerController) isSpecialSecret(secretName string) bool { return secretName == lbc.defaultServerSecret || secretName == lbc.wildcardTLSSecret } -func (lbc *LoadBalancerController) handleRegularSecretDeletion(key string, ings []extensions.Ingress, virtualServers []*conf_v1.VirtualServer) { +func (lbc *LoadBalancerController) handleRegularSecretDeletion(key string, ings []networking.Ingress, virtualServers []*conf_v1.VirtualServer) { eventType := api_v1.EventTypeWarning title := "Missing Secret" message := fmt.Sprintf("Secret %v was removed", key) @@ -1568,7 +1568,7 @@ func (lbc *LoadBalancerController) handleRegularSecretDeletion(key string, ings lbc.updateStatusForVirtualServers(state, title, message, virtualServers) } -func (lbc *LoadBalancerController) handleSecretUpdate(secret *api_v1.Secret, ings []extensions.Ingress, virtualServers []*conf_v1.VirtualServer) { +func (lbc *LoadBalancerController) handleSecretUpdate(secret *api_v1.Secret, ings []networking.Ingress, virtualServers []*conf_v1.VirtualServer) { secretNsName := secret.Namespace + "/" + secret.Name err := lbc.ValidateSecret(secret) @@ -1642,7 +1642,7 @@ func (lbc *LoadBalancerController) handleSpecialSecretUpdate(secret *api_v1.Secr lbc.recorder.Eventf(secret, api_v1.EventTypeNormal, "Updated", "the special Secret %v was updated", secretNsName) } -func (lbc *LoadBalancerController) emitEventForIngresses(eventType string, title string, message string, ings []extensions.Ingress) { +func (lbc *LoadBalancerController) emitEventForIngresses(eventType string, title string, message string, ings []networking.Ingress) { for _, ing := range ings { lbc.recorder.Eventf(&ing, eventType, title, message) if isMinion(&ing) { @@ -1769,7 +1769,7 @@ func (lbc *LoadBalancerController) updateStatusForVirtualServers(state string, r } } -func (lbc *LoadBalancerController) createIngresses(ings []extensions.Ingress) (regular []configs.IngressEx, mergeable []configs.MergeableIngresses) { +func (lbc *LoadBalancerController) createIngresses(ings []networking.Ingress) (regular []configs.IngressEx, mergeable []configs.MergeableIngresses) { for i := range ings { if isMaster(&ings[i]) { mergeableIng, err := lbc.createMergableIngresses(&ings[i]) @@ -1807,7 +1807,7 @@ func (lbc *LoadBalancerController) createIngresses(ings []extensions.Ingress) (r return regular, mergeable } -func (lbc *LoadBalancerController) findIngressesForSecret(secretNamespace string, secretName string) (ings []extensions.Ingress, error error) { +func (lbc *LoadBalancerController) findIngressesForSecret(secretNamespace string, secretName string) (ings []networking.Ingress, error error) { allIngs, err := lbc.ingressLister.List() if err != nil { return nil, fmt.Errorf("Couldn't get the list of Ingress resources: %v", err) @@ -1906,7 +1906,7 @@ func (lbc *LoadBalancerController) EnqueueTransportServerForService(service *api } } -func (lbc *LoadBalancerController) getIngressesForService(svc *api_v1.Service) []extensions.Ingress { +func (lbc *LoadBalancerController) getIngressesForService(svc *api_v1.Service) []networking.Ingress { ings, err := lbc.ingressLister.GetServiceIngress(svc) if err != nil { glog.V(3).Infof("For service %v: %v", svc.Name, err) @@ -1915,8 +1915,8 @@ func (lbc *LoadBalancerController) getIngressesForService(svc *api_v1.Service) [ return ings } -func (lbc *LoadBalancerController) getIngressForEndpoints(obj interface{}) []extensions.Ingress { - var ings []extensions.Ingress +func (lbc *LoadBalancerController) getIngressForEndpoints(obj interface{}) []networking.Ingress { + var ings []networking.Ingress endp := obj.(*api_v1.Endpoints) svcKey := endp.GetNamespace() + "/" + endp.GetName() svcObj, svcExists, err := lbc.svcLister.GetByKey(svcKey) @@ -2279,7 +2279,7 @@ func (lbc *LoadBalancerController) getAndValidateSecret(secretKey string) (*api_ return secret, nil } -func (lbc *LoadBalancerController) createIngress(ing *extensions.Ingress) (*configs.IngressEx, error) { +func (lbc *LoadBalancerController) createIngress(ing *networking.Ingress) (*configs.IngressEx, error) { ingEx := &configs.IngressEx{ Ingress: ing, } @@ -2418,7 +2418,7 @@ func (lbc *LoadBalancerController) createIngress(ing *extensions.Ingress) (*conf return ingEx, nil } -func (lbc *LoadBalancerController) getAppProtectLogConfAndDst(ing *extensions.Ingress) (logConf *unstructured.Unstructured, logDst string, err error) { +func (lbc *LoadBalancerController) getAppProtectLogConfAndDst(ing *networking.Ingress) (logConf *unstructured.Unstructured, logDst string, err error) { logConfNsN := ParseResourceReferenceAnnotation(ing.Namespace, ing.Annotations[configs.AppProtectLogConfAnnotation]) if _, exists := ing.Annotations[configs.AppProtectLogConfDstAnnotation]; !exists { @@ -2451,7 +2451,7 @@ func (lbc *LoadBalancerController) getAppProtectLogConfAndDst(ing *extensions.In return logConf, logDst, nil } -func (lbc *LoadBalancerController) getAppProtectPolicy(ing *extensions.Ingress) (apPolicy *unstructured.Unstructured, err error) { +func (lbc *LoadBalancerController) getAppProtectPolicy(ing *networking.Ingress) (apPolicy *unstructured.Unstructured, err error) { polNsN := ParseResourceReferenceAnnotation(ing.Namespace, ing.Annotations[configs.AppProtectPolicyAnnotation]) apPolicyObj, exists, err := lbc.appProtectPolicyLister.GetByKey(polNsN) @@ -2707,7 +2707,7 @@ func (lbc *LoadBalancerController) getEndpointsForUpstream(namespace string, ups return nil, false, fmt.Errorf("Error getting service %v: %v", upstreamService, err) } - backend := &extensions.IngressBackend{ + backend := &networking.IngressBackend{ ServiceName: upstreamService, ServicePort: intstr.FromInt(int(upstreamPort)), } @@ -2785,7 +2785,7 @@ func getEndpointsBySubselectedPods(targetPort int32, pods []*api_v1.Pod, svcEps return endps } -func (lbc *LoadBalancerController) getHealthChecksForIngressBackend(backend *extensions.IngressBackend, namespace string) *api_v1.Probe { +func (lbc *LoadBalancerController) getHealthChecksForIngressBackend(backend *networking.IngressBackend, namespace string) *api_v1.Probe { svc, err := lbc.getServiceForIngressBackend(backend, namespace) if err != nil { glog.V(3).Infof("Error getting service %v: %v", backend.ServiceName, err) @@ -2834,13 +2834,13 @@ func compareContainerPortAndServicePort(containerPort api_v1.ContainerPort, svcP return false } -func (lbc *LoadBalancerController) getExternalEndpointsForIngressBackend(backend *extensions.IngressBackend, svc *api_v1.Service) []string { +func (lbc *LoadBalancerController) getExternalEndpointsForIngressBackend(backend *networking.IngressBackend, svc *api_v1.Service) []string { endpoint := fmt.Sprintf("%s:%d", svc.Spec.ExternalName, int32(backend.ServicePort.IntValue())) endpoints := []string{endpoint} return endpoints } -func (lbc *LoadBalancerController) getEndpointsForIngressBackend(backend *extensions.IngressBackend, svc *api_v1.Service) (result []string, isExternal bool, err error) { +func (lbc *LoadBalancerController) getEndpointsForIngressBackend(backend *networking.IngressBackend, svc *api_v1.Service) (result []string, isExternal bool, err error) { endps, err := lbc.endpointLister.GetServiceEndpoints(svc) if err != nil { if svc.Spec.Type == api_v1.ServiceTypeExternalName { @@ -2934,14 +2934,14 @@ func (lbc *LoadBalancerController) getTargetPort(svcPort *api_v1.ServicePort, sv } func (lbc *LoadBalancerController) getServiceForUpstream(namespace string, upstreamService string, upstreamPort uint16) (*api_v1.Service, error) { - backend := &extensions.IngressBackend{ + backend := &networking.IngressBackend{ ServiceName: upstreamService, ServicePort: intstr.FromInt(int(upstreamPort)), } return lbc.getServiceForIngressBackend(backend, namespace) } -func (lbc *LoadBalancerController) getServiceForIngressBackend(backend *extensions.IngressBackend, namespace string) (*api_v1.Service, error) { +func (lbc *LoadBalancerController) getServiceForIngressBackend(backend *networking.IngressBackend, namespace string) (*api_v1.Service, error) { svcKey := namespace + "/" + backend.ServiceName svcObj, svcExists, err := lbc.svcLister.GetByKey(svcKey) if err != nil { @@ -2965,8 +2965,8 @@ func (lbc *LoadBalancerController) HasCorrectIngressClass(obj interface{}) bool case *conf_v1.VirtualServerRoute: vsr := obj.(*conf_v1.VirtualServerRoute) class = vsr.Spec.IngressClass - case *extensions.Ingress: - ing := obj.(*extensions.Ingress) + case *networking.Ingress: + ing := obj.(*networking.Ingress) class = ing.Annotations[ingressClassKey] default: return false @@ -2979,7 +2979,7 @@ func (lbc *LoadBalancerController) HasCorrectIngressClass(obj interface{}) bool } // isHealthCheckEnabled checks if health checks are enabled so we can only query pods if enabled. -func (lbc *LoadBalancerController) isHealthCheckEnabled(ing *extensions.Ingress) bool { +func (lbc *LoadBalancerController) isHealthCheckEnabled(ing *networking.Ingress) bool { if healthCheckEnabled, exists, err := configs.GetMapKeyAsBool(ing.Annotations, "nginx.com/health-checks", ing); exists { if err != nil { glog.Error(err) @@ -3019,7 +3019,7 @@ func (lbc *LoadBalancerController) getMinionsForMaster(master *configs.IngressEx }) var minions []*configs.IngressEx - var minionPaths = make(map[string]*extensions.Ingress) + var minionPaths = make(map[string]*networking.Ingress) for i := range ings.Items { if !lbc.HasCorrectIngressClass(&ings.Items[i]) { @@ -3040,7 +3040,7 @@ func (lbc *LoadBalancerController) getMinionsForMaster(master *configs.IngressEx continue } - uniquePaths := []extensions.HTTPIngressPath{} + uniquePaths := []networking.HTTPIngressPath{} for _, path := range ings.Items[i].Spec.Rules[0].HTTP.Paths { if val, ok := minionPaths[path.Path]; ok { glog.Errorf("Ingress Resource %v/%v with the 'nginx.org/mergeable-ingress-type' annotation set to 'minion' cannot contain the same path as another ingress resource, %v/%v.", @@ -3069,10 +3069,10 @@ func (lbc *LoadBalancerController) getMinionsForMaster(master *configs.IngressEx } // FindMasterForMinion returns a master for a given minion -func (lbc *LoadBalancerController) FindMasterForMinion(minion *extensions.Ingress) (*extensions.Ingress, error) { +func (lbc *LoadBalancerController) FindMasterForMinion(minion *networking.Ingress) (*networking.Ingress, error) { ings, err := lbc.ingressLister.List() if err != nil { - return &extensions.Ingress{}, err + return &networking.Ingress{}, err } for i := range ings.Items { @@ -3095,7 +3095,7 @@ func (lbc *LoadBalancerController) FindMasterForMinion(minion *extensions.Ingres return nil, err } -func (lbc *LoadBalancerController) createMergableIngresses(master *extensions.Ingress) (*configs.MergeableIngresses, error) { +func (lbc *LoadBalancerController) createMergableIngresses(master *networking.Ingress) (*configs.MergeableIngresses, error) { mergeableIngresses := configs.MergeableIngresses{} if len(master.Spec.Rules) != 1 { @@ -3103,7 +3103,7 @@ func (lbc *LoadBalancerController) createMergableIngresses(master *extensions.In return &mergeableIngresses, err } - var empty extensions.HTTPIngressRuleValue + var empty networking.HTTPIngressRuleValue if master.Spec.Rules[0].HTTP != nil { if master.Spec.Rules[0].HTTP != &empty { if len(master.Spec.Rules[0].HTTP.Paths) != 0 { @@ -3114,8 +3114,8 @@ func (lbc *LoadBalancerController) createMergableIngresses(master *extensions.In } // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - master.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + master.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } masterIngEx, err := lbc.createIngress(master) @@ -3196,7 +3196,7 @@ func (lbc *LoadBalancerController) syncAppProtectPolicy(task task) { lbc.recorder.Eventf(policy, api_v1.EventTypeNormal, "AddedOrUpdated", "AppProtectPolicy %v was added or updated", key) } -func (lbc *LoadBalancerController) handleAppProtectPolicyUpdate(pol *unstructured.Unstructured, ings []extensions.Ingress) error { +func (lbc *LoadBalancerController) handleAppProtectPolicyUpdate(pol *unstructured.Unstructured, ings []networking.Ingress) error { regular, mergeable := lbc.createIngresses(ings) polNsName := pol.GetNamespace() + "/" + pol.GetName() @@ -3217,7 +3217,7 @@ func (lbc *LoadBalancerController) handleAppProtectPolicyUpdate(pol *unstructure return nil } -func (lbc *LoadBalancerController) handleAppProtectPolicyDeletion(key string, ings []extensions.Ingress) error { +func (lbc *LoadBalancerController) handleAppProtectPolicyDeletion(key string, ings []networking.Ingress) error { regular, mergeable := lbc.createIngresses(ings) eventType := api_v1.EventTypeNormal @@ -3285,7 +3285,7 @@ func (lbc *LoadBalancerController) syncAppProtectLogConf(task task) { lbc.recorder.Eventf(logConf, api_v1.EventTypeNormal, "AddedOrUpdated", "AppProtectLogConfig %v was added or updated", key) } -func (lbc *LoadBalancerController) handleAppProtectLogConfUpdate(logConf *unstructured.Unstructured, ings []extensions.Ingress) error { +func (lbc *LoadBalancerController) handleAppProtectLogConfUpdate(logConf *unstructured.Unstructured, ings []networking.Ingress) error { logConfNsName := logConf.GetNamespace() + "/" + logConf.GetName() eventType := api_v1.EventTypeNormal @@ -3306,7 +3306,7 @@ func (lbc *LoadBalancerController) handleAppProtectLogConfUpdate(logConf *unstru return nil } -func (lbc *LoadBalancerController) handleAppProtectLogConfDeletion(key string, ings []extensions.Ingress) error { +func (lbc *LoadBalancerController) handleAppProtectLogConfDeletion(key string, ings []networking.Ingress) error { eventType := api_v1.EventTypeNormal title := "Updated" message := fmt.Sprintf("Configuration was updated due to deleted App Protect Log Configuration %v", key) @@ -3325,7 +3325,7 @@ func (lbc *LoadBalancerController) handleAppProtectLogConfDeletion(key string, i return nil } -func (lbc *LoadBalancerController) findIngressesForAppProtectResource(namespace string, name string, annotationRef string) (apIngs []extensions.Ingress) { +func (lbc *LoadBalancerController) findIngressesForAppProtectResource(namespace string, name string, annotationRef string) (apIngs []networking.Ingress) { ings, mIngs := lbc.GetManagedIngresses() for i := range ings { if pol, exists := ings[i].Annotations[annotationRef]; exists { diff --git a/internal/k8s/controller_test.go b/internal/k8s/controller_test.go index d1bf223f17..2bb9e4ed14 100644 --- a/internal/k8s/controller_test.go +++ b/internal/k8s/controller_test.go @@ -18,7 +18,7 @@ import ( conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" conf_v1alpha1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1alpha1" v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/intstr" @@ -31,7 +31,7 @@ func TestHasCorrectIngressClass(t *testing.T) { var testsWithoutIngressClassOnly = []struct { lbc *LoadBalancerController - ing *extensions.Ingress + ing *networking.Ingress expected bool }{ { @@ -40,7 +40,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: false, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: ""}, }, @@ -53,7 +53,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: false, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: "gce"}, }, @@ -66,7 +66,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: false, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: ingressClass}, }, @@ -79,7 +79,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: false, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{}, }, @@ -90,7 +90,7 @@ func TestHasCorrectIngressClass(t *testing.T) { var testsWithIngressClassOnly = []struct { lbc *LoadBalancerController - ing *extensions.Ingress + ing *networking.Ingress expected bool }{ { @@ -99,7 +99,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: true, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: ""}, }, @@ -112,7 +112,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: true, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: "gce"}, }, @@ -125,7 +125,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: true, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{ingressClassKey: ingressClass}, }, @@ -138,7 +138,7 @@ func TestHasCorrectIngressClass(t *testing.T) { useIngressClassOnly: true, metricsCollector: collectors.NewControllerFakeCollector(), }, - &extensions.Ingress{ + &networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Annotations: map[string]string{}, }, @@ -332,15 +332,15 @@ func TestCreateMergableIngressesInvalidMaster(t *testing.T) { cafeMaster, _, _, lbc := getMergableDefaults() // Test Error when Master has a Path - cafeMaster.Spec.Rules = []extensions.IngressRule{ + cafeMaster.Spec.Rules = []networking.IngressRule{ { Host: "ok.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/coffee", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: "coffee-svc", ServicePort: intstr.IntOrString{ StrVal: "80", @@ -368,8 +368,8 @@ func TestFindMasterForMinion(t *testing.T) { cafeMaster, coffeeMinion, teaMinion, lbc := getMergableDefaults() // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - cafeMaster.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + cafeMaster.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } err := lbc.ingressLister.Add(&cafeMaster) @@ -434,11 +434,11 @@ func TestFindMasterForMinionInvalidMinion(t *testing.T) { cafeMaster, coffeeMinion, _, lbc := getMergableDefaults() // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - cafeMaster.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + cafeMaster.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } - coffeeMinion.Spec.Rules = []extensions.IngressRule{ + coffeeMinion.Spec.Rules = []networking.IngressRule{ { Host: "ok.com", }, @@ -467,8 +467,8 @@ func TestGetMinionsForMaster(t *testing.T) { cafeMaster, coffeeMinion, teaMinion, lbc := getMergableDefaults() // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - cafeMaster.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + cafeMaster.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } err := lbc.ingressLister.Add(&cafeMaster) @@ -525,11 +525,11 @@ func TestGetMinionsForMasterInvalidMinion(t *testing.T) { cafeMaster, coffeeMinion, teaMinion, lbc := getMergableDefaults() // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - cafeMaster.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + cafeMaster.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } - teaMinion.Spec.Rules = []extensions.IngressRule{ + teaMinion.Spec.Rules = []networking.IngressRule{ { Host: "ok.com", }, @@ -589,13 +589,13 @@ func TestGetMinionsForMasterConflictingPaths(t *testing.T) { cafeMaster, coffeeMinion, teaMinion, lbc := getMergableDefaults() // Makes sure there is an empty path assigned to a master, to allow for lbc.createIngress() to pass - cafeMaster.Spec.Rules[0].HTTP = &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{}, + cafeMaster.Spec.Rules[0].HTTP = &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{}, } - coffeeMinion.Spec.Rules[0].HTTP.Paths = append(coffeeMinion.Spec.Rules[0].HTTP.Paths, extensions.HTTPIngressPath{ + coffeeMinion.Spec.Rules[0].HTTP.Paths = append(coffeeMinion.Spec.Rules[0].HTTP.Paths, networking.HTTPIngressPath{ Path: "/tea", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: "tea-svc", ServicePort: intstr.IntOrString{ StrVal: "80", @@ -655,8 +655,8 @@ func TestGetMinionsForMasterConflictingPaths(t *testing.T) { } } -func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingress, lbc LoadBalancerController) { - cafeMaster = extensions.Ingress{ +func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion networking.Ingress, lbc LoadBalancerController) { + cafeMaster = networking.Ingress{ TypeMeta: meta_v1.TypeMeta{}, ObjectMeta: meta_v1.ObjectMeta{ Name: "cafe-master", @@ -666,16 +666,16 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre "nginx.org/mergeable-ingress-type": "master", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "ok.com", }, }, }, - Status: extensions.IngressStatus{}, + Status: networking.IngressStatus{}, } - coffeeMinion = extensions.Ingress{ + coffeeMinion = networking.Ingress{ TypeMeta: meta_v1.TypeMeta{}, ObjectMeta: meta_v1.ObjectMeta{ Name: "coffee-minion", @@ -685,16 +685,16 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre "nginx.org/mergeable-ingress-type": "minion", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "ok.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/coffee", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: "coffee-svc", ServicePort: intstr.IntOrString{ StrVal: "80", @@ -707,9 +707,9 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre }, }, }, - Status: extensions.IngressStatus{}, + Status: networking.IngressStatus{}, } - teaMinion = extensions.Ingress{ + teaMinion = networking.Ingress{ TypeMeta: meta_v1.TypeMeta{}, ObjectMeta: meta_v1.ObjectMeta{ Name: "tea-minion", @@ -719,13 +719,13 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre "nginx.org/mergeable-ingress-type": "minion", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "ok.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/tea", }, @@ -735,7 +735,7 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre }, }, }, - Status: extensions.IngressStatus{}, + Status: networking.IngressStatus{}, } ingExMap := make(map[string]*configs.IngressEx) @@ -761,11 +761,11 @@ func getMergableDefaults() (cafeMaster, coffeeMinion, teaMinion extensions.Ingre metricsCollector: collectors.NewControllerFakeCollector(), } lbc.svcLister, _ = cache.NewInformer( - cache.NewListWatchFromClient(lbc.client.ExtensionsV1beta1().RESTClient(), "services", "default", fields.Everything()), - &extensions.Ingress{}, time.Duration(1), nil) + cache.NewListWatchFromClient(lbc.client.NetworkingV1beta1().RESTClient(), "services", "default", fields.Everything()), + &networking.Ingress{}, time.Duration(1), nil) lbc.ingressLister.Store, _ = cache.NewInformer( - cache.NewListWatchFromClient(lbc.client.ExtensionsV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), - &extensions.Ingress{}, time.Duration(1), nil) + cache.NewListWatchFromClient(lbc.client.NetworkingV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), + &networking.Ingress{}, time.Duration(1), nil) return } @@ -1007,7 +1007,7 @@ func TestGetServicePortForIngressPort(t *testing.T) { func TestFindIngressesForSecret(t *testing.T) { testCases := []struct { secret v1.Secret - ingress extensions.Ingress + ingress networking.Ingress expectedToFind bool desc string }{ @@ -1018,13 +1018,13 @@ func TestFindIngressesForSecret(t *testing.T) { Namespace: "namespace-1", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "my-ingress", Namespace: "namespace-1", }, - Spec: extensions.IngressSpec{ - TLS: []extensions.IngressTLS{ + Spec: networking.IngressSpec{ + TLS: []networking.IngressTLS{ { SecretName: "my-tls-secret", }, @@ -1041,13 +1041,13 @@ func TestFindIngressesForSecret(t *testing.T) { Namespace: "namespace-1", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "my-ingress", Namespace: "namespace-2", }, - Spec: extensions.IngressSpec{ - TLS: []extensions.IngressTLS{ + Spec: networking.IngressSpec{ + TLS: []networking.IngressTLS{ { SecretName: "my-tls-secret", }, @@ -1064,7 +1064,7 @@ func TestFindIngressesForSecret(t *testing.T) { Namespace: "namespace-1", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "my-ingress", Namespace: "namespace-1", @@ -1083,7 +1083,7 @@ func TestFindIngressesForSecret(t *testing.T) { Namespace: "namespace-1", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "my-ingress", Namespace: "namespace-2", @@ -1123,8 +1123,8 @@ func TestFindIngressesForSecret(t *testing.T) { } lbc.ingressLister.Store, _ = cache.NewInformer( - cache.NewListWatchFromClient(lbc.client.ExtensionsV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), - &extensions.Ingress{}, time.Duration(1), nil) + cache.NewListWatchFromClient(lbc.client.NetworkingV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), + &networking.Ingress{}, time.Duration(1), nil) lbc.secretLister.Store, lbc.secretController = cache.NewInformer( cache.NewListWatchFromClient(lbc.client.CoreV1().RESTClient(), "secrets", "default", fields.Everything()), @@ -1177,7 +1177,7 @@ func TestFindIngressesForSecret(t *testing.T) { func TestFindIngressesForSecretWithMinions(t *testing.T) { testCases := []struct { secret v1.Secret - ingress extensions.Ingress + ingress networking.Ingress expectedToFind bool desc string }{ @@ -1188,7 +1188,7 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { Namespace: "default", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "cafe-ingress-tea-minion", Namespace: "default", @@ -1198,16 +1198,16 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { configs.JWTKeyAnnotation: "my-jwk-secret", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "cafe.example.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/tea", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: "tea-svc", ServicePort: intstr.FromString("80"), }, @@ -1229,7 +1229,7 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { Namespace: "namespace-1", }, }, - ingress: extensions.Ingress{ + ingress: networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "cafe-ingress-tea-minion", Namespace: "default", @@ -1239,16 +1239,16 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { configs.JWTKeyAnnotation: "my-jwk-secret", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "cafe.example.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/tea", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: "tea-svc", ServicePort: intstr.FromString("80"), }, @@ -1265,7 +1265,7 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { }, } - master := extensions.Ingress{ + master := networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "cafe-ingress-master", Namespace: "default", @@ -1274,13 +1274,13 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { "nginx.org/mergeable-ingress-type": "master", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: "cafe.example.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ // HTTP must not be nil for Master - Paths: []extensions.HTTPIngressPath{}, + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ // HTTP must not be nil for Master + Paths: []networking.HTTPIngressPath{}, }, }, }, @@ -1314,8 +1314,8 @@ func TestFindIngressesForSecretWithMinions(t *testing.T) { } lbc.ingressLister.Store, _ = cache.NewInformer( - cache.NewListWatchFromClient(lbc.client.ExtensionsV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), - &extensions.Ingress{}, time.Duration(1), nil) + cache.NewListWatchFromClient(lbc.client.NetworkingV1beta1().RESTClient(), "ingresses", "default", fields.Everything()), + &networking.Ingress{}, time.Duration(1), nil) lbc.secretLister.Store, lbc.secretController = cache.NewInformer( cache.NewListWatchFromClient(lbc.client.CoreV1().RESTClient(), "secrets", "default", fields.Everything()), diff --git a/internal/k8s/handlers.go b/internal/k8s/handlers.go index 42f32b9b75..a7e1063dc9 100644 --- a/internal/k8s/handlers.go +++ b/internal/k8s/handlers.go @@ -6,7 +6,7 @@ import ( "github.com/golang/glog" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" "k8s.io/client-go/tools/cache" "fmt" diff --git a/internal/k8s/status.go b/internal/k8s/status.go index debe9f279e..7fa9ef9a18 100644 --- a/internal/k8s/status.go +++ b/internal/k8s/status.go @@ -14,11 +14,11 @@ import ( v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" k8s_nginx "github.com/nginxinc/kubernetes-ingress/pkg/client/clientset/versioned" api_v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes" - extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" + networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" ) // statusUpdater reports Ingress, VirtualServer and VirtualServerRoute status information via the kubernetes @@ -98,7 +98,7 @@ func (su *statusUpdater) updateIngressWithStatus(ing v1beta1.Ingress, status []a } ingCopy.Status.LoadBalancer.Ingress = status - clientIngress := su.client.ExtensionsV1beta1().Ingresses(ingCopy.Namespace) + clientIngress := su.client.NetworkingV1beta1().Ingresses(ingCopy.Namespace) _, err = clientIngress.UpdateStatus(context.TODO(), ingCopy, metav1.UpdateOptions{}) if err != nil { glog.V(3).Infof("error setting ingress status: %v", err) @@ -135,7 +135,7 @@ func (su *statusUpdater) BulkUpdateIngressStatus(ings []v1beta1.Ingress) error { // retryStatusUpdate fetches a fresh copy of the Ingress from the k8s API, checks if it still needs to be // updated, and then attempts to update. We often need to fetch fresh copies due to the // k8s API using ResourceVersion to stop updates on stale items. -func (su *statusUpdater) retryStatusUpdate(clientIngress extensionsv1beta1.IngressInterface, ingCopy *v1beta1.Ingress) error { +func (su *statusUpdater) retryStatusUpdate(clientIngress networkingv1beta1.IngressInterface, ingCopy *v1beta1.Ingress) error { apiIng, err := clientIngress.Get(context.TODO(), ingCopy.Name, metav1.GetOptions{}) if err != nil { glog.V(3).Infof("error getting ingress resource: %v", err) diff --git a/internal/k8s/status_test.go b/internal/k8s/status_test.go index 7396494d1b..273800a3cd 100644 --- a/internal/k8s/status_test.go +++ b/internal/k8s/status_test.go @@ -7,7 +7,7 @@ import ( conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/intstr" @@ -16,12 +16,12 @@ import ( ) func TestStatusUpdate(t *testing.T) { - ing := extensions.Ingress{ + ing := networking.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-1", Namespace: "namespace", }, - Status: extensions.IngressStatus{ + Status: networking.IngressStatus{ LoadBalancer: v1.LoadBalancerStatus{ Ingress: []v1.LoadBalancerIngress{ { @@ -32,14 +32,14 @@ func TestStatusUpdate(t *testing.T) { }, } fakeClient := fake.NewSimpleClientset( - &extensions.IngressList{Items: []extensions.Ingress{ + &networking.IngressList{Items: []networking.Ingress{ ing, }}, ) ingLister := storeToIngressLister{} ingLister.Store, _ = cache.NewInformer( - cache.NewListWatchFromClient(fakeClient.ExtensionsV1beta1().RESTClient(), "ingresses", "nginx-ingress", fields.Everything()), - &extensions.Ingress{}, 2, nil) + cache.NewListWatchFromClient(fakeClient.NetworkingV1beta1().RESTClient(), "ingresses", "nginx-ingress", fields.Everything()), + &networking.Ingress{}, 2, nil) err := ingLister.Store.Add(&ing) if err != nil { @@ -58,7 +58,7 @@ func TestStatusUpdate(t *testing.T) { if err != nil { t.Errorf("error clearing ing status: %v", err) } - ings, _ := fakeClient.ExtensionsV1beta1().Ingresses("namespace").List(context.TODO(), meta_v1.ListOptions{}) + ings, _ := fakeClient.NetworkingV1beta1().Ingresses("namespace").List(context.TODO(), meta_v1.ListOptions{}) ingf := ings.Items[0] if !checkStatus("", ingf) { t.Errorf("expected: %v actual: %v", "", ingf.Status.LoadBalancer.Ingress[0]) @@ -69,7 +69,7 @@ func TestStatusUpdate(t *testing.T) { if err != nil { t.Errorf("error updating ing status: %v", err) } - ring, _ := fakeClient.ExtensionsV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) + ring, _ := fakeClient.NetworkingV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) if !checkStatus("1.1.1.1", *ring) { t.Errorf("expected: %v actual: %v", "", ring.Status.LoadBalancer.Ingress) } @@ -92,7 +92,7 @@ func TestStatusUpdate(t *testing.T) { if err != nil { t.Errorf("error updating ing status: %v", err) } - ring, _ = fakeClient.ExtensionsV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) + ring, _ = fakeClient.NetworkingV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) if !checkStatus("1.1.1.1", *ring) { t.Errorf("expected: %v actual: %v", "1.1.1.1", ring.Status.LoadBalancer.Ingress) } @@ -102,7 +102,7 @@ func TestStatusUpdate(t *testing.T) { if err != nil { t.Errorf("error updating ing status: %v", err) } - ring, _ = fakeClient.ExtensionsV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) + ring, _ = fakeClient.NetworkingV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) if !checkStatus("2.2.2.2", *ring) { t.Errorf("expected: %v actual: %v", "2.2.2.2", ring.Status.LoadBalancer.Ingress) } @@ -112,13 +112,13 @@ func TestStatusUpdate(t *testing.T) { if err != nil { t.Errorf("error updating ing status: %v", err) } - ring, _ = fakeClient.ExtensionsV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) + ring, _ = fakeClient.NetworkingV1beta1().Ingresses(ing.Namespace).Get(context.TODO(), ing.Name, meta_v1.GetOptions{}) if !checkStatus("", *ring) { t.Errorf("expected: %v actual: %v", "", ring.Status.LoadBalancer.Ingress) } } -func checkStatus(expected string, actual extensions.Ingress) bool { +func checkStatus(expected string, actual networking.Ingress) bool { if len(actual.Status.LoadBalancer.Ingress) == 0 { return expected == "" } diff --git a/internal/k8s/task_queue.go b/internal/k8s/task_queue.go index 13512e65d3..8e6d08ad3c 100644 --- a/internal/k8s/task_queue.go +++ b/internal/k8s/task_queue.go @@ -8,7 +8,7 @@ import ( conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" conf_v1alpha1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1alpha1" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/util/workqueue" diff --git a/internal/k8s/utils.go b/internal/k8s/utils.go index e62d85ffb5..1037506b3a 100644 --- a/internal/k8s/utils.go +++ b/internal/k8s/utils.go @@ -22,7 +22,7 @@ import ( "strings" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + "k8s.io/api/networking/v1beta1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/tools/cache"