From f44d24333661f5d7d95487b55f358d1197e769be Mon Sep 17 00:00:00 2001 From: Chwila Date: Thu, 12 Dec 2024 16:13:33 +0100 Subject: [PATCH] Fix stuff, add debug print --- Makefile | 1 + internal/restarter/sidecars.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4f1ca4ed9..2745a6106 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate-integration-test-manifest: manifests kustomize module-version cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default -o tests/integration/steps/operator_generated_manifest.yaml + yq eval '(.spec.template.spec.containers[0].env //= []) += {"name": "DEBUG_PRINT_IOP", "value": "true"}' -i my-app-deployment.yaml .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. diff --git a/internal/restarter/sidecars.go b/internal/restarter/sidecars.go index 706670748..c7fe48563 100644 --- a/internal/restarter/sidecars.go +++ b/internal/restarter/sidecars.go @@ -3,7 +3,6 @@ package restarter import ( "context" "fmt" - "google.golang.org/protobuf/types/known/structpb" "strings" "github.com/kyma-project/istio/operator/internal/compatibility" @@ -68,7 +67,14 @@ func (s *SidecarsRestarter) Restart(ctx context.Context, istioCR *v1alpha2.Istio return described_errors.NewDescribedError(err, "Could not get Istio version from istio operator file"), false } - expectedImage := pods.NewSidecarImage(iop.Spec.Hub, iop.Spec.Tag.(*structpb.Value).GetStringValue()) + tag, ok := iop.Spec.Tag.(string) + if !ok { + ctrl.Log.Error(err, "Error getting Istio tag from istio operator file") + s.StatusHandler.SetCondition(istioCR, v1alpha2.NewReasonWithMessage(v1alpha2.ConditionReasonProxySidecarRestartFailed)) + return described_errors.NewDescribedError(err, "Could not get Istio tag from istio operator file"), false + } + + expectedImage := pods.NewSidecarImage(iop.Spec.Hub, tag) s.Log.Info("Running proxy sidecar reset", "expected image", expectedImage) err = gatherer.VerifyIstioPodsVersion(ctx, s.Client, istioImageVersion.Version())