Skip to content

Commit

Permalink
Merge pull request #3407 from oliviassss/e2e-nlb-instance
Browse files Browse the repository at this point in the history
enable nlb-instance e2e tests for ipv6
  • Loading branch information
k8s-ci-robot authored Sep 29, 2023
2 parents e4e6d90 + 09604a1 commit db44beb
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions test/e2e/service/nlb_instance_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit db44beb

Please sign in to comment.