Skip to content

Conversation

MrFreezeex
Copy link
Member

@MrFreezeex MrFreezeex commented Sep 25, 2024

This commit refactors the MCS-API Service controller to only create the derived Services if the ServiceImport already exists.

Before this commit we had this notion of creating the derived Service if either the ServiceExport or the ServiceImport was created and depending if the ServiceExport is present marks the Service as shared. The aim was that the local Service endpoint would be accessible but not shared until the ServiceExport was created. Also the initial design of how exported Services info was shared in remote cluster was relying on adding those fields to serviceStore.ClusterService which required to always create
the derived Service.

However those assumptions does not make a lot of sense now that we have the full picture with the other controllers which rely on a specific MCS-API data structure different from serviceStore.ClusterService. Also this not in line with the fact that the derived Service should globally have the same behavior as we were including unexported local service endpoints.

@MrFreezeex MrFreezeex requested a review from a team as a code owner September 25, 2024 14:44
@MrFreezeex MrFreezeex requested a review from marseel September 25, 2024 14:44
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Sep 25, 2024
@MrFreezeex MrFreezeex force-pushed the svc-controller-headless-fix branch from dc0bb1d to c91dc0c Compare September 25, 2024 14:49
@MrFreezeex MrFreezeex changed the title clustermesh: fix creation/deletion loop of derived service clustermesh: fix creation/deletion loop of MCS-API derived service Sep 25, 2024
@MrFreezeex
Copy link
Member Author

/test

@marseel
Copy link
Contributor

marseel commented Sep 27, 2024

hey @MrFreezeex I was a bit short on cycles the last two days, I will get to the review of this PR early next week.

Copy link
Contributor

@marseel marseel left a comment

Choose a reason for hiding this comment

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

Looks, good, but before approving I have one question, which I don't understand.
Why the service reconciler needs serviceExport?
I can see it is used for ownerReference, but shouldn't the owner be ServiceImport?

@MrFreezeex
Copy link
Member Author

MrFreezeex commented Oct 1, 2024

Why the service reconciler needs serviceExport? I can see it is used for ownerReference, but shouldn't the owner be ServiceImport?

So hmm this derived service controller was supposed to create the derived service if there is either a ServiceExport or a ServiceImport (and adding the owner referrence to both if present at the last reconcile time) but in hindsight I am not entirely sure this a great idea anymore as it complexify the logic for not much and setting the shared annotation only if there is a ServiceExport as we currently do is not correct/not in line with what the other controllers are doing :/. Sooo let me rework a bit the logic here first. Thanks for the question prompting me to dig more into this :D.

@MrFreezeex MrFreezeex force-pushed the svc-controller-headless-fix branch 2 times, most recently from 1fb7ded to 6316d50 Compare October 1, 2024 17:34
@MrFreezeex MrFreezeex changed the title clustermesh: fix creation/deletion loop of MCS-API derived service clustermesh: refactor MCS-API derived service controller Oct 1, 2024
@MrFreezeex MrFreezeex force-pushed the svc-controller-headless-fix branch 2 times, most recently from 596680e to 6ebff1e Compare October 1, 2024 18:18
@MrFreezeex
Copy link
Member Author

/test

@MrFreezeex
Copy link
Member Author

cc @giorio94 in case you would like to review this as well

@MrFreezeex MrFreezeex requested a review from marseel October 1, 2024 19:11
@giorio94 giorio94 added area/clustermesh Relates to multi-cluster routing functionality in Cilium. release-note/misc This PR makes changes that have no direct user impact. labels Oct 2, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 2, 2024
Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

I've left a couple of comments inline, but overall looks good to me. I was also confused about the previous dependency on the service export when chatting yesterday with Marcel.

@MrFreezeex MrFreezeex force-pushed the svc-controller-headless-fix branch 3 times, most recently from a443702 to 397ad2d Compare October 2, 2024 08:55
This commit refactors the MCS-API Service controller to only create the
derived Services if the ServiceImport already exists.

Before this commit we had this notion of creating the derived Service if
either the ServiceExport or the ServiceImport was created and depending if the
ServiceExport is present marks the Service as shared. The aim was that
the local Service endpoint would be accessible but not shared until the
ServiceExport was created. Also the initial design of how exported
Services info was shared in remote cluster was relying on adding those
fields to `serviceStore.ClusterService` which required to always create
the derived Service.

However those assumptions does not make a lot of sense now that we have the
full picture with the other controllers which rely on a specific MCS-API data
structure different from `serviceStore.ClusterService`. Also this not in line
with the fact that the derived Service should globally have the same behavior
as we were including unexported local service endpoints.

Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
@MrFreezeex MrFreezeex force-pushed the svc-controller-headless-fix branch from 397ad2d to 1c64884 Compare October 2, 2024 08:56
Copy link
Contributor

@marseel marseel left a comment

Choose a reason for hiding this comment

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

Thanks for updating, as Marco already approved, feel free to run tests and it will get merged.

Now it looks more in line of what I was assuming I should see, although I am still missing how all of that fits into the bigger picture. Let's take it offline, I would love to understand it a bit better for the future :) I will start a thread on Slack.

@MrFreezeex
Copy link
Member Author

/test

@MrFreezeex
Copy link
Member Author

/ci-e2e-upgrade

@MrFreezeex
Copy link
Member Author

/ci-ginkgo

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Oct 2, 2024
@julianwiedmann julianwiedmann added this pull request to the merge queue Oct 3, 2024
Merged via the queue into cilium:main with commit 2abc31c Oct 3, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clustermesh Relates to multi-cluster routing functionality in Cilium. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants