Skip to content

Commit

Permalink
Merge pull request #1264 from rabi/deployment_status
Browse files Browse the repository at this point in the history
Don't reset deployment status when generation has not changed
  • Loading branch information
openshift-merge-bot[bot] authored Jan 16, 2025
2 parents 4b381f5 + 29c1ee2 commit 851e9a2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions controllers/dataplane/openstackdataplanenodeset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
// this reconcile loop.
instance.InitConditions()
// Set ObservedGeneration since we've reset conditions
instance.Status.ObservedGeneration = instance.Generation
var generationChanged bool
if instance.Generation != instance.Status.ObservedGeneration {
instance.Status.ObservedGeneration = instance.Generation
generationChanged = true
}

// Always patch the instance status when exiting this function so we can persist any changes.
defer func() { // update the Ready condition based on the sub conditions
Expand Down Expand Up @@ -382,7 +386,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
}

isDeploymentReady, isDeploymentRunning, isDeploymentFailed, failedDeployment, err := checkDeployment(
ctx, helper, instance)
ctx, helper, instance, generationChanged)
if !isDeploymentFailed && err != nil {
instance.Status.Conditions.MarkFalse(
condition.DeploymentReadyCondition,
Expand Down Expand Up @@ -461,6 +465,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req

func checkDeployment(ctx context.Context, helper *helper.Helper,
instance *dataplanev1.OpenStackDataPlaneNodeSet,
generationChanged bool,
) (bool, bool, bool, string, error) {
// Get all completed deployments
var failedDeployment string
Expand Down Expand Up @@ -515,7 +520,12 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
} else if deploymentConditions.IsFalse(dataplanev1.NodeSetDeploymentReadyCondition) {
isDeploymentRunning = true
} else if deploymentConditions.IsTrue(dataplanev1.NodeSetDeploymentReadyCondition) {
if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash {
// If the nodeset configHash does not match with what's in the deployment and the
// generation metadata has changed i.e generation metatdata won't change when
// fields are removed from the CRD during an update that would not require a new
// deployment to run).
if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash &&
generationChanged {
continue
}
isDeploymentReady = true
Expand Down

0 comments on commit 851e9a2

Please sign in to comment.