@@ -70,7 +70,52 @@ var _ = Describe("vanilla ingress tests", func() {
70
70
})
71
71
72
72
Context ("with basic settings" , func () {
73
- It ("[ingress-class] with IngressClass configured with 'ingress.k8s.aws/alb' controller, one ALB shall be created and functional" , func () {
73
+ It ("[ingress-class] in IP mode, with IngressClass configured with 'ingress.k8s.aws/alb' controller, one ALB shall be created and functional" , func () {
74
+ appBuilder := manifest .NewFixedResponseServiceBuilder ()
75
+ ingBuilder := manifest .NewIngressBuilder ()
76
+ dp , svc := appBuilder .Build (sandboxNS .Name , "app" , tf .Options .TestImageRegistry )
77
+ ingBackend := networking.IngressBackend {
78
+ Service : & networking.IngressServiceBackend {
79
+ Name : svc .Name ,
80
+ Port : networking.ServiceBackendPort {
81
+ Number : 80 ,
82
+ },
83
+ },
84
+ }
85
+ ingClass := & networking.IngressClass {
86
+ ObjectMeta : metav1.ObjectMeta {
87
+ Name : sandboxNS .Name ,
88
+ },
89
+ Spec : networking.IngressClassSpec {
90
+ Controller : "ingress.k8s.aws/alb" ,
91
+ },
92
+ }
93
+ annotation := map [string ]string {
94
+ "alb.ingress.kubernetes.io/scheme" : "internet-facing" ,
95
+ "alb.ingress.kubernetes.io/target-type" : "ip" ,
96
+ }
97
+ if tf .Options .IPFamily == "IPv6" {
98
+ annotation ["alb.ingress.kubernetes.io/ip-address-type" ] = "dualstack"
99
+ }
100
+ ing := ingBuilder .
101
+ AddHTTPRoute ("" , networking.HTTPIngressPath {Path : "/path" , PathType : & exact , Backend : ingBackend }).
102
+ WithIngressClassName (ingClass .Name ).
103
+ WithAnnotations (annotation ).Build (sandboxNS .Name , "ing" )
104
+ resStack := fixture .NewK8SResourceStack (tf , dp , svc , ingClass , ing )
105
+ err := resStack .Setup (ctx )
106
+ Expect (err ).NotTo (HaveOccurred ())
107
+
108
+ defer resStack .TearDown (ctx )
109
+
110
+ lbARN , lbDNS := ExpectOneLBProvisionedForIngress (ctx , tf , ing )
111
+ // test traffic
112
+ ExpectLBDNSBeAvailable (ctx , tf , lbARN , lbDNS )
113
+ httpExp := httpexpect .New (tf .LoggerReporter , fmt .Sprintf ("http://%v" , lbDNS ))
114
+ httpExp .GET ("/path" ).Expect ().
115
+ Status (http .StatusOK ).
116
+ Body ().Equal ("Hello World!" )
117
+ })
118
+ It ("[ingress-class] in Instance mode, with IngressClass configured with 'ingress.k8s.aws/alb' controller, one ALB shall be created and functional" , func () {
74
119
appBuilder := manifest .NewFixedResponseServiceBuilder ()
75
120
ingBuilder := manifest .NewIngressBuilder ()
76
121
dp , svc := appBuilder .Build (sandboxNS .Name , "app" , tf .Options .TestImageRegistry )
@@ -95,7 +140,6 @@ var _ = Describe("vanilla ingress tests", func() {
95
140
}
96
141
if tf .Options .IPFamily == "IPv6" {
97
142
annotation ["alb.ingress.kubernetes.io/ip-address-type" ] = "dualstack"
98
- annotation ["alb.ingress.kubernetes.io/target-type" ] = "ip"
99
143
}
100
144
ing := ingBuilder .
101
145
AddHTTPRoute ("" , networking.HTTPIngressPath {Path : "/path" , PathType : & exact , Backend : ingBackend }).
@@ -116,7 +160,44 @@ var _ = Describe("vanilla ingress tests", func() {
116
160
Body ().Equal ("Hello World!" )
117
161
})
118
162
119
- It ("with 'kubernetes.io/ingress.class' annotation set to 'alb', one ALB shall be created and functional" , func () {
163
+ It ("ingress in IP mode, with 'kubernetes.io/ingress.class' annotation set to 'alb', one ALB shall be created and functional" , func () {
164
+ appBuilder := manifest .NewFixedResponseServiceBuilder ()
165
+ ingBuilder := manifest .NewIngressBuilder ()
166
+ dp , svc := appBuilder .Build (sandboxNS .Name , "app" , tf .Options .TestImageRegistry )
167
+ ingBackend := networking.IngressBackend {
168
+ Service : & networking.IngressServiceBackend {
169
+ Name : svc .Name ,
170
+ Port : networking.ServiceBackendPort {
171
+ Number : 80 ,
172
+ },
173
+ },
174
+ }
175
+ annotation := map [string ]string {
176
+ "kubernetes.io/ingress.class" : "alb" ,
177
+ "alb.ingress.kubernetes.io/scheme" : "internet-facing" ,
178
+ "alb.ingress.kubernetes.io/target-type" : "ip" ,
179
+ }
180
+ if tf .Options .IPFamily == "IPv6" {
181
+ annotation ["alb.ingress.kubernetes.io/ip-address-type" ] = "dualstack"
182
+ }
183
+ ing := ingBuilder .
184
+ AddHTTPRoute ("" , networking.HTTPIngressPath {Path : "/path" , PathType : & exact , Backend : ingBackend }).
185
+ WithAnnotations (annotation ).Build (sandboxNS .Name , "ing" )
186
+ resStack := fixture .NewK8SResourceStack (tf , dp , svc , ing )
187
+ err := resStack .Setup (ctx )
188
+ Expect (err ).NotTo (HaveOccurred ())
189
+
190
+ defer resStack .TearDown (ctx )
191
+
192
+ lbARN , lbDNS := ExpectOneLBProvisionedForIngress (ctx , tf , ing )
193
+ // test traffic
194
+ ExpectLBDNSBeAvailable (ctx , tf , lbARN , lbDNS )
195
+ httpExp := httpexpect .New (tf .LoggerReporter , fmt .Sprintf ("http://%v" , lbDNS ))
196
+ httpExp .GET ("/path" ).Expect ().
197
+ Status (http .StatusOK ).
198
+ Body ().Equal ("Hello World!" )
199
+ })
200
+ It ("ingress in Instance mode, with 'kubernetes.io/ingress.class' annotation set to 'alb', one ALB shall be created and functional" , func () {
120
201
appBuilder := manifest .NewFixedResponseServiceBuilder ()
121
202
ingBuilder := manifest .NewIngressBuilder ()
122
203
dp , svc := appBuilder .Build (sandboxNS .Name , "app" , tf .Options .TestImageRegistry )
@@ -134,7 +215,6 @@ var _ = Describe("vanilla ingress tests", func() {
134
215
}
135
216
if tf .Options .IPFamily == "IPv6" {
136
217
annotation ["alb.ingress.kubernetes.io/ip-address-type" ] = "dualstack"
137
- annotation ["alb.ingress.kubernetes.io/target-type" ] = "ip"
138
218
}
139
219
ing := ingBuilder .
140
220
AddHTTPRoute ("" , networking.HTTPIngressPath {Path : "/path" , PathType : & exact , Backend : ingBackend }).
0 commit comments