linkerd / linkerd/linkerd2

Enable multicluster service discovery with a single, cross-cluster service & endpoints

Open
#7,566 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs/design priority/triage
Dominant language
Go
Stars
11.5k
Forks
1.4k
Avg merge
3d 22h
Merged PRs (30d)
53

Description

### What problem are you trying to solve?

Presently when [deploying a multi-cluster resource such as CockroachD](https://github.com/AaronFriel/frielforreal/blob/791befef776b824c9e6c986f58f25b7dde4567eb/node/infra/src/stacks/app-cockroachdb/stack.ts#L67), aside from the issue in #7565, one has to perform certain contortions such as providing a list of other clusters to _each_ cluster. This places a dependency ordering on spinning up new clusters and a requirement for application operators to coordinate with cluster operators.

That is: For the crdb nodes in cluster `fit-loon` to discover the nodes in cluster `absolute-weevil`, they must _know_ (be configured) with the piece of data that `absolute-weevil` exists.[1]. See this requirement:

```ts

const ALL_CLUSTERS = [
'healthy-blowfish', // gke-gcp-us-west1-a-healthy-blowfish
'absolute-weevil', // lke47958-ctx
'fit-loon', // do-sfo3-cluster-a2427f2
'frank-grub', // aks-cluster895c8bcc
];
// ...
const ALL_SERVICES = ALL_CLUSTERS.filter((x) => x !== clusterName).map(
(otherClusterName) =>
`crdb-${otherClusterName}.cockroachdb-${otherClusterName}.svc.cluster.local`,
);
// ...
{ args: `
// ...
cockroach start \
--insecure \
--locality=cluster=${clusterName},node=${clusterName}-$POD_NAME \
--locality-advertise-addr=cluster=${clusterName}@"$(hostname -f)" \
--advertise-addr=$POD_NAME-${clusterName}.${namespaceName}.svc.cluster.local \
--join=crdb,${ALL_SERVICES.join(',')} \
--logtostderr=INFO;
`
```

It would be ideal if each cluster only needed to reference a common service, and like standard headless services, discover their peers _without_ knowledge of the names or even number of other clusters.

[1] For our purpose, let's suppose the cluster fit-loon doesn't presuppose Anselm's ontological argument for the existence of absolute weevil.

### How should the problem be solved?

There are a few ways to slice this:

### 1.

This becomes default behavior when `-enable-headless-services` is enabled on the service mirror, and the service mirror then attempts to _create or update_ the endpoints for a service with the same name.

Problem: That service will exist as a real Headless Service in each name with a selector, which may interfere with operation of the EndpointsController.

### 2.

Users could opt in to a shared, cross-cluster service by creating a Service of their own, with the intended name and in the intended namespace, and providing it with an annotation or label:

```yaml
metadata:
name: my-cross-cluster-service
labels/annotations:
mirror.linkerd.io/cross-cluster: $SERVICE_NAME
```

The service mirror would check if that service exists, and add to it all the endpoints of both the local _and_ remote clusters with the same service name.

### 3.

Users could opt in to a shared, cross-cluster service by providing an annotation on the service that is exported, indicating that the service mirror should maintain that shared resource:

```yaml
metadata:
name: my-service
labels/annotations:
mirror.linkerd.io/exported: true
mirror.linkerd.io/cross-cluster-name: foobar
```

The service mirrors in each cluster would then attempt to create, if it does not exist, a headless, selector-less service named `foobar`, and then attach to it all of the annotations for every service, in each cluster, named `my-service`.

### Any alternatives you've considered?

### 4.

Some more sophisticated approach?

### How would users interact with this feature?

This would be an important feature for cross-cluster service discovery, so I imagine it may eventually become a default (albeit opt-in per service?) function of the `-enable-headless-services` feature.

### Would you like to work on this feature?

Maybe?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the service mirror's handling of -enable-headless-services and the Kubernetes EndpointsController behavior described in the issue. Compare the three proposed opt-in or default designs and determine the resource and annotation semantics before implementation. Done means clusters can discover peers through one shared service without listing other cluster names or interfering with local endpoint reconciliation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.