File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
internal/controller/provisioner Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -781,7 +781,7 @@ func (p *NginxProvisioner) buildNginxPodTemplateSpec(
781
781
container .Args = append (container .Args , "debug" )
782
782
}
783
783
784
- if containerSpec .HostPort != nil && containerSpec .HostPort .Enable && len (container .Ports ) > 1 {
784
+ if containerSpec .HostPort != nil && containerSpec .HostPort .Enable && len (container .Ports ) > 0 {
785
785
container .Ports [0 ].HostPort = containerSpec .HostPort .Port
786
786
}
787
787
Original file line number Diff line number Diff line change @@ -257,6 +257,9 @@ func TestBuildNginxResourceObjects_NginxProxyConfig(t *testing.T) {
257
257
Name : "gw" ,
258
258
Namespace : "default" ,
259
259
},
260
+ Spec : gatewayv1.GatewaySpec {
261
+ Listeners : []gatewayv1.Listener {},
262
+ },
260
263
}
261
264
262
265
resourceName := "gw-nginx"
@@ -293,6 +296,7 @@ func TestBuildNginxResourceObjects_NginxProxyConfig(t *testing.T) {
293
296
corev1 .ResourceCPU : resource.Quantity {Format : "100m" },
294
297
},
295
298
},
299
+ HostPort : & ngfAPIv1alpha2.HostPort {Enable : true , Port : int32 (8443 )},
296
300
},
297
301
},
298
302
},
@@ -338,6 +342,7 @@ func TestBuildNginxResourceObjects_NginxProxyConfig(t *testing.T) {
338
342
g .Expect (container .Ports ).To (ContainElement (corev1.ContainerPort {
339
343
ContainerPort : 8080 ,
340
344
Name : "metrics" ,
345
+ HostPort : int32 (8443 ),
341
346
}))
342
347
343
348
g .Expect (container .Image ).To (Equal ("nginx-repo:1.1.1" ))
You can’t perform that action at this time.
0 commit comments