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

Fix DeploymentConfig idling #614

Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions controllers/idler/idler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ func (r *Reconciler) scaleDeploymentConfigToZero(ctx context.Context, namespace
return "", "", false, err
}
dc.Spec.Replicas = 0
dc.Spec.Paused = false
if err := r.AllNamespacesClient.Update(ctx, dc); err != nil {
return "", "", false, err
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/idler/idler_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ func preparePayloads(t *testing.T, r *Reconciler, namespace, namePrefix string,
// DeploymentConfig
dc := &openshiftappsv1.DeploymentConfig{
ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("%s%s-deploymentconfig", namePrefix, namespace), Namespace: namespace},
Spec: openshiftappsv1.DeploymentConfigSpec{Replicas: replicas},
Spec: openshiftappsv1.DeploymentConfigSpec{Replicas: replicas, Paused: true},
}
err = r.AllNamespacesClient.Create(context.TODO(), dc)
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions test/idler_assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (a *IdleablePayloadAssertion) DeploymentConfigScaledDown(deployment *opensh
err := a.client.Get(context.TODO(), types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, d)
require.NoError(a.t, err)
assert.Equal(a.t, int32(0), d.Spec.Replicas)
assert.False(a.t, d.Spec.Paused) // DeploymentConfig should be unpaused when scaling down so that the replicas update can be rolled out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we set it to true and then check it was reset to false? Otherwise the test would pass even if we don't reset it, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, added 9563449

Copy link
Contributor

@xcoulon xcoulon Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be set d.Spec.Paused to true in the tests, before running the idler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, added 9563449

return a
}

Expand Down
Loading