From b4101bb93488fad29a49ac6d9685dcbd83103951 Mon Sep 17 00:00:00 2001 From: Sridhar Gaddam Date: Thu, 23 Jan 2025 17:54:21 +0530 Subject: [PATCH 1/2] Disable imageDigest support in ztunnel controller Currently, we have some pending work with the ztunnel images that are used as imageDigests. Because of this, when deploying Ambient profile using the OSSM operator, the ztunnel pod fails to come up. This PR temporarily disables this functionality until proper support is implemented. Alternatives: 1. Default Image: If no image details are provided in the ZTunnel CR, the operator will use the default image from the helm chart. 2. Explicitly specify image details: Following a recent fix in the ztunnel controller (PR#568), users can specify image details within the ztunnel CR itself in one of the following ways. 2.1: ztunnel.spec.values.ztunnel.image 2.2: ztunnel.spec.values.global.hub/tag Fixes: https://github.com/istio-ecosystem/sail-operator/issues/581 Signed-off-by: Sridhar Gaddam --- controllers/ztunnel/ztunnel_controller.go | 11 ++++++++++- controllers/ztunnel/ztunnel_controller_test.go | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/ztunnel/ztunnel_controller.go b/controllers/ztunnel/ztunnel_controller.go index 0239c2ab32..2395607a30 100644 --- a/controllers/ztunnel/ztunnel_controller.go +++ b/controllers/ztunnel/ztunnel_controller.go @@ -139,7 +139,16 @@ func (r *Reconciler) installHelmChart(ctx context.Context, ztunnel *v1alpha1.ZTu userValues := ztunnel.Spec.Values // apply image digests from configuration, if not already set by user - userValues = applyImageDigests(ztunnel, userValues, config.Config) + // TODO: Revisit once we support ImageOverrides for ztunnel + // userValues = applyImageDigests(ztunnel, userValues, config.Config) + + if userValues == nil { + userValues = &v1alpha1.ZTunnelValues{} + } + + if userValues.ZTunnel == nil { + userValues.ZTunnel = &v1alpha1.ZTunnelConfig{} + } // apply userValues on top of defaultValues from profiles mergedHelmValues, err := istiovalues.ApplyProfilesAndPlatform( diff --git a/controllers/ztunnel/ztunnel_controller_test.go b/controllers/ztunnel/ztunnel_controller_test.go index fc1168f0e0..ff4cbbe676 100644 --- a/controllers/ztunnel/ztunnel_controller_test.go +++ b/controllers/ztunnel/ztunnel_controller_test.go @@ -338,7 +338,7 @@ func TestDetermineReadyCondition(t *testing.T) { } } -func TestApplyImageDigests(t *testing.T) { +func PTestApplyImageDigests(t *testing.T) { testCases := []struct { name string config config.OperatorConfig From 7ff1bd09629d3566a2ca0ad62cfffb59e47a93e0 Mon Sep 17 00:00:00 2001 From: Sridhar Gaddam Date: Fri, 24 Jan 2025 19:19:45 +0530 Subject: [PATCH 2/2] Use t.Skip() instead of Pending Signed-off-by: Sridhar Gaddam --- controllers/ztunnel/ztunnel_controller.go | 4 ++-- controllers/ztunnel/ztunnel_controller_test.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/ztunnel/ztunnel_controller.go b/controllers/ztunnel/ztunnel_controller.go index 2395607a30..04f9725c73 100644 --- a/controllers/ztunnel/ztunnel_controller.go +++ b/controllers/ztunnel/ztunnel_controller.go @@ -143,11 +143,11 @@ func (r *Reconciler) installHelmChart(ctx context.Context, ztunnel *v1alpha1.ZTu // userValues = applyImageDigests(ztunnel, userValues, config.Config) if userValues == nil { - userValues = &v1alpha1.ZTunnelValues{} + userValues = &v1.ZTunnelValues{} } if userValues.ZTunnel == nil { - userValues.ZTunnel = &v1alpha1.ZTunnelConfig{} + userValues.ZTunnel = &v1.ZTunnelConfig{} } // apply userValues on top of defaultValues from profiles diff --git a/controllers/ztunnel/ztunnel_controller_test.go b/controllers/ztunnel/ztunnel_controller_test.go index ff4cbbe676..c409e48667 100644 --- a/controllers/ztunnel/ztunnel_controller_test.go +++ b/controllers/ztunnel/ztunnel_controller_test.go @@ -338,7 +338,9 @@ func TestDetermineReadyCondition(t *testing.T) { } } -func PTestApplyImageDigests(t *testing.T) { +func TestApplyImageDigests(t *testing.T) { + t.Skip("https://github.com/istio-ecosystem/sail-operator/issues/581") + testCases := []struct { name string config config.OperatorConfig