From 81b9b67aaeb8b322960bf7ca555056fd7b5b3547 Mon Sep 17 00:00:00 2001 From: Sridhar Gaddam Date: Thu, 23 Jan 2025 17:54:21 +0530 Subject: [PATCH] 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 | 12 +++++++++++- controllers/ztunnel/ztunnel_controller_test.go | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/controllers/ztunnel/ztunnel_controller.go b/controllers/ztunnel/ztunnel_controller.go index 96ebad33b..7f4d7ed32 100644 --- a/controllers/ztunnel/ztunnel_controller.go +++ b/controllers/ztunnel/ztunnel_controller.go @@ -138,7 +138,17 @@ 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{} + } + + // set image digest unless any part of the image has been configured by the user + 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 5458253e4..f275460ea 100644 --- a/controllers/ztunnel/ztunnel_controller_test.go +++ b/controllers/ztunnel/ztunnel_controller_test.go @@ -337,7 +337,7 @@ func TestDetermineReadyCondition(t *testing.T) { } } -func TestApplyImageDigests(t *testing.T) { +func PTestApplyImageDigests(t *testing.T) { testCases := []struct { name string config config.OperatorConfig