Skip to content

Commit

Permalink
Add Condition when minor update is available
Browse files Browse the repository at this point in the history
When there is a new AvailableVersion, which does not match the
Deployed version, this adds a condition to reflect this. This
can be used e.g. in CI to wait for the new AvailableVersion to
be reflected when the OpenStackVersion was patched. But could
be useful for other situations.

Signed-off-by: Martin Schuppert <[email protected]>
  • Loading branch information
stuggi committed Dec 4, 2024
1 parent 25aa758 commit e06bb9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apis/core/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ const (
OpenStackVersionMinorUpdateControlplane condition.Type = "MinorUpdateControlplane"

OpenStackVersionMinorUpdateDataplane condition.Type = "MinorUpdateDataplane"

OpenStackVersionMinorUpdateAvailable condition.Type = "MinorUpdateAvailable"
)

// Version Messages used by API objects.
Expand Down Expand Up @@ -506,4 +508,7 @@ const (

// OpenStackVersionMinorUpdateReadyErrorMessage
OpenStackVersionMinorUpdateReadyErrorMessage = "error occured %s"

// OpenStackVersionMinorUpdateAvailableMessage
OpenStackVersionMinorUpdateAvailableMessage = "update available"
)
7 changes: 7 additions & 0 deletions controllers/core/openstackversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
Log.Info("Setting DeployedVersion")
instance.Status.DeployedVersion = &instance.Spec.TargetVersion
}
if *instance.Status.AvailableVersion != *instance.Status.DeployedVersion {
instance.Status.Conditions.Set(condition.TrueCondition(
corev1beta1.OpenStackVersionMinorUpdateAvailable,
corev1beta1.OpenStackVersionMinorUpdateAvailableMessage))
} else {
instance.Status.Conditions.Remove(corev1beta1.OpenStackVersionMinorUpdateAvailable)
}

return ctrl.Result{}, nil
}
Expand Down

0 comments on commit e06bb9d

Please sign in to comment.