diff --git a/.changeset/rich-mayflies-do.md b/.changeset/rich-mayflies-do.md new file mode 100644 index 0000000000..d68e00c0aa --- /dev/null +++ b/.changeset/rich-mayflies-do.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes-backend': patch +--- + +Fixes bug reading ExternalId from k8s backend config diff --git a/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.test.ts b/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.test.ts index 1642ca5580..dac96e4cef 100644 --- a/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.test.ts +++ b/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.test.ts @@ -115,6 +115,14 @@ describe('ConfigClusterLocator', () => { authProvider: 'aws', skipTLSVerify: true, }, + { + assumeRole: 'SomeRole', + name: 'cluster2', + externalId: 'SomeExternalId', + url: 'http://localhost:8081', + authProvider: 'aws', + skipTLSVerify: true, + }, ], }); @@ -127,6 +135,7 @@ describe('ConfigClusterLocator', () => { assumeRole: undefined, name: 'cluster1', serviceAccountToken: 'token', + externalId: undefined, url: 'http://localhost:8080', authProvider: 'aws', skipTLSVerify: false, @@ -134,11 +143,21 @@ describe('ConfigClusterLocator', () => { { assumeRole: 'SomeRole', name: 'cluster2', + externalId: undefined, serviceAccountToken: undefined, url: 'http://localhost:8081', authProvider: 'aws', skipTLSVerify: true, }, + { + assumeRole: 'SomeRole', + name: 'cluster2', + externalId: 'SomeExternalId', + url: 'http://localhost:8081', + serviceAccountToken: undefined, + authProvider: 'aws', + skipTLSVerify: true, + }, ]); }); }); diff --git a/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.ts b/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.ts index 2899445b2a..8352db6754 100644 --- a/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.ts +++ b/plugins/kubernetes-backend/src/cluster-locator/ConfigClusterLocator.ts @@ -44,7 +44,9 @@ export class ConfigClusterLocator implements KubernetesClustersSupplier { } case 'aws': { const assumeRole = c.getOptionalString('assumeRole'); - return { assumeRole, ...clusterDetails }; + const externalId = c.getOptionalString('externalId'); + + return { assumeRole, externalId, ...clusterDetails }; } case 'serviceAccount': { return clusterDetails;