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:
@@ -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[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user