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

Allow version before 0.52 to upgrade #1126

Merged

Conversation

pureklkl
Copy link
Contributor

@pureklkl pureklkl commented Sep 24, 2022

resolves 1117.

I wrote a PoC e2e test, need suggestion on whether it should be included into the pipeline.

…/statefulset/daemonset will be deleted and a new one with updated selector will be created.
@pureklkl pureklkl requested a review from a team September 24, 2022 10:24
@pavolloffay
Copy link
Member

CI failed

@pureklkl
Copy link
Contributor Author

pureklkl commented Oct 3, 2022

CI failed

sure, realized it conflicted with other tests, I used a new obj and name to avoid it. I did not found it because I only tested on my IDE which ran one test at a time.

make test passed on my local now.

@pureklkl
Copy link
Contributor Author

pureklkl commented Oct 4, 2022

Hi @pavolloffay, may I get it reviewed? I am not sure about whether we want the e2e test for upgrading. I am ok to remove that part of change.

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

I like the e2e tests, could we test there that the matching labels were updated?

@@ -0,0 +1,15 @@
apiVersion: kuttl.dev/v1beta1
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add here some docs that explain why this test is there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment.

@@ -158,6 +158,11 @@ generate: controller-gen api-docs
e2e:
$(KUTTL) test

# end-to-end-test for testing upgrading
.PHONY: e2e-upgrade
e2e-upgrade:
Copy link
Member

Choose a reason for hiding this comment

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

is the upgrade test executed on the CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added.

@@ -70,6 +71,16 @@ func expectedDaemonSets(ctx context.Context, params Params, expected []appsv1.Da
return fmt.Errorf("failed to get: %w", err)
}

// Selector is an immutable field, if set, we cannot modify it otherwise we will face reconciliation error.
if !apiequality.Semantic.DeepEqual(desired.Spec.Selector, existing.Spec.Selector) {
params.Log.V(2).Info("Spec.Selector change detected, trying to delete, the new collector daemonset will be created in the next reconcile cycle", "daemonset.name", existing.Name, "daemonset.namespace", existing.Namespace)
Copy link
Member

Choose a reason for hiding this comment

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

When is the next reconcile loop?

Maybe we should be more explicit and force the creation and continue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since the operator is watching the delete event, the next loop will happen when the collector got deleted (you can try manually delete the deployment and operator created almost immediately). Normally we shall not do 2 updates at one time, which will generate extra events.

@pavolloffay pavolloffay mentioned this pull request Oct 10, 2022
3 tasks
@@ -0,0 +1,17 @@
# Make sure that the OT operator after upgrading itself, can upgrade the OT collectors without error.
# See issues 840 and 1117 for the bugs on upgrading OT operator.
Copy link
Member

Choose a reason for hiding this comment

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

Please use full links when mentioning issues/PRs.

I would prefer to be explicit there and document which upgrade version is tested and exactly why and for instance add link that caused the breaking change.

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, I added detailed comments here.

@pureklkl
Copy link
Contributor Author

could

kuttl cannot verify a label was deleted, and unfortunately, in this test, the "app.kubernetes.io/version" was removed. I can verify the "app.kubernetes.io/version" was there in the old version but I cannot verify it does not exists in the new version.

@pavolloffay pavolloffay merged commit d191ba1 into open-telemetry:main Oct 12, 2022
@svrnm
Copy link
Member

svrnm commented Oct 12, 2022

🎉

ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* when Spec.selector changed, since it is immutable, the old deployment/statefulset/daemonset will be deleted and a new one with updated selector will be created.

* add e2e test.

* address lint.

* add newline to end.

* add newline to end.

* add delete options to deployment and statefulset.

* remove unecessary propagation policy, the default background is working fine.

* Add unit test.

* revert accident change.

* remove timeout wait, don't 2 changes in one reconcile cycle.

* fix lint

* fix test, change name to isolate it from other tests.

* revert accident change.

* remove unsed constant.

* Add comment for explaining the upgrading e2e test.

* add e2e upgrade to workflow.

* Address comment, adding detail comments for e2e upgrade test.

* rever accident change.

Co-authored-by: Pavol Loffay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to upgrade the collector using operator before v0.52.0 to the newer version
3 participants