Merge pull request #6891 from RoadieHQ/read-external-id-from-config

Kubenetes-backend: Retrieve the externalId from the config
This commit is contained in:
Johan Haals
2021-08-24 13:31:19 +02:00
committed by GitHub
3 changed files with 27 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes-backend': patch
---
Fixes bug reading ExternalId from k8s backend config
@@ -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,
},
]);
});
});
@@ -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;