diff --git a/core/src/plugins/kubernetes/nginx/nginx-helm-ephemeral.ts b/core/src/plugins/kubernetes/nginx/nginx-helm-ephemeral.ts index 4a7bc90404..4cc7eb68b5 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-helm-ephemeral.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-helm-ephemeral.ts @@ -7,50 +7,48 @@ */ import type { SystemVars } from "../init.js" -import type { NginxHelmValuesGetter } from "./nginx-helm.js" +import type { NginxHelmValues } from "./nginx-helm.js" import { HelmGardenIngressController } from "./nginx-helm.js" export class EphemeralHelmGardenIngressController extends HelmGardenIngressController { - helmValuesGetter(): NginxHelmValuesGetter { - return (systemVars: SystemVars) => { - return { - name: "ingress-controller", - controller: { - kind: "Deployment", - updateStrategy: { - type: "RollingUpdate", - rollingUpdate: { - maxUnavailable: 1, - }, - }, - extraArgs: { - "default-backend-service": `${systemVars.namespace}/default-backend`, - }, - minReadySeconds: 1, - tolerations: systemVars["system-tolerations"], - nodeSelector: systemVars["system-node-selector"], - admissionWebhooks: { - enabled: false, - }, - ingressClassResource: { - name: "nginx", - enabled: true, - default: true, - }, - replicaCount: 1, - service: { - annotations: { - "kubernetes.namespace.so/expose": "true", - "kubernetes.namespace.so/exposed-port-80": "wildcard", - "kubernetes.namespace.so/exposed-port-443": "wildcard", - }, - type: "LoadBalancer", + override helmValuesGetter(systemVars: SystemVars): NginxHelmValues { + return { + name: "ingress-controller", + controller: { + kind: "Deployment", + updateStrategy: { + type: "RollingUpdate", + rollingUpdate: { + maxUnavailable: 1, }, }, - defaultBackend: { + extraArgs: { + "default-backend-service": `${systemVars.namespace}/default-backend`, + }, + minReadySeconds: 1, + tolerations: systemVars["system-tolerations"], + nodeSelector: systemVars["system-node-selector"], + admissionWebhooks: { enabled: false, }, - } + ingressClassResource: { + name: "nginx", + enabled: true, + default: true, + }, + replicaCount: 1, + service: { + annotations: { + "kubernetes.namespace.so/expose": "true", + "kubernetes.namespace.so/exposed-port-80": "wildcard", + "kubernetes.namespace.so/exposed-port-443": "wildcard", + }, + type: "LoadBalancer", + }, + }, + defaultBackend: { + enabled: false, + }, } } } diff --git a/core/src/plugins/kubernetes/nginx/nginx-helm-generic.ts b/core/src/plugins/kubernetes/nginx/nginx-helm-generic.ts index 306403593c..3039612cfe 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-helm-generic.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-helm-generic.ts @@ -7,48 +7,46 @@ */ import type { SystemVars } from "../init.js" -import type { NginxHelmValuesGetter } from "./nginx-helm.js" +import type { NginxHelmValues } from "./nginx-helm.js" import { HelmGardenIngressController } from "./nginx-helm.js" export class GenericHelmGardenIngressController extends HelmGardenIngressController { - helmValuesGetter(): NginxHelmValuesGetter { - return (systemVars: SystemVars) => { - return { - name: "ingress-controller", - controller: { - kind: "DaemonSet", - updateStrategy: { - type: "RollingUpdate", - rollingUpdate: { - maxUnavailable: 1, - }, - }, - extraArgs: { - "default-backend-service": `${systemVars.namespace}/default-backend`, - }, - minReadySeconds: 1, - tolerations: systemVars["system-tolerations"], - nodeSelector: systemVars["system-node-selector"], - admissionWebhooks: { - enabled: false, - }, - ingressClassResource: { - name: "nginx", - enabled: true, - default: true, - }, - hostPort: { - enabled: true, - ports: { - http: systemVars["ingress-http-port"], - https: systemVars["ingress-https-port"], - }, + override helmValuesGetter(systemVars: SystemVars): NginxHelmValues { + return { + name: "ingress-controller", + controller: { + kind: "DaemonSet", + updateStrategy: { + type: "RollingUpdate", + rollingUpdate: { + maxUnavailable: 1, }, }, - defaultBackend: { + extraArgs: { + "default-backend-service": `${systemVars.namespace}/default-backend`, + }, + minReadySeconds: 1, + tolerations: systemVars["system-tolerations"], + nodeSelector: systemVars["system-node-selector"], + admissionWebhooks: { enabled: false, }, - } + ingressClassResource: { + name: "nginx", + enabled: true, + default: true, + }, + hostPort: { + enabled: true, + ports: { + http: systemVars["ingress-http-port"], + https: systemVars["ingress-https-port"], + }, + }, + }, + defaultBackend: { + enabled: false, + }, } } } diff --git a/core/src/plugins/kubernetes/nginx/nginx-helm-k3s.ts b/core/src/plugins/kubernetes/nginx/nginx-helm-k3s.ts index 30753e8752..93642c5ea1 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-helm-k3s.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-helm-k3s.ts @@ -7,42 +7,40 @@ */ import type { SystemVars } from "../init.js" -import type { NginxHelmValuesGetter } from "./nginx-helm.js" +import type { NginxHelmValues } from "./nginx-helm.js" import { HelmGardenIngressController } from "./nginx-helm.js" export class K3sHelmGardenIngressController extends HelmGardenIngressController { - helmValuesGetter(): NginxHelmValuesGetter { - return (systemVars: SystemVars) => { - return { - name: "ingress-controller", - controller: { - kind: "Deployment", - updateStrategy: { - type: "RollingUpdate", - rollingUpdate: { - maxUnavailable: 1, - }, + override helmValuesGetter(systemVars: SystemVars): NginxHelmValues { + return { + name: "ingress-controller", + controller: { + kind: "Deployment", + updateStrategy: { + type: "RollingUpdate", + rollingUpdate: { + maxUnavailable: 1, }, - extraArgs: { - "default-backend-service": `${systemVars.namespace}/default-backend`, - }, - minReadySeconds: 1, - tolerations: systemVars["system-tolerations"], - nodeSelector: systemVars["system-node-selector"], - admissionWebhooks: { - enabled: false, - }, - ingressClassResource: { - name: "nginx", - enabled: true, - default: true, - }, - replicaCount: 1, }, - defaultBackend: { + extraArgs: { + "default-backend-service": `${systemVars.namespace}/default-backend`, + }, + minReadySeconds: 1, + tolerations: systemVars["system-tolerations"], + nodeSelector: systemVars["system-node-selector"], + admissionWebhooks: { enabled: false, }, - } + ingressClassResource: { + name: "nginx", + enabled: true, + default: true, + }, + replicaCount: 1, + }, + defaultBackend: { + enabled: false, + }, } } } diff --git a/core/src/plugins/kubernetes/nginx/nginx-helm.ts b/core/src/plugins/kubernetes/nginx/nginx-helm.ts index 45f596965d..543dcd93af 100644 --- a/core/src/plugins/kubernetes/nginx/nginx-helm.ts +++ b/core/src/plugins/kubernetes/nginx/nginx-helm.ts @@ -41,7 +41,7 @@ export abstract class HelmGardenIngressController extends GardenIngressComponent const config = provider.config const namespace = config.gardenSystemNamespace const systemVars: SystemVars = getKubernetesSystemVariables(config) - const values = this.helmValuesGetter()(systemVars) + const values = this.helmValuesGetter(systemVars) const valueArgs: string[] = [] for (const key in values) { @@ -89,7 +89,7 @@ export abstract class HelmGardenIngressController extends GardenIngressComponent const config = provider.config const api = await KubeApi.factory(log, ctx, provider) const systemVars: SystemVars = getKubernetesSystemVariables(config) - const values = this.helmValuesGetter()(systemVars) + const values = this.helmValuesGetter(systemVars) const namespace = config.gardenSystemNamespace try { @@ -142,10 +142,10 @@ export abstract class HelmGardenIngressController extends GardenIngressComponent await this.defaultBackend.uninstall(ctx, log) } - abstract helmValuesGetter(): NginxHelmValuesGetter + abstract helmValuesGetter(systemVars: SystemVars): NginxHelmValues } -interface NginxHelmValues { +export interface NginxHelmValues { name: string controller: { kind: string @@ -180,8 +180,6 @@ interface NginxHelmValues { [key: string]: _HelmValue } -export type NginxHelmValuesGetter = (systemVars: SystemVars) => NginxHelmValues - function getNginxHelmMainResource(values: NginxHelmValues) { return { apiVersion: "apps/v1",