diff --git a/apis/elbv2/v1alpha1/zz_generated.deepcopy.go b/apis/elbv2/v1alpha1/zz_generated.deepcopy.go index e6e0e1d78..0ce767338 100644 --- a/apis/elbv2/v1alpha1/zz_generated.deepcopy.go +++ b/apis/elbv2/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/apis/elbv2/v1beta1/zz_generated.deepcopy.go b/apis/elbv2/v1beta1/zz_generated.deepcopy.go index 8637708e5..05a19bef8 100644 --- a/apis/elbv2/v1beta1/zz_generated.deepcopy.go +++ b/apis/elbv2/v1beta1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index ba263ef95..367ee7107 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -76,7 +76,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-networking-v1beta1-ingress + path: /validate-networking-v1-ingress failurePolicy: Fail matchPolicy: Equivalent name: vingress.elbv2.k8s.aws @@ -84,7 +84,7 @@ webhooks: - apiGroups: - networking.k8s.io apiVersions: - - v1beta1 + - v1 operations: - CREATE - UPDATE diff --git a/controllers/ingress/eventhandlers/ingress_class_events.go b/controllers/ingress/eventhandlers/ingress_class_events.go index 55fbf6ece..8dcd5740a 100644 --- a/controllers/ingress/eventhandlers/ingress_class_events.go +++ b/controllers/ingress/eventhandlers/ingress_class_events.go @@ -3,7 +3,7 @@ package eventhandlers import ( "context" "github.com/go-logr/logr" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" diff --git a/controllers/ingress/eventhandlers/ingress_class_params_events.go b/controllers/ingress/eventhandlers/ingress_class_params_events.go index 9db992289..3181ba003 100644 --- a/controllers/ingress/eventhandlers/ingress_class_params_events.go +++ b/controllers/ingress/eventhandlers/ingress_class_params_events.go @@ -3,7 +3,7 @@ package eventhandlers import ( "context" "github.com/go-logr/logr" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" diff --git a/controllers/ingress/eventhandlers/ingress_events.go b/controllers/ingress/eventhandlers/ingress_events.go index 91c8c6e75..4a9ba90b4 100644 --- a/controllers/ingress/eventhandlers/ingress_events.go +++ b/controllers/ingress/eventhandlers/ingress_events.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" diff --git a/controllers/ingress/eventhandlers/secret_events.go b/controllers/ingress/eventhandlers/secret_events.go index 857b1710b..b2901b3a4 100644 --- a/controllers/ingress/eventhandlers/secret_events.go +++ b/controllers/ingress/eventhandlers/secret_events.go @@ -4,7 +4,7 @@ import ( "context" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" diff --git a/controllers/ingress/eventhandlers/service_events.go b/controllers/ingress/eventhandlers/service_events.go index 47560ca63..96328a6ec 100644 --- a/controllers/ingress/eventhandlers/service_events.go +++ b/controllers/ingress/eventhandlers/service_events.go @@ -4,7 +4,7 @@ import ( "context" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" diff --git a/controllers/ingress/group_controller.go b/controllers/ingress/group_controller.go index a3cca7d77..0b4a0b2bf 100644 --- a/controllers/ingress/group_controller.go +++ b/controllers/ingress/group_controller.go @@ -6,7 +6,7 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" @@ -36,7 +36,7 @@ const ( controllerName = "ingress" // the groupVersion of used Ingress & IngressClass resource. - ingressResourcesGroupVersion = "networking.k8s.io/v1beta1" + ingressResourcesGroupVersion = "networking.k8s.io/v1" ingressClassKind = "IngressClass" ) diff --git a/docs/deploy/configurations.md b/docs/deploy/configurations.md index d9f77d015..646edeb11 100644 --- a/docs/deploy/configurations.md +++ b/docs/deploy/configurations.md @@ -18,7 +18,7 @@ Refer to the [installation guide](installation.md) for installing the controller You can limit the ingresses ALB ingress controller controls by combining following two approaches: ### Limiting ingress class -Setting the `--ingress-class` argument constrains the controller's scope to ingresses with matching `kubernetes.io/ingress.class` annotation. +Setting the `--ingress-class` argument constrains the controller's scope to ingresses with matching `ingressClassName` field. An example of the container spec portion of the controller, only listening for resources with the class "alb", would be as follows. @@ -29,18 +29,17 @@ spec: - --ingress-class=alb ``` -Now, only ingress resources with the appropriate annotation are picked up, as seen below. +Now, only ingress resources with the appropriate class are picked up, as seen below. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: echoserver namespace: echoserver - annotations: - kubernetes.io/ingress.class: "alb" spec: - ... + ingressClassName: alb + ... ``` If the ingress class is not specified, the controller will reconcile Ingress objects without the ingress class specified or ingress class `alb`. diff --git a/docs/deploy/installation.md b/docs/deploy/installation.md index 9dbf5ff29..b6732dc3e 100644 --- a/docs/deploy/installation.md +++ b/docs/deploy/installation.md @@ -2,7 +2,8 @@ ## Kubernetes version requirements * AWS Load Balancer Controller v2.0.0~v2.1.3 requires Kubernetes 1.15+ -* AWS Load Balancer Controller v2.2.0+ requires Kubernetes 1.16+ +* AWS Load Balancer Controller v2.2.0~v2.3.1 requires Kubernetes 1.16-1.21 +* AWS Load Balancer Controller v2.4.0+ requires Kubernetes 1.19+ !!!warning "Existing AWS ALB Ingress Controller users" AWS ALB Ingress controller must be uninstalled before installing AWS Load Balancer controller. diff --git a/docs/examples/2048/2048_full.yaml b/docs/examples/2048/2048_full.yaml index a6b79f283..8164724d1 100644 --- a/docs/examples/2048/2048_full.yaml +++ b/docs/examples/2048/2048_full.yaml @@ -20,7 +20,7 @@ spec: app.kubernetes.io/name: app-2048 spec: containers: - - image: alexwhen/docker-2048 + - image: public.ecr.aws/l6m2t8p7/docker-2048:latest imagePullPolicy: Always name: app-2048 ports: @@ -40,20 +40,23 @@ spec: selector: app.kubernetes.io/name: app-2048 --- -apiVersion: networking.k8s.io/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: game-2048 name: ingress-2048 annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip spec: + ingressClassName: alb rules: - http: paths: - - path: /* - backend: - serviceName: service-2048 - servicePort: 80 + - path: / + pathType: Prefix + backend: + service: + name: service-2048 + port: + number: 80 diff --git a/docs/examples/2048/2048_full_latest.yaml b/docs/examples/2048/2048_full_latest.yaml deleted file mode 100644 index 81bb5d0a7..000000000 --- a/docs/examples/2048/2048_full_latest.yaml +++ /dev/null @@ -1,62 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - name: game-2048 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: game-2048 - name: deployment-2048 -spec: - selector: - matchLabels: - app.kubernetes.io/name: app-2048 - replicas: 5 - template: - metadata: - labels: - app.kubernetes.io/name: app-2048 - spec: - containers: - - image: public.ecr.aws/l6m2t8p7/docker-2048:latest - imagePullPolicy: Always - name: app-2048 - ports: - - containerPort: 80 ---- -apiVersion: v1 -kind: Service -metadata: - namespace: game-2048 - name: service-2048 -spec: - ports: - - port: 80 - targetPort: 80 - protocol: TCP - type: NodePort - selector: - app.kubernetes.io/name: app-2048 ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - namespace: game-2048 - name: ingress-2048 - annotations: - kubernetes.io/ingress.class: alb - alb.ingress.kubernetes.io/scheme: internet-facing - alb.ingress.kubernetes.io/target-type: ip -spec: - rules: - - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: service-2048 - port: - number: 80 diff --git a/docs/examples/cognito-ingress-template.yaml b/docs/examples/cognito-ingress-template.yaml index 572f71887..f7e88390f 100644 --- a/docs/examples/cognito-ingress-template.yaml +++ b/docs/examples/cognito-ingress-template.yaml @@ -17,13 +17,12 @@ # - Related Kubernetes service/application # -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: # app.example.com namespace: # default annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/tags: Environment=,Owner= # For each `listen-ports` object defined an ALB lister is created @@ -50,18 +49,25 @@ metadata: # ACM certificate ARN for your SSL domain alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:::certificate/ spec: + ingressClassName: alb rules: # If you are using ExternalDNS, this will become your applications FQDN - host: http: paths: # This first path should perform an ssl-redirect as below - - path: /* + - path: / + pathType: Prefix backend: - serviceName: ssl-redirect - # Configured via the redirect settings in the annotations - servicePort: use-annotation + service: + name: ssl-redirect + # Configured via the redirect settings in the annotations + port: + name: use-annotation - path: + pathType: Prefix backend: - serviceName: - servicePort: + service: + name: + port: + number: diff --git a/docs/examples/echo_server.md b/docs/examples/echo_server.md index eafaa3dbe..7c21df38f 100644 --- a/docs/examples/echo_server.md +++ b/docs/examples/echo_server.md @@ -131,7 +131,7 @@ In this walkthrough, you'll ``` ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: echoserver diff --git a/docs/examples/echoservice/echoserver-ingress.yaml b/docs/examples/echoservice/echoserver-ingress.yaml index 7828010b4..256592bd8 100644 --- a/docs/examples/echoservice/echoserver-ingress.yaml +++ b/docs/examples/echoservice/echoserver-ingress.yaml @@ -1,18 +1,21 @@ -apiVersion: networking.k8s.io/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: echoserver namespace: echoserver annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/tags: Environment=dev,Team=test spec: + ingressClassName: alb rules: - host: echoserver.example.com http: paths: - path: / + pathType: Exact backend: - serviceName: echoserver - servicePort: 80 + service: + name: echoserver + port: + number: 80 diff --git a/docs/examples/grpc/grpcserver-ingress.yaml b/docs/examples/grpc/grpcserver-ingress.yaml index 0d3d4cf23..4351daa43 100644 --- a/docs/examples/grpc/grpcserver-ingress.yaml +++ b/docs/examples/grpc/grpcserver-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: networking.k8s.io/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: @@ -8,22 +8,28 @@ metadata: alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip - kubernetes.io/ingress.class: alb labels: app: grpcserver environment: dev name: grpcserver namespace: grpcserver spec: + ingressClassName: alb rules: - host: grpcserver.example.com http: paths: - backend: - serviceName: ssl-redirect - servicePort: use-annotation - path: /* + service: + name: ssl-redirect + port: + name: use-annotation + path: / + pathType: Prefix - backend: - serviceName: grpcserver - servicePort: 50051 - path: /helloworld.Greeter/* + service: + name: grpcserver + port: + number: 50051 + path: /helloworld.Greeter + pathType: Prefix diff --git a/docs/guide/ingress/annotations.md b/docs/guide/ingress/annotations.md index a10538b54..4c870964a 100644 --- a/docs/guide/ingress/annotations.md +++ b/docs/guide/ingress/annotations.md @@ -247,13 +247,12 @@ Traffic Routing can be controlled with following annotations: - forward-multiple-tg: forward to multiple targetGroups with different weights and stickiness config [**advanced schema**] ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: default name: ingress annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/actions.response-503: > {"type":"fixed-response","fixedResponseConfig":{"contentType":"text/plain","statusCode":"503","messageBody":"503 error text"}} @@ -264,25 +263,38 @@ Traffic Routing can be controlled with following annotations: alb.ingress.kubernetes.io/actions.forward-multiple-tg: > {"type":"forward","forwardConfig":{"targetGroups":[{"serviceName":"service-1","servicePort":"http","weight":20},{"serviceName":"service-2","servicePort":80,"weight":20},{"targetGroupARN":"arn-of-your-non-k8s-target-group","weight":60}],"targetGroupStickinessConfig":{"enabled":true,"durationSeconds":200}}} spec: + ingressClassName: alb rules: - http: paths: - path: /503 + pathType: Exact backend: - serviceName: response-503 - servicePort: use-annotation + service: + name: response-503 + port: + name: use-annotation - path: /eks + pathType: Exact backend: - serviceName: redirect-to-eks - servicePort: use-annotation + service: + name: redirect-to-eks + port: + name: use-annotation - path: /path1 + pathType: Exact backend: - serviceName: forward-single-tg - servicePort: use-annotation + service: + name: forward-single-tg + port: + name: use-annotation - path: /path2 + pathType: Exact backend: - serviceName: forward-multiple-tg - servicePort: use-annotation + service: + name: forward-multiple-tg + port: + name: use-annotation ``` - `alb.ingress.kubernetes.io/conditions.${conditions-name}` Provides a method for specifying routing conditions **in addition to original host/path condition on Ingress spec**. @@ -332,13 +344,12 @@ Traffic Routing can be controlled with following annotations: - Query string is paramB:valueB ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: default name: ingress annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/actions.rule-path1: > {"type":"fixed-response","fixedResponseConfig":{"contentType":"text/plain","statusCode":"200","messageBody":"Host is www.example.com OR anno.example.com"}} @@ -369,38 +380,60 @@ Traffic Routing can be controlled with following annotations: alb.ingress.kubernetes.io/conditions.rule-path7: > [{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "HeaderName", "values":["HeaderValue"]}},{"field":"query-string","queryStringConfig":{"values":[{"key":"paramA","value":"valueA"}]}},{"field":"query-string","queryStringConfig":{"values":[{"key":"paramB","value":"valueB"}]}}] spec: + ingressClassName: alb rules: - host: www.example.com http: paths: - path: /path1 + pathType: Exact backend: - serviceName: rule-path1 - servicePort: use-annotation + service: + name: rule-path1 + port: + name: use-annotation - path: /path2 + pathType: Exact backend: - serviceName: rule-path2 - servicePort: use-annotation + service: + name: rule-path2 + port: + name: use-annotation - path: /path3 + pathType: Exact backend: - serviceName: rule-path3 - servicePort: use-annotation + service: + name: rule-path3 + port: + name: use-annotation - path: /path4 + pathType: Exact backend: - serviceName: rule-path4 - servicePort: use-annotation + service: + name: rule-path4 + port: + name: use-annotation - path: /path5 + pathType: Exact backend: - serviceName: rule-path5 - servicePort: use-annotation + service: + name: rule-path5 + port: + name: use-annotation - path: /path6 + pathType: Exact backend: - serviceName: rule-path6 - servicePort: use-annotation + service: + name: rule-path6 + port: + name: use-annotation - path: /path7 + pathType: Exact backend: - serviceName: rule-path7 - servicePort: use-annotation + service: + name: rule-path7 + port: + name: use-annotation ``` ## Access control diff --git a/docs/guide/ingress/cert_discovery.md b/docs/guide/ingress/cert_discovery.md index 5f539754a..1f79faab7 100644 --- a/docs/guide/ingress/cert_discovery.md +++ b/docs/guide/ingress/cert_discovery.md @@ -11,25 +11,28 @@ The controller will attempt to discover TLS certificates from the `tls` field in !!!example - attaches certs for `www.example.com` to the ALB ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: default name: ingress annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]' spec: + ingressClassName: alb tls: - hosts: - www.example.com rules: - http: paths: - - path: /users/* + - path: /users + pathType: Prefix backend: - serviceName: user-service - servicePort: 80 + service: + name: user-service + port: + number: 80 ``` @@ -38,21 +41,24 @@ The controller will attempt to discover TLS certificates from the `tls` field in !!!example - attaches a cert for `dev.example.com` or `*.example.com` to the ALB ```yaml - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: default name: ingress annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]' spec: - rules: - - host: dev.example.com - http: - paths: - - path: /users/* - backend: - serviceName: user-service - servicePort: 80 + ingressClassName: alb + rules: + - host: dev.example.com + http: + paths: + - path: /users + pathType: Prefix + backend: + service: + name: user-service + port: + number: 80 ``` diff --git a/docs/guide/ingress/spec.md b/docs/guide/ingress/spec.md index d7fe9a342..754ba522d 100644 --- a/docs/guide/ingress/spec.md +++ b/docs/guide/ingress/spec.md @@ -1,53 +1,28 @@ # Ingress specification This document covers how ingress resources work in relation to The AWS Load Balancer Controller. -An example ingress for Kubernetes Version 1.18 and below, from [example](../../examples/2048/2048_full.yaml) is as follows. +An example ingress, from [example](../../examples/2048/2048_full.yaml) is as follows. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: "2048-ingress" namespace: "2048-game" - annotations: - kubernetes.io/ingress.class: alb labels: app: 2048-nginx-ingress spec: + ingressClassName: alb rules: - host: 2048.example.com http: paths: - path: /* backend: - serviceName: "service-2048" - servicePort: 80 -``` - -An example ingress for Kubernetes Version 1.19 and above, from [example](../../examples/2048/2048_full_latest.yaml) is as follows. - -```yaml -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: "2048-ingress" - namespace: "2048-game" - annotations: - kubernetes.io/ingress.class: alb - labels: - app: 2048-nginx-ingress -spec: - rules: - - host: 2048.example.com - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: service-2048 - port: - number: 80 + service: + name: "service-2048" + port: + number: 80 ``` The host field specifies the eventual Route 53-managed domain that will route to this service. @@ -55,3 +30,5 @@ The host field specifies the eventual Route 53-managed domain that will route to The service, service-2048, must be of type NodePort in order for the provisioned ALB to route to it.(see [echoserver-service.yaml](../../examples/echoservice/echoserver-service.yaml)) For details on purpose of annotations seen above, see [Annotations](annotations.md). + +The AWS Load Balancer Controller does not support the `resource` field of `backend`. diff --git a/docs/guide/tasks/migrate_legacy_apps.md b/docs/guide/tasks/migrate_legacy_apps.md index e34a455e5..027a84fcd 100644 --- a/docs/guide/tasks/migrate_legacy_apps.md +++ b/docs/guide/tasks/migrate_legacy_apps.md @@ -14,26 +14,32 @@ Learn more about the actions annotation at ## Example Ingress Manifest ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: testcase name: echoserver annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/actions.legacy-app: '{"Type": "forward", "TargetGroupArn": "legacy-tg-arn"}' spec: + ingressClassName: alb rules: - http: paths: - path: /v1/endpoints + pathType: Exact backend: - serviceName: legacy-app - servicePort: use-annotation + service: + name: legacy-app + port: + name: use-annotation - path: /normal-path + pathType: Exact backend: - serviceName: echoserver - servicePort: 80 + service: + name: echoserver + port: + number: 80 ``` !!!note diff --git a/docs/guide/tasks/ssl_redirect.md b/docs/guide/tasks/ssl_redirect.md index 0e88d9e0e..796a3a0b5 100644 --- a/docs/guide/tasks/ssl_redirect.md +++ b/docs/guide/tasks/ssl_redirect.md @@ -5,30 +5,34 @@ You can use the [`alb.ingress.kubernetes.io/ssl-redirect`](../ingress/annotation ## Example Ingress Manifest ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: default name: ingress annotations: - kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-west-2:xxxx:certificate/xxxxxx alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' alb.ingress.kubernetes.io/ssl-redirect: '443' spec: + ingressClassName: alb rules: - http: paths: - path: /users/* pathType: ImplementationSpecific backend: - serviceName: user-service - servicePort: 80 + service: + name: user-service + port: + number: 80 - path: /* pathType: ImplementationSpecific backend: - serviceName: default-service - servicePort: 80 + service: + name: default-service + port: + number: 80 ``` !!!note diff --git a/helm/aws-load-balancer-controller/templates/webhook.yaml b/helm/aws-load-balancer-controller/templates/webhook.yaml index a2c8c7ef4..a03932830 100644 --- a/helm/aws-load-balancer-controller/templates/webhook.yaml +++ b/helm/aws-load-balancer-controller/templates/webhook.yaml @@ -117,7 +117,7 @@ webhooks: service: name: {{ template "aws-load-balancer-controller.namePrefix" . }}-webhook-service namespace: {{ $.Release.Namespace }} - path: /validate-networking-v1beta1-ingress + path: /validate-networking-v1-ingress failurePolicy: Fail matchPolicy: Equivalent name: vingress.elbv2.k8s.aws @@ -127,7 +127,7 @@ webhooks: - apiGroups: - networking.k8s.io apiVersions: - - v1beta1 + - v1 operations: - CREATE - UPDATE diff --git a/pkg/equality/ignore_fake_client_populated_fields_test.go b/pkg/equality/ignore_fake_client_populated_fields_test.go index e2f899062..35e6ed279 100644 --- a/pkg/equality/ignore_fake_client_populated_fields_test.go +++ b/pkg/equality/ignore_fake_client_populated_fields_test.go @@ -1,11 +1,12 @@ package equality import ( + "testing" + "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "testing" ) func TestIgnoreFakeClientPopulatedFields(t *testing.T) { diff --git a/pkg/ingress/class.go b/pkg/ingress/class.go index 77f4e29db..192219461 100644 --- a/pkg/ingress/class.go +++ b/pkg/ingress/class.go @@ -1,7 +1,7 @@ package ingress import ( - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1" ) diff --git a/pkg/ingress/class_loader.go b/pkg/ingress/class_loader.go index a8230ca7d..7006a08ff 100644 --- a/pkg/ingress/class_loader.go +++ b/pkg/ingress/class_loader.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" diff --git a/pkg/ingress/class_loader_test.go b/pkg/ingress/class_loader_test.go index f4810b714..9be287be2 100644 --- a/pkg/ingress/class_loader_test.go +++ b/pkg/ingress/class_loader_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" admissionv1 "k8s.io/api/admission/v1" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" diff --git a/pkg/ingress/enhanced_backend_builder.go b/pkg/ingress/enhanced_backend_builder.go index fb57e4012..ea2392244 100644 --- a/pkg/ingress/enhanced_backend_builder.go +++ b/pkg/ingress/enhanced_backend_builder.go @@ -3,10 +3,11 @@ package ingress import ( "context" "fmt" + awssdk "github.com/aws/aws-sdk-go/aws" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" @@ -114,19 +115,25 @@ func (b *defaultEnhancedBackendBuilder) Build(ctx context.Context, ing *networki } buildOpts.ApplyOptions(opts...) - conditions, err := b.buildConditions(ctx, ing.Annotations, backend.ServiceName) + if backend.Service == nil { + return EnhancedBackend{}, errors.New("missing required \"service\" field") + } + + conditions, err := b.buildConditions(ctx, ing.Annotations, backend.Service.Name) if err != nil { return EnhancedBackend{}, err } var action Action - if backend.ServicePort.String() == magicServicePortUseAnnotation { - action, err = b.buildActionViaAnnotation(ctx, ing.Annotations, backend.ServiceName) + if backend.Service.Port.Name == magicServicePortUseAnnotation { + action, err = b.buildActionViaAnnotation(ctx, ing.Annotations, backend.Service.Name) if err != nil { return EnhancedBackend{}, err } + } else if backend.Service.Port.Name != "" { + action = b.buildActionViaServiceAndServicePort(ctx, backend.Service.Name, intstr.FromString(backend.Service.Port.Name)) } else { - action = b.buildActionViaServiceAndServicePort(ctx, backend.ServiceName, backend.ServicePort) + action = b.buildActionViaServiceAndServicePort(ctx, backend.Service.Name, intstr.FromInt(int(backend.Service.Port.Number))) } var authCfg AuthConfig diff --git a/pkg/ingress/enhanced_backend_builder_test.go b/pkg/ingress/enhanced_backend_builder_test.go index a8b775088..64e12ea3d 100644 --- a/pkg/ingress/enhanced_backend_builder_test.go +++ b/pkg/ingress/enhanced_backend_builder_test.go @@ -2,12 +2,14 @@ package ingress import ( "context" + "testing" + awssdk "github.com/aws/aws-sdk-go/aws" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -16,7 +18,6 @@ import ( "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" "sigs.k8s.io/aws-load-balancer-controller/pkg/equality" testclient "sigs.k8s.io/controller-runtime/pkg/client/fake" - "testing" ) func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { @@ -43,6 +44,7 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, } portHTTP := intstr.FromString("http") + backendPortHTTP := networking.ServiceBackendPort{Name: "http"} tests := []struct { name string env env @@ -69,8 +71,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: backendPortHTTP, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -119,8 +123,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: backendPortHTTP, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -179,8 +185,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: backendPortHTTP, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -232,8 +240,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: backendPortHTTP, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -275,8 +285,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: backendPortHTTP, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -301,8 +313,10 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: portHTTP, + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: backendPortHTTP, + }, }, loadBackendServices: false, loadAuthConfig: false, @@ -342,8 +356,12 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "fake-my-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "fake-my-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -393,8 +411,12 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "fake-my-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "fake-my-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -454,8 +476,12 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "fake-my-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "fake-my-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -507,8 +533,12 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "fake-my-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "fake-my-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -550,8 +580,12 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, }, backend: networking.IngressBackend{ - ServiceName: "fake-my-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "fake-my-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, loadBackendServices: true, loadAuthConfig: true, @@ -559,6 +593,35 @@ func Test_defaultEnhancedBackendBuilder_Build(t *testing.T) { }, wantErr: errors.New("missing actions.fake-my-svc configuration"), }, + { + name: "resource backend", + env: env{ + svcs: []*corev1.Service{svc1}, + }, + fields: fields{ + tolerateNonExistentBackendService: true, + tolerateNonExistentBackendAction: true, + }, + args: args{ + ing: &networking.Ingress{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "awesome-ns", + Annotations: map[string]string{}, + }, + }, + backend: networking.IngressBackend{ + Resource: &corev1.TypedLocalObjectReference{ + APIGroup: awssdk.String("v1"), + Kind: "Service", + Name: "awesome-service", + }, + }, + loadBackendServices: true, + loadAuthConfig: true, + backendServices: map[types.NamespacedName]*corev1.Service{}, + }, + wantErr: errors.New("missing required \"service\" field"), + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/pkg/ingress/finalizer.go b/pkg/ingress/finalizer.go index e159faf67..c1c0cac67 100644 --- a/pkg/ingress/finalizer.go +++ b/pkg/ingress/finalizer.go @@ -3,7 +3,7 @@ package ingress import ( "context" "fmt" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" ) diff --git a/pkg/ingress/finalizer_test.go b/pkg/ingress/finalizer_test.go index 9bae67a10..315614b62 100644 --- a/pkg/ingress/finalizer_test.go +++ b/pkg/ingress/finalizer_test.go @@ -5,7 +5,7 @@ import ( "errors" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" "testing" diff --git a/pkg/ingress/group.go b/pkg/ingress/group.go index cf7f56ff6..20746185c 100644 --- a/pkg/ingress/group.go +++ b/pkg/ingress/group.go @@ -3,7 +3,7 @@ package ingress import ( "fmt" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" ) diff --git a/pkg/ingress/group_loader.go b/pkg/ingress/group_loader.go index 35b6f32ad..aab7df16a 100644 --- a/pkg/ingress/group_loader.go +++ b/pkg/ingress/group_loader.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "github.com/pkg/errors" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/record" "regexp" diff --git a/pkg/ingress/group_loader_test.go b/pkg/ingress/group_loader_test.go index 8d9e82fe1..0d84d6774 100644 --- a/pkg/ingress/group_loader_test.go +++ b/pkg/ingress/group_loader_test.go @@ -7,7 +7,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/pkg/errors" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" diff --git a/pkg/ingress/model_build_listener.go b/pkg/ingress/model_build_listener.go index 89c5020d8..8a99dc146 100644 --- a/pkg/ingress/model_build_listener.go +++ b/pkg/ingress/model_build_listener.go @@ -9,7 +9,7 @@ import ( awssdk "github.com/aws/aws-sdk-go/aws" "github.com/pkg/errors" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/aws-load-balancer-controller/pkg/algorithm" @@ -62,7 +62,7 @@ func (t *defaultModelBuildTask) buildListenerDefaultActions(ctx context.Context, ingsWithDefaultBackend := make([]ClassifiedIngress, 0, len(ingList)) for _, ing := range ingList { - if ing.Ing.Spec.Backend != nil { + if ing.Ing.Spec.DefaultBackend != nil { ingsWithDefaultBackend = append(ingsWithDefaultBackend, ing) } } @@ -78,7 +78,7 @@ func (t *defaultModelBuildTask) buildListenerDefaultActions(ctx context.Context, return nil, errors.Errorf("multiple ingress defined default backend: %v", ingKeys) } ing := ingsWithDefaultBackend[0] - enhancedBackend, err := t.enhancedBackendBuilder.Build(ctx, ing.Ing, *ing.Ing.Spec.Backend, + enhancedBackend, err := t.enhancedBackendBuilder.Build(ctx, ing.Ing, *ing.Ing.Spec.DefaultBackend, WithLoadBackendServices(true, t.backendServices), WithLoadAuthConfig(true)) if err != nil { diff --git a/pkg/ingress/model_build_listener_rules.go b/pkg/ingress/model_build_listener_rules.go index 5accb7699..104c3cda8 100644 --- a/pkg/ingress/model_build_listener_rules.go +++ b/pkg/ingress/model_build_listener_rules.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/pkg/errors" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "sigs.k8s.io/aws-load-balancer-controller/pkg/algorithm" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" "sigs.k8s.io/aws-load-balancer-controller/pkg/model/core" diff --git a/pkg/ingress/model_build_listener_rules_test.go b/pkg/ingress/model_build_listener_rules_test.go index bda89f9ff..79bde536c 100644 --- a/pkg/ingress/model_build_listener_rules_test.go +++ b/pkg/ingress/model_build_listener_rules_test.go @@ -3,7 +3,7 @@ package ingress import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "testing" ) diff --git a/pkg/ingress/model_build_load_balancer_attributes_test.go b/pkg/ingress/model_build_load_balancer_attributes_test.go index d398efab6..bb42e50e3 100644 --- a/pkg/ingress/model_build_load_balancer_attributes_test.go +++ b/pkg/ingress/model_build_load_balancer_attributes_test.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/pkg/errors" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1" "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" diff --git a/pkg/ingress/model_build_load_balancer_test.go b/pkg/ingress/model_build_load_balancer_test.go index 3f391ade3..2ea42ee19 100644 --- a/pkg/ingress/model_build_load_balancer_test.go +++ b/pkg/ingress/model_build_load_balancer_test.go @@ -7,7 +7,7 @@ import ( awssdk "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" diff --git a/pkg/ingress/model_build_managed_sg_test.go b/pkg/ingress/model_build_managed_sg_test.go index e04fa47ac..ecb37c8f1 100644 --- a/pkg/ingress/model_build_managed_sg_test.go +++ b/pkg/ingress/model_build_managed_sg_test.go @@ -4,7 +4,7 @@ import ( "context" "github.com/pkg/errors" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" diff --git a/pkg/ingress/model_build_tags_test.go b/pkg/ingress/model_build_tags_test.go index 080011073..f5e250866 100644 --- a/pkg/ingress/model_build_tags_test.go +++ b/pkg/ingress/model_build_tags_test.go @@ -4,7 +4,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1" diff --git a/pkg/ingress/model_build_target_group_test.go b/pkg/ingress/model_build_target_group_test.go index a7af221ca..74f7b7c70 100644 --- a/pkg/ingress/model_build_target_group_test.go +++ b/pkg/ingress/model_build_target_group_test.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" diff --git a/pkg/ingress/model_builder.go b/pkg/ingress/model_builder.go index 62ddf07d3..f9c1547a7 100644 --- a/pkg/ingress/model_builder.go +++ b/pkg/ingress/model_builder.go @@ -7,7 +7,7 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/record" diff --git a/pkg/ingress/model_builder_test.go b/pkg/ingress/model_builder_test.go index 8ca4c9c54..7d0e63f72 100644 --- a/pkg/ingress/model_builder_test.go +++ b/pkg/ingress/model_builder_test.go @@ -12,7 +12,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" @@ -230,15 +230,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_2.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_2.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -253,8 +261,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -698,15 +710,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_2.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_2.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -721,8 +741,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -1176,15 +1200,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_2.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_2.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -1199,8 +1231,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -1648,15 +1684,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_2.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_2.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -1671,8 +1715,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -2128,15 +2176,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1-name", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-1-port", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -2520,15 +2576,23 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_1.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_1.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_2.Name, - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_2.Name, + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -2543,8 +2607,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3034,8 +3102,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3233,8 +3305,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/svc-3", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_3.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_3.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3282,8 +3358,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_ipv6.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_ipv6.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3510,8 +3590,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/", Backend: networking.IngressBackend{ - ServiceName: ns_1_svc_ipv6.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: ns_1_svc_ipv6.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3558,8 +3642,12 @@ func Test_defaultModelBuilder_Build(t *testing.T) { { Path: "/", Backend: networking.IngressBackend{ - ServiceName: svcWithNamedTargetPort.Name, - ServicePort: intstr.FromString("https"), + Service: &networking.IngressServiceBackend{ + Name: svcWithNamedTargetPort.Name, + Port: networking.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, @@ -3860,8 +3948,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -3912,8 +4004,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -3967,8 +4063,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4019,8 +4119,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4068,8 +4172,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4095,8 +4203,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4147,8 +4259,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4174,8 +4290,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4229,8 +4349,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4259,8 +4383,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4314,8 +4442,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-1", Backend: networking.IngressBackend{ - ServiceName: "svc-1", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-1", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -4344,8 +4476,12 @@ func Test_defaultModelBuildTask_buildSSLRedirectConfig(t *testing.T) { { Path: "/svc-2", Backend: networking.IngressBackend{ - ServiceName: "svc-2", - ServicePort: intstr.FromString("http"), + Service: &networking.IngressServiceBackend{ + Name: "svc-2", + Port: networking.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, diff --git a/pkg/ingress/reference_indexer.go b/pkg/ingress/reference_indexer.go index 3e18eb902..eda54f836 100644 --- a/pkg/ingress/reference_indexer.go +++ b/pkg/ingress/reference_indexer.go @@ -2,9 +2,10 @@ package ingress import ( "context" + awssdk "github.com/aws/aws-sdk-go/aws" "github.com/go-logr/logr" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/util/sets" elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -53,8 +54,8 @@ type defaultReferenceIndexer struct { func (i *defaultReferenceIndexer) BuildServiceRefIndexes(ctx context.Context, ing *networking.Ingress) []string { var backends []networking.IngressBackend - if ing.Spec.Backend != nil { - backends = append(backends, *ing.Spec.Backend) + if ing.Spec.DefaultBackend != nil { + backends = append(backends, *ing.Spec.DefaultBackend) } for _, rule := range ing.Spec.Rules { if rule.HTTP == nil { diff --git a/pkg/ingress/reference_indexer_test.go b/pkg/ingress/reference_indexer_test.go index e7eb9f11a..babb9f1ee 100644 --- a/pkg/ingress/reference_indexer_test.go +++ b/pkg/ingress/reference_indexer_test.go @@ -2,16 +2,16 @@ package ingress import ( "context" + "testing" + awssdk "github.com/aws/aws-sdk-go/aws" "github.com/go-logr/logr" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - "testing" ) func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { @@ -31,9 +31,13 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { Name: "my-ing", }, Spec: networking.IngressSpec{ - Backend: &networking.IngressBackend{ - ServiceName: "svc-a", - ServicePort: intstr.FromInt(80), + DefaultBackend: &networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "svc-a", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, Rules: []networking.IngressRule{ { @@ -44,15 +48,23 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "svc-b", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-b", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/pathC", Backend: networking.IngressBackend{ - ServiceName: "svc-c", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-c", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -67,15 +79,23 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "svc-b", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-b", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/pathD", Backend: networking.IngressBackend{ - ServiceName: "svc-d", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-d", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -96,7 +116,7 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { Name: "my-ing", }, Spec: networking.IngressSpec{ - Backend: nil, + DefaultBackend: nil, Rules: []networking.IngressRule{ { Host: "/hostX", @@ -106,15 +126,23 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "svc-b", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-b", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/pathC", Backend: networking.IngressBackend{ - ServiceName: "svc-c", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-c", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -129,15 +157,23 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "svc-b", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-b", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/pathD", Backend: networking.IngressBackend{ - ServiceName: "svc-d", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-d", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -173,15 +209,23 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "svc-b", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-b", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/pathD", Backend: networking.IngressBackend{ - ServiceName: "svc-d", - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: "svc-d", + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -208,9 +252,13 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { }, }, Spec: networking.IngressSpec{ - Backend: &networking.IngressBackend{ - ServiceName: "forward-single-svc", - ServicePort: intstr.FromString("use-annotation"), + DefaultBackend: &networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "forward-single-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, Rules: []networking.IngressRule{ { @@ -221,22 +269,34 @@ func Test_defaultReferenceIndexer_BuildServiceRefIndexes(t *testing.T) { { Path: "/pathB", Backend: networking.IngressBackend{ - ServiceName: "forward-multiple-svc", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "forward-multiple-svc", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, }, { Path: "/pathC", Backend: networking.IngressBackend{ - ServiceName: "forward-single-tg", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "forward-single-tg", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, }, { Path: "/pathD", Backend: networking.IngressBackend{ - ServiceName: "forward-multiple-tg", - ServicePort: intstr.FromString("use-annotation"), + Service: &networking.IngressServiceBackend{ + Name: "forward-multiple-tg", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, }, }, }, diff --git a/pkg/k8s/finalizer_test.go b/pkg/k8s/finalizer_test.go index 4ee051cf6..7a4f43ddb 100644 --- a/pkg/k8s/finalizer_test.go +++ b/pkg/k8s/finalizer_test.go @@ -5,7 +5,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" diff --git a/pkg/k8s/utils_test.go b/pkg/k8s/utils_test.go index 7562f562f..13ec16288 100644 --- a/pkg/k8s/utils_test.go +++ b/pkg/k8s/utils_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" rbac "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/pkg/networking/backend_sg_provider.go b/pkg/networking/backend_sg_provider.go index a7603ac95..89c66792a 100644 --- a/pkg/networking/backend_sg_provider.go +++ b/pkg/networking/backend_sg_provider.go @@ -10,7 +10,7 @@ import ( ec2sdk "github.com/aws/aws-sdk-go/service/ec2" "github.com/go-logr/logr" "github.com/pkg/errors" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "regexp" "sigs.k8s.io/aws-load-balancer-controller/pkg/aws/services" "sigs.k8s.io/aws-load-balancer-controller/pkg/runtime" diff --git a/pkg/networking/backend_sg_provider_test.go b/pkg/networking/backend_sg_provider_test.go index 83c3af7f0..7c1ed1735 100644 --- a/pkg/networking/backend_sg_provider_test.go +++ b/pkg/networking/backend_sg_provider_test.go @@ -2,7 +2,7 @@ package networking import ( "context" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/scripts/ci_e2e_test.sh b/scripts/ci_e2e_test.sh index ea6b3d078..02a8c301f 100755 --- a/scripts/ci_e2e_test.sh +++ b/scripts/ci_e2e_test.sh @@ -29,9 +29,9 @@ CONTROLLER_IAM_POLICY_NAME="lb-controller-e2e-${PULL_NUMBER}-$BUILD_ID" CONTROLLER_IAM_POLICY_ARN="" # will be fulfilled during setup_controller_iam_sa # Cluster settings -EKSCTL_VERSION="0.34.0" +EKSCTL_VERSION="v0.77.0" CLUSTER_NAME="lb-controller-e2e-${PULL_NUMBER}-$BUILD_ID" -CLUSTER_VERSION=${CLUSTER_VERSION:-"1.18"} +CLUSTER_VERSION=${CLUSTER_VERSION:-"1.19"} CLUSTER_INSTANCE_TYPE="m5.xlarge" CLUSTER_NODE_COUNT="4" CLUSTER_KUBECONFIG=${CLUSTER_KUBECONFIG:-"/tmp/lb-controller-e2e/clusters/${CLUSTER_NAME}.kubeconfig"} diff --git a/scripts/lib/eksctl.sh b/scripts/lib/eksctl.sh index 6647ad32a..ae95f55f3 100644 --- a/scripts/lib/eksctl.sh +++ b/scripts/lib/eksctl.sh @@ -21,7 +21,8 @@ EKSCTL_TEMPLATE_IAM_SA="$(dirname "${BASH_SOURCE[0]}")/eksctl_tmpl_iam_sa.yaml" eksctl::init() { declare -r version="$1" - local os_arch="$(go env GOOS)_$(go env GOARCH)" + local go_os="$(go env GOOS)" + local os_arch="$(echo ${go_os:0:1} | tr [a-z] [A-Z])${go_os:1}_$(go env GOARCH)" local eksctl_download_url="https://github.com/weaveworks/eksctl/releases/download/${version}/eksctl_${os_arch}.tar.gz" local eksctl_binary_dir=$(dirname $EKSCTL_BINARY) diff --git a/scripts/lib/eksctl_tmpl_cluster.yaml b/scripts/lib/eksctl_tmpl_cluster.yaml index 37b9ec454..42efa0c12 100644 --- a/scripts/lib/eksctl_tmpl_cluster.yaml +++ b/scripts/lib/eksctl_tmpl_cluster.yaml @@ -2,7 +2,7 @@ apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: cluster-name - version: "1.18" + version: "1.19" iam: withOIDC: true #vpc: diff --git a/test/e2e/ingress/multi_path_backend.go b/test/e2e/ingress/multi_path_backend.go index 8377bd77d..bf79ab6ca 100644 --- a/test/e2e/ingress/multi_path_backend.go +++ b/test/e2e/ingress/multi_path_backend.go @@ -3,10 +3,12 @@ package ingress import ( "context" "fmt" + "sync" + "github.com/aws/aws-sdk-go/aws" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/aws-load-balancer-controller/pkg/algorithm" @@ -14,7 +16,6 @@ import ( "sigs.k8s.io/aws-load-balancer-controller/test/framework" "sigs.k8s.io/aws-load-balancer-controller/test/framework/utils" "sigs.k8s.io/controller-runtime/pkg/client" - "sync" ) type PathConfig struct { @@ -254,11 +255,17 @@ func (s *multiPathBackendStack) buildIngressResource(ns *corev1.Namespace, ingID } for _, pathCFG := range ingCFG.PathCFGs { backendSVC := svcByBackendID[pathCFG.BackendID] + exact := networking.PathTypeExact ing.Spec.Rules[0].HTTP.Paths = append(ing.Spec.Rules[0].HTTP.Paths, networking.HTTPIngressPath{ Path: pathCFG.Path, + PathType: &exact, Backend: networking.IngressBackend{ - ServiceName: backendSVC.Name, - ServicePort: intstr.FromInt(80), + Service: &networking.IngressServiceBackend{ + Name: backendSVC.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, }, }) } diff --git a/test/e2e/ingress/resource_stack.go b/test/e2e/ingress/resource_stack.go index b4a273543..98ae9f7f1 100644 --- a/test/e2e/ingress/resource_stack.go +++ b/test/e2e/ingress/resource_stack.go @@ -4,7 +4,7 @@ import ( "context" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" "sigs.k8s.io/aws-load-balancer-controller/test/framework" "sigs.k8s.io/aws-load-balancer-controller/test/framework/utils" diff --git a/test/e2e/ingress/utils.go b/test/e2e/ingress/utils.go index 19407ab6c..c536b8c15 100644 --- a/test/e2e/ingress/utils.go +++ b/test/e2e/ingress/utils.go @@ -1,6 +1,6 @@ package ingress -import networking "k8s.io/api/networking/v1beta1" +import networking "k8s.io/api/networking/v1" func FindIngressDNSName(ing *networking.Ingress) string { for _, ingSTS := range ing.Status.LoadBalancer.Ingress { diff --git a/test/e2e/ingress/vanilla_ingress_test.go b/test/e2e/ingress/vanilla_ingress_test.go index 9b88fbd9b..c3f253d3e 100644 --- a/test/e2e/ingress/vanilla_ingress_test.go +++ b/test/e2e/ingress/vanilla_ingress_test.go @@ -11,10 +11,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" "sigs.k8s.io/aws-load-balancer-controller/test/framework" "sigs.k8s.io/aws-load-balancer-controller/test/framework/fixture" @@ -29,6 +28,8 @@ var _ = Describe("vanilla ingress tests", func() { sandboxNS *corev1.Namespace ) + exact := networking.PathTypeExact + BeforeEach(func() { ctx = context.Background() if tf.Options.ControllerImage != "" { @@ -72,7 +73,14 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ingClass := &networking.IngressClass{ ObjectMeta: metav1.ObjectMeta{ Name: sandboxNS.Name, @@ -82,7 +90,7 @@ var _ = Describe("vanilla ingress tests", func() { }, } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithIngressClassName(ingClass.Name). WithAnnotations(map[string]string{ "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -104,9 +112,16 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "alb", "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -130,7 +145,14 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ingClass := &networking.IngressClass{ ObjectMeta: metav1.ObjectMeta{ Name: sandboxNS.Name, @@ -140,7 +162,7 @@ var _ = Describe("vanilla ingress tests", func() { }, } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithIngressClassName(ingClass.Name). WithAnnotations(map[string]string{ "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -156,9 +178,16 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "nginx", "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -174,9 +203,16 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithAnnotations(map[string]string{ "alb.ingress.kubernetes.io/scheme": "internet-facing", }).Build(sandboxNS.Name, "ing") @@ -193,10 +229,17 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder() ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } lbName := fmt.Sprintf("%.16s-%.15s", tf.Options.ClusterName, sandboxNS.Name) ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "alb", "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -226,9 +269,16 @@ var _ = Describe("vanilla ingress tests", func() { appBuilder := manifest.NewFixedResponseServiceBuilder().WithTargetPortName("e2e-targetport") ingBuilder := manifest.NewIngressBuilder() dp, svc := appBuilder.Build(sandboxNS.Name, "app") - ingBackend := networking.IngressBackend{ServiceName: svc.Name, ServicePort: intstr.FromInt(80)} + ingBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: svc.Name, + Port: networking.ServiceBackendPort{ + Number: 80, + }, + }, + } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", Backend: ingBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/path", PathType: &exact, Backend: ingBackend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "alb", "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -255,15 +305,43 @@ var _ = Describe("vanilla ingress tests", func() { ingBuilder := manifest.NewIngressBuilder() dp1, svc1 := appBuilder.WithHTTPBody("app-1").Build(sandboxNS.Name, "app-1") dp2, svc2 := appBuilder.WithHTTPBody("app-2").Build(sandboxNS.Name, "app-2") - ingResponse503Backend := networking.IngressBackend{ServiceName: "response-503", ServicePort: intstr.FromString("use-annotation")} - ingRedirectToAWSBackend := networking.IngressBackend{ServiceName: "redirect-to-aws", ServicePort: intstr.FromString("use-annotation")} - ingForwardSingleTGBackend := networking.IngressBackend{ServiceName: "forward-single-tg", ServicePort: intstr.FromString("use-annotation")} - ingForwardMultipleTGBackend := networking.IngressBackend{ServiceName: "forward-multiple-tg", ServicePort: intstr.FromString("use-annotation")} + ingResponse503Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "response-503", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRedirectToAWSBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "redirect-to-aws", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingForwardSingleTGBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "forward-single-tg", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingForwardMultipleTGBackend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "forward-multiple-tg", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } ing := ingBuilder. - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/response-503", Backend: ingResponse503Backend}). - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/redirect-to-aws", Backend: ingRedirectToAWSBackend}). - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/forward-single-tg", Backend: ingForwardSingleTGBackend}). - AddHTTPRoute("", networking.HTTPIngressPath{Path: "/forward-multiple-tg", Backend: ingForwardMultipleTGBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/response-503", PathType: &exact, Backend: ingResponse503Backend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/redirect-to-aws", PathType: &exact, Backend: ingRedirectToAWSBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/forward-single-tg", PathType: &exact, Backend: ingForwardSingleTGBackend}). + AddHTTPRoute("", networking.HTTPIngressPath{Path: "/forward-multiple-tg", PathType: &exact, Backend: ingForwardMultipleTGBackend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "alb", "alb.ingress.kubernetes.io/scheme": "internet-facing", @@ -298,22 +376,71 @@ var _ = Describe("vanilla ingress tests", func() { Context("with `alb.ingress.kubernetes.io/conditions.${conditions-name}` variant settings", func() { It("with annotation based conditions, one ALB shall be created and functional", func() { ingBuilder := manifest.NewIngressBuilder() - ingRulePath1Backend := networking.IngressBackend{ServiceName: "rule-path1", ServicePort: intstr.FromString("use-annotation")} - ingRulePath2Backend := networking.IngressBackend{ServiceName: "rule-path2", ServicePort: intstr.FromString("use-annotation")} - ingRulePath3Backend := networking.IngressBackend{ServiceName: "rule-path3", ServicePort: intstr.FromString("use-annotation")} - ingRulePath4Backend := networking.IngressBackend{ServiceName: "rule-path4", ServicePort: intstr.FromString("use-annotation")} - ingRulePath5Backend := networking.IngressBackend{ServiceName: "rule-path5", ServicePort: intstr.FromString("use-annotation")} - ingRulePath6Backend := networking.IngressBackend{ServiceName: "rule-path6", ServicePort: intstr.FromString("use-annotation")} - ingRulePath7Backend := networking.IngressBackend{ServiceName: "rule-path7", ServicePort: intstr.FromString("use-annotation")} + ingRulePath1Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path1", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath2Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path2", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath3Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path3", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath4Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path4", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath5Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path5", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath6Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path6", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } + ingRulePath7Backend := networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: "rule-path7", + Port: networking.ServiceBackendPort{ + Name: "use-annotation", + }, + }, + } ing := ingBuilder. - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path1", Backend: ingRulePath1Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path2", Backend: ingRulePath2Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path3", Backend: ingRulePath3Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path4", Backend: ingRulePath4Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path5", Backend: ingRulePath5Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path6", Backend: ingRulePath6Backend}). - AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path7", Backend: ingRulePath7Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path1", PathType: &exact, Backend: ingRulePath1Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path2", PathType: &exact, Backend: ingRulePath2Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path3", PathType: &exact, Backend: ingRulePath3Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path4", PathType: &exact, Backend: ingRulePath4Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path5", PathType: &exact, Backend: ingRulePath5Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path6", PathType: &exact, Backend: ingRulePath6Backend}). + AddHTTPRoute("www.example.com", networking.HTTPIngressPath{Path: "/path7", PathType: &exact, Backend: ingRulePath7Backend}). WithAnnotations(map[string]string{ "kubernetes.io/ingress.class": "alb", "alb.ingress.kubernetes.io/scheme": "internet-facing", diff --git a/test/framework/manifest/ingress_builder.go b/test/framework/manifest/ingress_builder.go index ba10120fc..0e4ed4e63 100644 --- a/test/framework/manifest/ingress_builder.go +++ b/test/framework/manifest/ingress_builder.go @@ -1,7 +1,7 @@ package manifest import ( - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/test/framework/resources/k8s/ingresses.go b/test/framework/resources/k8s/ingresses.go index 4265d34f1..2535e84f5 100644 --- a/test/framework/resources/k8s/ingresses.go +++ b/test/framework/resources/k8s/ingresses.go @@ -3,7 +3,7 @@ package k8s import ( "context" "github.com/go-logr/logr" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/aws-load-balancer-controller/pkg/k8s" diff --git a/webhooks/networking/ingress_validator.go b/webhooks/networking/ingress_validator.go index 14efe5bae..7f1e85585 100644 --- a/webhooks/networking/ingress_validator.go +++ b/webhooks/networking/ingress_validator.go @@ -2,10 +2,11 @@ package networking import ( "context" + awssdk "github.com/aws/aws-sdk-go/aws" "github.com/go-logr/logr" "github.com/pkg/errors" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/aws-load-balancer-controller/pkg/annotations" "sigs.k8s.io/aws-load-balancer-controller/pkg/config" @@ -17,7 +18,7 @@ import ( ) const ( - apiPathValidateNetworkingIngress = "/validate-networking-v1beta1-ingress" + apiPathValidateNetworkingIngress = "/validate-networking-v1-ingress" ) // NewIngressValidator returns a validator for Ingress API. @@ -163,7 +164,7 @@ func (v *ingressValidator) checkIngressClassUsage(ctx context.Context, ing *netw return nil } -// +kubebuilder:webhook:path=/validate-networking-v1beta1-ingress,mutating=false,failurePolicy=fail,groups=networking.k8s.io,resources=ingresses,verbs=create;update,versions=v1beta1,name=vingress.elbv2.k8s.aws,sideEffects=None,matchPolicy=Equivalent,webhookVersions=v1,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:path=/validate-networking-v1-ingress,mutating=false,failurePolicy=fail,groups=networking.k8s.io,resources=ingresses,verbs=create;update,versions=v1,name=vingress.elbv2.k8s.aws,sideEffects=None,matchPolicy=Equivalent,webhookVersions=v1,admissionReviewVersions=v1beta1 func (v *ingressValidator) SetupWithManager(mgr ctrl.Manager) { mgr.GetWebhookServer().Register(apiPathValidateNetworkingIngress, webhook.ValidatingWebhookForValidator(v)) diff --git a/webhooks/networking/ingress_validator_test.go b/webhooks/networking/ingress_validator_test.go index 56cbff68a..89141658a 100644 --- a/webhooks/networking/ingress_validator_test.go +++ b/webhooks/networking/ingress_validator_test.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - networking "k8s.io/api/networking/v1beta1" + networking "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme"