Merge pull request #26223 from awanlin/topic/skip-start-without-config
[Kubernetes] Skip start without config
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-backend': patch
|
||||
---
|
||||
|
||||
Skip start without proper config
|
||||
@@ -193,27 +193,33 @@ export const kubernetesPlugin = createBackendPlugin({
|
||||
auth,
|
||||
httpAuth,
|
||||
}) {
|
||||
// TODO: expose all of the customization & extension points of the builder here
|
||||
const builder: KubernetesBuilder = KubernetesBuilder.createBuilder({
|
||||
logger,
|
||||
config,
|
||||
catalogApi,
|
||||
permissions,
|
||||
discovery,
|
||||
auth,
|
||||
httpAuth,
|
||||
})
|
||||
.setObjectsProvider(extPointObjectsProvider.getObjectsProvider())
|
||||
.setClusterSupplier(extPointClusterSuplier.getClusterSupplier())
|
||||
.setFetcher(extPointFetcher.getFetcher())
|
||||
.setServiceLocator(extPointServiceLocator.getServiceLocator());
|
||||
if (config.has('kubernetes')) {
|
||||
// TODO: expose all of the customization & extension points of the builder here
|
||||
const builder: KubernetesBuilder = KubernetesBuilder.createBuilder({
|
||||
logger,
|
||||
config,
|
||||
catalogApi,
|
||||
permissions,
|
||||
discovery,
|
||||
auth,
|
||||
httpAuth,
|
||||
})
|
||||
.setObjectsProvider(extPointObjectsProvider.getObjectsProvider())
|
||||
.setClusterSupplier(extPointClusterSuplier.getClusterSupplier())
|
||||
.setFetcher(extPointFetcher.getFetcher())
|
||||
.setServiceLocator(extPointServiceLocator.getServiceLocator());
|
||||
|
||||
AuthStrategy.addAuthStrategiesFromArray(
|
||||
extPointAuthStrategy.getAuthenticationStrategies(),
|
||||
builder,
|
||||
);
|
||||
const { router } = await builder.build();
|
||||
http.use(router);
|
||||
AuthStrategy.addAuthStrategiesFromArray(
|
||||
extPointAuthStrategy.getAuthenticationStrategies(),
|
||||
builder,
|
||||
);
|
||||
const { router } = await builder.build();
|
||||
http.use(router);
|
||||
} else {
|
||||
logger.warn(
|
||||
'Failed to initialize kubernetes backend: valid kubernetes config is missing',
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -728,6 +728,19 @@ metadata:
|
||||
const throwError = () =>
|
||||
startTestBackend({
|
||||
features: [
|
||||
mockServices.rootConfig.factory({
|
||||
data: {
|
||||
kubernetes: {
|
||||
serviceLocatorMethod: { type: 'multiTenant' },
|
||||
clusterLocatorMethods: [
|
||||
{
|
||||
type: 'config',
|
||||
clusters: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
import('@backstage/plugin-kubernetes-backend/alpha'),
|
||||
createBackendModule({
|
||||
pluginId: 'kubernetes',
|
||||
|
||||
Reference in New Issue
Block a user