Allow configuring Custom Resources per cluster

Co-authored-by: Jamie Klassen <jklassen@vmware.com>
Signed-off-by: Andres Mauricio Gomez P <andmagom@outlook.com>
This commit is contained in:
Andres Mauricio Gomez P
2022-07-25 10:22:03 -05:00
parent 44b2669c9b
commit 6184f0a3c0
2 changed files with 12 additions and 8 deletions
@@ -211,19 +211,14 @@ export class KubernetesFanOutHandler {
entity,
auth,
}: KubernetesObjectsByEntity): Promise<ObjectsByEntityResponse> {
return this.fanOutRequests(
entity,
auth,
this.objectTypesToFetch,
this.customResources,
);
return this.fanOutRequests(entity, auth, this.objectTypesToFetch);
}
private async fanOutRequests(
entity: Entity,
auth: KubernetesRequestAuth,
objectTypesToFetch: Set<ObjectToFetch>,
customResources: CustomResourceMatcher[],
customResources?: CustomResourceMatcher[],
) {
const entityName =
entity.metadata?.annotations?.['backstage.io/kubernetes-id'] ||
@@ -254,7 +249,11 @@ export class KubernetesFanOutHandler {
clusterDetails: clusterDetailsItem,
objectTypesToFetch: objectTypesToFetch,
labelSelector,
customResources: customResources.map(c => ({
customResources: (
customResources ||
clusterDetailsItem.customResources ||
this.customResources
).map(c => ({
...c,
objectType: 'customresources',
})),
@@ -193,6 +193,11 @@ export interface ClusterDetails {
* @see dashboardApp
*/
dashboardParameters?: JsonObject;
/**
* Specifies which custom resources to look for when returning an entity's
* Kubernetes resources.
*/
customResources?: CustomResourceMatcher[];
}
/**