From 09604a19ca478c7e147ee4780de1348278728159 Mon Sep 17 00:00:00 2001 From: oliviassss Date: Wed, 13 Sep 2023 14:55:51 -0700 Subject: [PATCH] enable nlb-instance e2e tests for ipv6 --- test/e2e/service/nlb_instance_target_test.go | 36 +++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/test/e2e/service/nlb_instance_target_test.go b/test/e2e/service/nlb_instance_target_test.go index ffcde6f74..54fe833d1 100644 --- a/test/e2e/service/nlb_instance_target_test.go +++ b/test/e2e/service/nlb_instance_target_test.go @@ -29,9 +29,16 @@ var _ = Describe("test k8s service reconciled by the aws load balancer controlle Expect(err).NotTo(HaveOccurred()) }) Context("with NLB instance target configuration", func() { + annotation := make(map[string]string) + BeforeEach(func() { + if tf.Options.IPFamily == "IPv6" { + annotation["service.beta.kubernetes.io/aws-load-balancer-ip-address-type"] = "dualstack" + } + }) It("should provision internet-facing load balancer resources", func() { + annotation["service.beta.kubernetes.io/aws-load-balancer-scheme"] = "internet-facing" By("deploying stack", func() { - err := stack.Deploy(ctx, tf, nil) + err := stack.Deploy(ctx, tf, annotation) Expect(err).NotTo(HaveOccurred()) }) @@ -156,9 +163,8 @@ var _ = Describe("test k8s service reconciled by the aws load balancer controlle }) It("should provision internal load-balancer resources", func() { By("deploying stack", func() { - err := stack.Deploy(ctx, tf, map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-scheme": "internal", - }) + annotation["service.beta.kubernetes.io/aws-load-balancer-scheme"] = "internal" + err := stack.Deploy(ctx, tf, annotation) Expect(err).NotTo(HaveOccurred()) }) By("checking service status for lb dns name", func() { @@ -217,9 +223,9 @@ var _ = Describe("test k8s service reconciled by the aws load balancer controlle Skip("Skipping tests, certificates not specified") } By("deploying stack", func() { - err := stack.Deploy(ctx, tf, map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-ssl-cert": tf.Options.CertificateARNs, - }) + annotation["service.beta.kubernetes.io/aws-load-balancer-ssl-cert"] = tf.Options.CertificateARNs + annotation["service.beta.kubernetes.io/aws-load-balancer-scheme"] = "internet-facing" + err := stack.Deploy(ctx, tf, annotation) Expect(err).NotTo(HaveOccurred()) }) By("checking service status for lb dns name", func() { @@ -280,9 +286,8 @@ var _ = Describe("test k8s service reconciled by the aws load balancer controlle }) It("should enable proxy protocol v2", func() { By("deploying stack", func() { - err := stack.Deploy(ctx, tf, map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol": "*", - }) + annotation["service.beta.kubernetes.io/aws-load-balancer-proxy-protocol"] = "*" + err := stack.Deploy(ctx, tf, annotation) Expect(err).ToNot(HaveOccurred()) dnsName = stack.GetLoadBalancerIngressHostName() Expect(dnsName).ToNot(BeEmpty()) @@ -316,11 +321,16 @@ var _ = Describe("test k8s service reconciled by the aws load balancer controlle }) Context("with NLB instance target configuration with target node labels", func() { + annotation := make(map[string]string) + BeforeEach(func() { + if tf.Options.IPFamily == "IPv6" { + annotation["service.beta.kubernetes.io/aws-load-balancer-ip-address-type"] = "dualstack" + } + }) It("should add only the labelled nodes to the target group", func() { By("deploying stack", func() { - err := stack.Deploy(ctx, tf, map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-target-node-labels": "service.node.label/key1=value1", - }) + annotation["service.beta.kubernetes.io/aws-load-balancer-target-node-labels"] = "service.node.label/key1=value1" + err := stack.Deploy(ctx, tf, annotation) Expect(err).ToNot(HaveOccurred()) dnsName = stack.GetLoadBalancerIngressHostName() Expect(dnsName).ToNot(BeEmpty())