From 39d2347e13246f0cf11c5194604dd84f48567b3f Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Tue, 21 May 2024 17:10:34 +0100 Subject: [PATCH] Throw DeprecatedOperandVersion event on upgrade --- .../pipeline/infinispan/handler/manage/conditions.go | 6 ++++++ pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/reconcile/pipeline/infinispan/handler/manage/conditions.go b/pkg/reconcile/pipeline/infinispan/handler/manage/conditions.go index 62b951d59..fb01a1d95 100644 --- a/pkg/reconcile/pipeline/infinispan/handler/manage/conditions.go +++ b/pkg/reconcile/pipeline/infinispan/handler/manage/conditions.go @@ -54,6 +54,12 @@ func OperatorStatusChecks(i *ispnv1.Infinispan, ctx pipeline.Context) { } // Pod name is changed, means operator restarted if i.Status.Operator.Pod != operatorPod { + if ctx.Operand().Deprecated { + msg := fmt.Sprintf("Infinispan version '%s' will be removed in a subsequent Operator release. You must upgrade to a non-deprecated release before upgrading the Operator.", i.Spec.Version) + ctx.EventRecorder().Event(i, corev1.EventTypeWarning, "DeprecatedOperandVersion", msg) + ctx.Log().Error(nil, msg) + } + if i.Spec.Autoscale != nil { errMsg := "Autoscale is no longer supported. Please remove spec.autoscale field." ctx.EventRecorder().Event(i, corev1.EventTypeWarning, "AutoscaleNotSupported", errMsg) diff --git a/pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go b/pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go index 68d16fc20..a229990ae 100644 --- a/pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go +++ b/pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go @@ -144,10 +144,9 @@ func (b *builder) Build() pipeline.Pipeline { handlers: make([]pipeline.HandlerFunc, 0), } - // Do operator status checks - handlers.Add(manage.OperatorStatusChecks) // Apply default meta before doing anything else handlers.Add(manage.InitialiseOperandVersion) + handlers.Add(manage.OperatorStatusChecks) handlers.Add(manage.PreliminaryChecks) // Provision/Remove the XSite service before performing configuration so that Remote site information can be retrieved