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

Add support for federated services to the service mirror controller #13269

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

adleong
Copy link
Member

@adleong adleong commented Nov 5, 2024

When the service mirror controller detects a service in the remote cluster which matches the federated service selector (mirror.linkerd.io/federated=memeber by default), it will add that service to the federated service in the local cluster named <svc>-federated, creating this service if it does not already exist. To join a service to a federated service, it is added to the multicluster.linkerd.io/remote-discovery annotation on the federated service which contains a comma separated list of values in the form <svc>@<cluster>. When a remote service no longer exists or matches the federated service selector, it is removed from the federated service by removing it from the mutlicluster.linkerd.io/remote-discovery annotation.

We also add a new local-service-mirror deployment to the Linkerd-multicluster extension which watches the local cluster for any services which match the federated service selector. Any services in the local cluster which match will be added to the federated service by setting the mutlicluster.linkerd.io/local-discovery annotation on the federated service to the local service name.

Signed-off-by: Alex Leong <alex@buoyant.io>
@adleong adleong requested a review from a team as a code owner November 5, 2024 02:30
}
}

func (rcsw *RemoteClusterServiceWatcher) updateLinkStatus(statusSection, remoteName, namespace string, condition map[string]interface{}) error {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way we get types API for all that? Does it involve regenerating the clients code, etc. We should be able to get the statuses as go types into the API and no rely on the dynamic client? We have some prior art for the HTTPRoute I believe.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, we use the dynamic client for interacting with Link resources instead of the generated binding. I think we should migrate off the dynamic client and replace it with the generated bindings, but I didn't want to block this work on that.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that makes sense!

}
}

func (rcsw *RemoteClusterServiceWatcher) deleteLinkStatus(statusSection, remoteName, namespace string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment on types here. I think having explicit status types will simplify things quite a lot.

Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
Copy link
Member

@zaharidichev zaharidichev left a comment

Choose a reason for hiding this comment

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

LGTM pending integration tests fixes! Great work. Given the complexity of the feature I would strongly advice to add some tests even if they are smoky.

@adleong adleong merged commit 50b6a17 into main Nov 8, 2024
42 checks passed
@adleong adleong deleted the alex/federated branch November 8, 2024 17:34
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.

2 participants