SingleTenant ServiceLocatorMethod for Kubernetes cluster by entity annotation (#20954)

* Filter Kubernetes cluster by entity annotation

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* Documentation updated

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* SingleTenantLocator implemented

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* API reports updated

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* spelling corrected

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* document updated and fixed review comments

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

---------

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
Deepankumar
2023-11-15 20:54:22 +01:00
committed by GitHub
parent dc24f7ffdf
commit 52050ada6e
7 changed files with 260 additions and 3 deletions
+19 -1
View File
@@ -51,11 +51,13 @@ kubernetes:
This configures how to determine which clusters a component is running in.
Currently, the only valid value is:
Valid values are:
- `multiTenant` - This configuration assumes that all components run on all the
provided clusters.
- `singleTenant` - This configuration assumes that current component run on one cluster in provided clusters.
### `clusterLocatorMethods`
This is an array used to determine where to retrieve cluster configuration from.
@@ -577,6 +579,22 @@ for more info.
'backstage.io/kubernetes-label-selector': 'app=my-app,component=front-end'
```
### Cluster Selection annotation
This is applicable only for `singleTenant` serviceLocatorMethod.
You can now select `single` kubernetes cluster that the entity is part-of from all your defined kubernetes clusters. To apply this use the following annotation.
SingleTenant Cluster:
```yaml
'backstage.io/kubernetes-cluster': dice-cluster
```
In the example above, we configured the "backstage.io/kubernetes-cluster" annotation on the entity `catalog-info.yaml` file to specify that the current component is running in a single cluster called "dice-cluster", so this cluster must have been specified in the `app-config.yaml`, under the Kubernetes clusters configuration (for more details, see [`Configuring Kubernetes clusters`](#configuring-kubernetes-clusters)).
If you do not specify the annotation by `default Backstage fetches all` defined Kubernetes cluster.
[1]: https://cloud.google.com/kubernetes-engine
[2]: https://cloud.google.com/docs/authentication/production#linux-or-macos
[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/