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 service-mirror selectors #4795

Merged
merged 2 commits into from
Jul 30, 2020
Merged

Add support for service-mirror selectors #4795

merged 2 commits into from
Jul 30, 2020

Conversation

adleong
Copy link
Member

@adleong adleong commented Jul 24, 2020

Fixes #4481

We add support for the source cluster to now specify which services from the target cluster should be exported by using a
label selector rather than looking for the mirror.linkerd.io/gateway and mirror.linkerd.io/gateway-ns annotations. Further context for this change is described in linkerd/rfc#31

The Link resource spec now has a selector field which contains a label selector. All services in the target cluster which match this selector will be mirrored. This selector can be set by using the --selector flag to the multicluster link command and follows the same format as the --selector flag does in kubectl. The selector can alternatively be set by editing the Link resource directly. If the selector flag to multicluster link is left unspecified, it defaults to the selector: mirror.linkerd.io/exported.

Some example usage:

  1. Using the default selector:
linkerd --context=target multicluster link --cluster-name=foo | kubectl --context=source apply -f -
kubectl --context=target -n emojivoto label svc/web-svc mirror.linkerd.io/exported=true
# the web-svc service is now mirrored to the source cluster
  1. Using a custom selector
linkerd --context=target multicluster link --cluster-name=foo -l exportme=please | kubectl --context=source apply -f -
kubectl --context=target -n emojivoto label svc/web-svc exportme=please
# the web-svc service is now mirrored to the source cluster

@adleong adleong requested a review from a team as a code owner July 24, 2020 19:07
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! It is nice that this results in completely removing the export-service command

@@ -121,6 +123,18 @@ func NewLink(u unstructured.Unstructured) (Link, error) {
return Link{}, err
}

selector := metav1.LabelSelector{}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth putting a comment that this piece of code is to exercise the serde rountrip

Copy link
Contributor

@kleimkuhler kleimkuhler 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! Tested this locally with two k3d clusters and everything works as expected.

Edit: Also A+ branch name 👌

adleong added 2 commits July 28, 2020 14:47
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
@adleong adleong force-pushed the alex/links-awakening branch from dc3e053 to 6f63158 Compare July 28, 2020 21:48
@adleong adleong merged commit a1543b3 into main Jul 30, 2020
@adleong adleong deleted the alex/links-awakening branch July 30, 2020 17:07
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.

Service Selectors
3 participants