Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reset deployment status when generation has not changed #1264

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions controllers/dataplane/openstackdataplanenodeset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,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 @@ -381,7 +385,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 @@ -460,6 +464,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req

func checkDeployment(ctx context.Context, helper *helper.Helper,
instance *dataplanev1.OpenStackDataPlaneNodeSet,
generationChanged bool,
bshephar marked this conversation as resolved.
Show resolved Hide resolved
) (bool, bool, bool, string, error) {
// Get all completed deployments
var failedDeployment string
Expand Down Expand Up @@ -514,7 +519,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
bshephar marked this conversation as resolved.
Show resolved Hide resolved
// 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
Loading