chore: update docs and fix naming

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-08-19 09:40:21 +02:00
parent 6ab6e5c2bf
commit 85e6fa20a7
3 changed files with 18 additions and 4 deletions
+17 -3
View File
@@ -87,6 +87,7 @@ import {
ClusterDetails,
KubernetesClustersSupplier,
kubernetesClusterSupplierExtensionPoint,
kubernetesServiceLocatorExtensionPoint,
} from '@backstage/plugin-kubernetes-node';
export class CustomClustersSupplier implements KubernetesClustersSupplier {
@@ -119,12 +120,25 @@ export const kubernetesModuleCustomClusterDiscovery = createBackendModule({
register(env) {
env.registerInit({
deps: {
kubernetes: kubernetesClusterSupplierExtensionPoint,
clusterSupplier: kubernetesClusterSupplierExtensionPoint,
serviceLocator: kubernetesServiceLocatorExtensionPoint,
},
async init({ kubernetes }) {
kubernetes.addClusterSupplier(
async init({ clusterSupplier }) {
clusterSupplier.addClusterSupplier(
CustomClustersSupplier.create(Duration.fromObject({ minutes: 60 })),
);
// there's also the ability to get access to some of the default implementations of the extension points where
// neccessary:
serviceLocator.addServiceLocator(
async ({ getDefault, clusterSupplier }) => {
// get access to the default service locator:
const defaultImplementation = await getDefault();
// build your own with the clusterSupplier dependency:
return MyNewServiceLocator({ clusterSupplier });
},
);
},
});
},