Skip to content

Commit

Permalink
Throw DeprecatedOperandVersion event on upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanemerson committed May 22, 2024
1 parent 4ca5194 commit 39d2347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions pkg/reconcile/pipeline/infinispan/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39d2347

Please sign in to comment.