Merge pull request #23933 from backstage/rugvip/k8s-credentials

kubernetes-backend: fix reading credentials from undefined
This commit is contained in:
Patrik Oldsberg
2024-04-02 11:39:42 +02:00
committed by GitHub
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({