Update plugins/kubernetes-backend/src/service/KubernetesFetcher.ts
Co-authored-by: Jamie Klassen <jamie.klassen@broadcom.com> Signed-off-by: Andrés Mauricio Gómez P <andmagom@outlook.com> Signed-off-by: Andres Mauricio Gomez P <andmagom@outlook.com>
This commit is contained in:
committed by
Andres Mauricio Gomez P
parent
73a5e1b0c5
commit
5e6f1706c1
@@ -219,9 +219,7 @@ export class KubernetesClientBasedFetcher implements KubernetesFetcher {
|
||||
|
||||
if (this.isServiceAccountAuthentication(authProvider, clusterDetails)) {
|
||||
[url, requestInit] = this.fetchArgsInCluster(credential);
|
||||
} else if (
|
||||
!this.isCredentialMissing(authProvider, credential)
|
||||
) {
|
||||
} else if (!this.isCredentialMissing(authProvider, credential)) {
|
||||
[url, requestInit] = this.fetchArgs(clusterDetails, credential);
|
||||
} else {
|
||||
return Promise.reject(
|
||||
@@ -255,14 +253,12 @@ export class KubernetesClientBasedFetcher implements KubernetesFetcher {
|
||||
);
|
||||
}
|
||||
|
||||
private isTokenOrClientCertificateAuthentication(
|
||||
private isCredentialMissing(
|
||||
authProvider: string,
|
||||
credential: KubernetesCredential,
|
||||
) {
|
||||
return (
|
||||
credential.type === 'bearer token' ||
|
||||
credential.type === 'x509 client certificate' ||
|
||||
authProvider === 'localKubectlProxy'
|
||||
authProvider !== 'localKubectlProxy' && credential.type === 'anonymous'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user