diff --git a/core/src/plugins/kubernetes/nginx/ingress-controller.ts b/core/src/plugins/kubernetes/nginx/ingress-controller.ts index bdd291df31..4259a2df1c 100644 --- a/core/src/plugins/kubernetes/nginx/ingress-controller.ts +++ b/core/src/plugins/kubernetes/nginx/ingress-controller.ts @@ -15,10 +15,12 @@ import { MinikubeGardenIngressController } from "./nginx-minikube.js" import { KindGardenIngressController } from "./nginx-kind.js" import { EphemeralHelmGardenIngressController } from "./nginx-helm-ephemeral.js" -export interface GardenIngressController { - install: (ctx: KubernetesPluginContext, log: Log) => Promise - uninstall: (ctx: KubernetesPluginContext, log: Log) => Promise - ready: (ctx: KubernetesPluginContext, log: Log) => Promise +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 } export function getGardenIngressController(ctx: KubernetesPluginContext): GardenIngressController | undefined { diff --git a/core/src/plugins/kubernetes/nginx/nginx-helm.ts b/core/src/plugins/kubernetes/nginx/nginx-helm.ts index 01341bcac5..1495127d66 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-helm.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-helm.ts @@ -27,16 +27,16 @@ const HELM_INGRESS_NGINX_DEPLOYMENT_TIMEOUT = "300s" type _HelmValue = number | string | boolean | object | null | undefined -export abstract class HelmGardenIngressController implements GardenIngressController { - install(ctx: KubernetesPluginContext, log: Log): Promise { +export abstract class HelmGardenIngressController extends GardenIngressController { + override install(ctx: KubernetesPluginContext, log: Log): Promise { return helmNginxInstall(ctx, log, this.helmValuesGetter()) } - ready(ctx: KubernetesPluginContext, log: Log): Promise { + override ready(ctx: KubernetesPluginContext, log: Log): Promise { return helmIngressControllerReady(ctx, log, this.helmValuesGetter()) } - uninstall(ctx: KubernetesPluginContext, log: Log): Promise { + override uninstall(ctx: KubernetesPluginContext, log: Log): Promise { return helmNginxUninstall(ctx, log, this.helmValuesGetter()) } diff --git a/core/src/plugins/kubernetes/nginx/nginx-kind.ts b/core/src/plugins/kubernetes/nginx/nginx-kind.ts index 91421b15b1..f4e42ae41c 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-kind.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-kind.ts @@ -24,8 +24,8 @@ const nginxKindMainResource = { }, } -export class KindGardenIngressController implements GardenIngressController { - async install(ctx: KubernetesPluginContext, log: Log): Promise { +export class KindGardenIngressController extends GardenIngressController { + override async install(ctx: KubernetesPluginContext, log: Log): Promise { const status = await kindNginxStatus(ctx, log) if (status === "ready") { return @@ -53,11 +53,11 @@ export class KindGardenIngressController implements GardenIngressController { }) } - async ready(ctx: KubernetesPluginContext, log: Log): Promise { + override async ready(ctx: KubernetesPluginContext, log: Log): Promise { return (await kindNginxStatus(ctx, log)) === "ready" } - async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { + override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { const status = await kindNginxStatus(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 df563a862a..79d8f9de4d 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-microk8s.ts @@ -15,8 +15,8 @@ import { configureMicrok8sAddons } from "../local/microk8s.js" import { waitForResources } from "../status/status.js" import { GardenIngressController } from "./ingress-controller.js" -export class Microk8sGardenIngressController implements GardenIngressController { - async install(ctx: KubernetesPluginContext, log: Log): Promise { +export class Microk8sGardenIngressController extends GardenIngressController { + override async install(ctx: KubernetesPluginContext, log: Log): Promise { const provider = ctx.provider const status = await microk8sNginxStatus(log) @@ -44,11 +44,11 @@ export class Microk8sGardenIngressController implements GardenIngressController }) } - async ready(_ctx: KubernetesPluginContext, log: Log): Promise { + override async ready(_ctx: KubernetesPluginContext, log: Log): Promise { return (await microk8sNginxStatus(log)) === "ready" } - async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { + override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { const status = await microk8sNginxStatus(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 9803f4ca61..3dcc127f7d 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-minikube.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-minikube.ts @@ -15,8 +15,8 @@ import { KubeApi } from "../api.js" import { checkResourceStatus, waitForResources } from "../status/status.js" import { GardenIngressController } from "./ingress-controller.js" -export class MinikubeGardenIngressController implements GardenIngressController { - async install(ctx: KubernetesPluginContext, log: Log): Promise { +export class MinikubeGardenIngressController extends GardenIngressController { + override async install(ctx: KubernetesPluginContext, log: Log): Promise { const provider = ctx.provider const status = await minikubeNginxStatus(ctx, log) if (status === "ready") { @@ -36,11 +36,11 @@ export class MinikubeGardenIngressController implements GardenIngressController }) } - async ready(ctx: KubernetesPluginContext, log: Log): Promise { + override async ready(ctx: KubernetesPluginContext, log: Log): Promise { return (await minikubeNginxStatus(ctx, log)) === "ready" } - async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { + override async uninstall(ctx: KubernetesPluginContext, log: Log): Promise { const status = await minikubeNginxStatus(ctx, log) if (status === "missing") { return