kubernetes-backend: fix reading credentials from undefined

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-04-02 10:59:39 +02:00
parent 5ab049066f
commit 9d89aed378
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes-backend': patch
---
Fixed a crash reading `credentials` from `undefined`.
@@ -52,7 +52,7 @@ export class CatalogClusterLocator implements KubernetesClustersSupplier {
return new CatalogClusterLocator(catalogApi, auth);
}
async getClusters(options: {
async getClusters(options?: {
credentials: BackstageCredentials;
}): Promise<ClusterDetails[]> {
const apiServerKey = `metadata.annotations.${ANNOTATION_KUBERNETES_API_SERVER}`;
@@ -71,7 +71,7 @@ export class CatalogClusterLocator implements KubernetesClustersSupplier {
{
filter: [filter],
},
options.credentials
options?.credentials
? {
token: (
await this.auth.getPluginRequestToken({