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

Do not overwrite deployment status when reconciling #6302

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

pebrc
Copy link
Collaborator

@pebrc pebrc commented Jan 10, 2023

Updating the deployment status should only be done by the deployment controller and not by the ECK operator.

@pebrc pebrc added >enhancement Enhancement of existing functionality v2.7.0 labels Jan 10, 2023
Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -71,7 +72,12 @@ func Reconcile(
return hash.GetTemplateHashLabel(reconciled.Labels) != hash.GetTemplateHashLabel(expected.Labels)
},
UpdateReconciled: func() {
expected.DeepCopyInto(reconciled)
// set expected annotations and labels, but don't remove existing ones
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's something I realised a while ago and forgot, but this change is not strictly required since the reconciler never updates the status: params.Client.Update(params.Context, params.Reconciled) here leaves the status untouched. I noticed it when I reverted the change to expected.DeepCopyInto(reconciled) and realised that the unit test still succeeded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's because my unit test was flawed 😞 I compared with a version of the Deployment that had not really been updated because the template hash was the same. With an additional assertion it fails as expected.

@pebrc pebrc merged commit a82fbca into elastic:main Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants