diff --git a/core/src/plugins/kubernetes/nginx/ingress-controller.ts b/core/src/plugins/kubernetes/nginx/ingress-controller.ts index 4259a2df1c..b24dce061e 100644 --- a/core/src/plugins/kubernetes/nginx/ingress-controller.ts +++ b/core/src/plugins/kubernetes/nginx/ingress-controller.ts @@ -14,13 +14,18 @@ import { Microk8sGardenIngressController } from "./nginx-microk8s.js" import { MinikubeGardenIngressController } from "./nginx-minikube.js" import { KindGardenIngressController } from "./nginx-kind.js" import { EphemeralHelmGardenIngressController } from "./nginx-helm-ephemeral.js" +import type { DeployState } from "../../../types/service.js" export abstract class GardenIngressController { abstract install(ctx: KubernetesPluginContext, log: Log): Promise abstract uninstall(ctx: KubernetesPluginContext, log: Log): Promise - abstract ready(ctx: KubernetesPluginContext, log: Log): Promise + async ready(ctx: KubernetesPluginContext, log: Log): Promise { + return (await this.getStatus(ctx, log)) === "ready" + } + + abstract getStatus(ctx: KubernetesPluginContext, log: Log): Promise } export function getGardenIngressController(ctx: KubernetesPluginContext): GardenIngressController | undefined { diff --git a/core/src/plugins/kubernetes/nginx/nginx-kind.ts b/core/src/plugins/kubernetes/nginx/nginx-kind.ts index f4e42ae41c..8f56f591b4 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-kind.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-kind.ts @@ -26,7 +26,7 @@ const nginxKindMainResource = { export class KindGardenIngressController extends GardenIngressController { override async install(ctx: KubernetesPluginContext, log: Log): Promise { - const status = await kindNginxStatus(ctx, log) + const status = await this.getStatus(ctx, log) if (status === "ready") { return } @@ -53,12 +53,12 @@ export class KindGardenIngressController extends GardenIngressController { }) } - override async ready(ctx: KubernetesPluginContext, log: Log): Promise { - return (await kindNginxStatus(ctx, log)) === "ready" + override async getStatus(ctx: KubernetesPluginContext, log: Log): Promise { + return await kindNginxStatus(ctx, log) } override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { - const status = await kindNginxStatus(ctx, log) + const status = await this.getStatus(ctx, log) if (status === "missing") { return } diff --git a/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts b/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts index 79d8f9de4d..f35ada3b1a 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts @@ -19,7 +19,7 @@ export class Microk8sGardenIngressController extends GardenIngressController { override async install(ctx: KubernetesPluginContext, log: Log): Promise { const provider = ctx.provider - const status = await microk8sNginxStatus(log) + const status = await this.getStatus(ctx, log) if (status === "ready") { return } @@ -44,12 +44,12 @@ export class Microk8sGardenIngressController extends GardenIngressController { }) } - override async ready(_ctx: KubernetesPluginContext, log: Log): Promise { - return (await microk8sNginxStatus(log)) === "ready" + override async getStatus(_ctx: KubernetesPluginContext, log: Log): Promise { + return await microk8sNginxStatus(log) } override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { - const status = await microk8sNginxStatus(log) + const status = await this.getStatus(ctx, log) if (status === "missing") { return } diff --git a/core/src/plugins/kubernetes/nginx/nginx-minikube.ts b/core/src/plugins/kubernetes/nginx/nginx-minikube.ts index 3dcc127f7d..52215c6f32 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-minikube.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-minikube.ts @@ -18,7 +18,7 @@ import { GardenIngressController } from "./ingress-controller.js" export class MinikubeGardenIngressController extends GardenIngressController { override async install(ctx: KubernetesPluginContext, log: Log): Promise { const provider = ctx.provider - const status = await minikubeNginxStatus(ctx, log) + const status = await this.getStatus(ctx, log) if (status === "ready") { return } @@ -36,12 +36,12 @@ export class MinikubeGardenIngressController extends GardenIngressController { }) } - override async ready(ctx: KubernetesPluginContext, log: Log): Promise { - return (await minikubeNginxStatus(ctx, log)) === "ready" + override async getStatus(ctx: KubernetesPluginContext, log: Log): Promise { + return await minikubeNginxStatus(ctx, log) } override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { - const status = await minikubeNginxStatus(ctx, log) + const status = await this.getStatus(ctx, log) if (status === "missing") { return }