From a42c4fb3f2550d2580b9fd660981a8adbeb7418c Mon Sep 17 00:00:00 2001 From: Jakob Englisch Date: Mon, 27 Nov 2023 19:21:10 +0100 Subject: [PATCH] feat(nginx-ingress): internal ingress for azure --- .../nginx-ingress/nginx-ingress.libsonnet | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/infrastructure/nginx-ingress/nginx-ingress.libsonnet b/infrastructure/nginx-ingress/nginx-ingress.libsonnet index 30793f1..8822f79 100644 --- a/infrastructure/nginx-ingress/nginx-ingress.libsonnet +++ b/infrastructure/nginx-ingress/nginx-ingress.libsonnet @@ -6,7 +6,9 @@ local k = (import '../../prelude.libsonnet'); // begin_config nginxingress: { name: 'nginx-ingress', - loadBalancerIP: error 'you need a static loadbalancer (public ip)', + type: 'external', + loadBalancerIP: error 'you need a static loadbalancer ip (public IP for external, internal IP for internal)', + internalSubnetAzure: null, replicas: 2, }, // end_config @@ -17,10 +19,18 @@ local k = (import '../../prelude.libsonnet'); local this = self, local cfg = $._config.nginxingress + config, - 'service-ingress-nginx-controller'+: { + 'service-ingress-nginx-controller'+: if cfg.type == 'external' then { spec+: { loadBalancerIP: cfg.loadBalancerIP, }, + } else if cfg.type == 'internal-azure' then { + metadata+: { + annotations+: { + 'service.beta.kubernetes.io/azure-load-balancer-internal': 'true', + 'service.beta.kubernetes.io/azure-load-balancer-ipv4': cfg.loadBalancerIP, + [if cfg.internalSubnetAzure != null then 'service.beta.kubernetes.io/azure-load-balancer-internal-subnet' else null]: cfg.internalSubnetAzure, + }, + }, }, 'deployment-ingress-nginx-controller'+: {