8000 Add support for service-mirror selectors by adleong · Pull Request #4795 · linkerd/linkerd2 · GitHub
[go: up one dir, main page]

Skip to content

Add support for service-mirror selectors - #4795

Merged
adleong merged 2 commits into
mainfrom
alex/links-awakening
Jul 30, 2020
Merged

adleong merged 2 commits into
mainfrom
alex/links-awakening

Conversation

@adleong
@adleong adleong commented Jul 24, 2020
Copy link
Copy Markdown
Contributor

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
@zaharidichev zaharidichev left a comment
Copy link
Copy Markdown
Member

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

Comment thread pkg/multicluster/link.go
return Link{}, err
}

selector := metav1.LabelSelector{}
Copy link
Copy Markdown
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

@kleimkuhler kleimkuhler left a comment •
Copy link
Copy Markdown
Contributor

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

0