Skip to content

Commit

Permalink
feat(nginx-ingress): add option for default TLS cert
Browse files Browse the repository at this point in the history
  • Loading branch information
jenglisch-clf committed Nov 27, 2023
1 parent a42c4fb commit 31e50bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion infrastructure/nginx-ingress/nginx-ingress.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ local k = (import '../../prelude.libsonnet');
loadBalancerIP: error 'you need a static loadbalancer ip (public IP for external, internal IP for internal)',
internalSubnetAzure: null,
replicas: 2,
defaultTlsCertificate: null,
},
// end_config
},

newNginxIngress(config={}):: manifest {


local this = self,
local cfg = $._config.nginxingress + config,

// https://github.com/google/jsonnet/issues/234#issuecomment-275489855
local join(a) =
local notNull(i) = i != null;
local maybeFlatten(acc, i) = if std.type(i) == "array" then acc + i else acc + [i];
std.foldl(maybeFlatten, std.filter(notNull, a), []),

'service-ingress-nginx-controller'+: if cfg.type == 'external' then {
spec+: {
loadBalancerIP: cfg.loadBalancerIP,
Expand All @@ -40,7 +48,10 @@ local k = (import '../../prelude.libsonnet');
spec+: {
containers: [
super.containers[0] {
args: super.args + ['--watch-ingress-without-class'],
args: join([super.args,
'--watch-ingress-without-class',
if cfg.defaultTlsCertificate != null then ['--default-ssl-certificate='+cfg.defaultTlsCertificate]
]),
},
] + super.containers[1:],
},
Expand Down

0 comments on commit 31e50bf

Please sign in to comment.