fix: allow missing k8s config in dev

Signed-off-by: Trevor Hartman <trevorhartman@gmail.com>
This commit is contained in:
Trevor Hartman
2022-02-14 15:11:15 -07:00
parent 40af72b95d
commit 64acf65c03
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes-backend': patch
---
Allow missing kubernetes config in development env
@@ -57,9 +57,21 @@ export class KubernetesBuilder {
public async build() {
const logger = this.env.logger;
const config = this.env.config;
logger.info('Initializing Kubernetes backend');
if (!config.has('kubernetes')) {
if (process.env.NODE_ENV !== 'development') {
throw new Error('Kubernetes configuration is missing');
}
logger.warn(
'Failed to initialize kubernetes backend: kubernetes config is missing',
);
return {
router: Router(),
};
}
const customResources = this.buildCustomResources();
const fetcher = this.fetcher ?? this.buildFetcher();