account for loadbalancer IP

This commit is contained in:
Stavros kois
2022-12-19 16:10:16 +02:00
parent 437cc8148a
commit 2632fe8bd9
4 changed files with 37 additions and 10 deletions
@@ -53,6 +53,33 @@ tests:
content:
host-main-main: $node_ip
- it: should pass with LoadBalancer and IP set on single service/port
documentIndex: &portalDoc 2
set:
service:
main:
enabled: true
type: LoadBalancer
loadBalancerIP: 10.10.10.100
ports:
main:
enabled: true
port: 10000
protocol: HTTP
targetPort: 80
asserts:
- isKind:
of: ConfigMap
- isAPIVersion:
of: v1
- equal:
path: metadata.name
value: portal
- isSubset:
path: data
content:
host-main-main: "10.10.10.100"
- it: should pass with host override on single service/port
documentIndex: *portalDoc
set:
@@ -1,3 +1,4 @@
{{/* A placeholder is added, just to avoid having an empty configmap */}}
{{- define "ix.v1.common.class.portal" -}}
{{- $root := .root -}}
@@ -35,11 +36,3 @@ data:
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
TODO:
Current "bugs", you can't disable per port portal,
if port protocol is not HTTP or HTTPS,
it will still create an HTTP portal.
A placeholder is added, just to avoid having
an empty configmap
*/}}
@@ -5,7 +5,14 @@
{{- $root := .root -}}
{{- $portalHost := "$node_ip" -}}
{{/*TODO: When LB + LB-ip = LB-ip*/}}
{{- $svc := (get $root.Values.service $svcName) -}}
{{- if eq $svc.type "LoadBalancer" -}}
{{- with $svc.loadBalancerIP -}}
{{- $portalHost = toString . -}}
{{- end -}}
{{- end -}}
{{/* If ingress is added at any point, here is the place to implement */}}
{{/* Check if there are any overrides in .Values.portal */}}
@@ -8,7 +8,7 @@
{{- $portalProtocol := "http" -}}
{{- if $port.protocol -}}
{{- if (has $port.protocol (list "HTTP" "HTTPS")) -}}
{{- if (mustHas $port.protocol (list "HTTP" "HTTPS")) -}}
{{ $portalProtocol = ($port.protocol | lower) }}
{{- end -}}
{{- end -}}