1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Use spec.serviceName as an externalIP if nothing else

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-10-29 09:33:34 -04:00
parent 9e2ee00974
commit a28e4031f2

View File

@ -53,7 +53,7 @@ export interface Service {
clusterIP: string;
clusterIPs?: string[];
externalTrafficPolicy?: string;
externalName: string;
externalName?: string;
loadBalancerIP?: string;
loadBalancerSourceRanges?: string[];
sessionAffinity: string;
@ -100,11 +100,19 @@ export class Service extends KubeObject {
getExternalIps() {
const lb = this.getLoadBalancer();
if (lb && lb.ingress) {
if (lb?.ingress) {
return lb.ingress.map(val => val.ip || val.hostname);
}
return this.spec.externalIPs || [];
if (Array.isArray(this.spec?.externalIPs)) {
return this.spec.externalIPs;
}
if (this.spec.externalName) {
return [this.spec.externalName];
}
return [];
}
getType() {