Skip to content

Commit 8a208ce

Browse files
authored
deployer: Respect GWP overrides for Istio integration (#11006)
Signed-off-by: timflannagan <timflannagan@gmail.com>
1 parent 7f6a212 commit 8a208ce

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

internal/kgateway/deployer/deployer_test.go

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,10 @@ var _ = Describe("Deployer", func() {
10761076
Repository: ptr.To("bar"),
10771077
Tag: ptr.To("baz"),
10781078
},
1079-
Ports: []corev1.ContainerPort{
1080-
{
1081-
Name: "foo",
1082-
ContainerPort: 80,
1083-
},
1084-
},
1079+
Ports: []corev1.ContainerPort{{
1080+
Name: "foo",
1081+
ContainerPort: 80,
1082+
}},
10851083
},
10861084
},
10871085
},
@@ -1450,6 +1448,23 @@ var _ = Describe("Deployer", func() {
14501448
}
14511449
}
14521450

1451+
By("validating the override values are set in the istio container")
1452+
Expect(istioProxyContainer.Env).To(ContainElement(corev1.EnvVar{
1453+
Name: "CA_ADDR",
1454+
Value: *inp.overrideGwp.Spec.Kube.Istio.IstioProxyContainer.IstioDiscoveryAddress,
1455+
ValueFrom: nil,
1456+
}))
1457+
Expect(istioProxyContainer.Env).To(ContainElement(corev1.EnvVar{
1458+
Name: "ISTIO_META_MESH_ID",
1459+
Value: *inp.overrideGwp.Spec.Kube.Istio.IstioProxyContainer.IstioMetaMeshId,
1460+
ValueFrom: nil,
1461+
}))
1462+
Expect(istioProxyContainer.Env).To(ContainElement(corev1.EnvVar{
1463+
Name: "ISTIO_META_CLUSTER_ID",
1464+
Value: *inp.overrideGwp.Spec.Kube.Istio.IstioProxyContainer.IstioMetaClusterId,
1465+
ValueFrom: nil,
1466+
}))
1467+
14531468
bootstrapCfg := objs.getEnvoyConfig(defaultNamespace, defaultConfigMapName)
14541469
clusters := bootstrapCfg.GetStaticResources().GetClusters()
14551470
Expect(clusters).ToNot(BeNil())

internal/kgateway/deployer/merge.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ func deepMergeIstioContainer(dst, src *v1alpha1.IstioContainer) *v1alpha1.IstioC
530530
if src == nil {
531531
return dst
532532
}
533-
534533
if dst == nil {
535534
return src
536535
}
@@ -543,20 +542,15 @@ func deepMergeIstioContainer(dst, src *v1alpha1.IstioContainer) *v1alpha1.IstioC
543542
dst.LogLevel = src.GetLogLevel()
544543
}
545544

546-
// Do not allow per-gateway overrides of these values if they are set in the default
547-
// GatewayParameters populated by helm values
548-
if dst.GetIstioDiscoveryAddress() == nil {
549-
// Doesn't matter if we're overriding empty with empty
545+
if src.GetIstioDiscoveryAddress() != nil {
550546
dst.IstioDiscoveryAddress = src.GetIstioDiscoveryAddress()
551547
}
552548

553-
if dst.GetIstioMetaMeshId() == nil {
554-
// Doesn't matter if we're overriding empty with empty
549+
if src.GetIstioMetaMeshId() != nil {
555550
dst.IstioMetaMeshId = src.GetIstioMetaMeshId()
556551
}
557552

558-
if dst.GetIstioMetaClusterId() == nil {
559-
// Doesn't matter if we're overriding empty with empty
553+
if src.GetIstioMetaClusterId() != nil {
560554
dst.IstioMetaClusterId = src.GetIstioMetaClusterId()
561555
}
562556

0 commit comments

Comments
 (0)