Skip to content

Commit 2fcda43

Browse files
committed
DEVPROD-3580: Indentation and baseurl removing '/' trimming
1 parent 8fb9616 commit 2fcda43

5 files changed

Lines changed: 147 additions & 144 deletions

File tree

src/main/charts/bamboo/templates/_helpers.tpl

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,20 @@
6262
Deduce the base URL for bamboo.
6363
*/}}
6464
{{- define "bamboo.baseUrl" -}}
65-
{{- if or .Values.ingress.host .Values.gateway.create -}}
66-
{{- $https := eq (include "bamboo.https" . | trim) "true" -}}
67-
{{- $scheme := ternary "https" "http" $https -}}
68-
{{- $host := include "bamboo.hostname" . -}}
69-
{{- $path := "" -}}
70-
{{- if .Values.gateway.create -}}
71-
{{- $path = .Values.gateway.path | default "" -}}
72-
{{- if eq $path "/" -}}{{- $path = "" -}}{{- end -}}
73-
{{- else -}}
74-
{{- $path = .Values.ingress.path | default "" -}}
75-
{{- end -}}
76-
{{- printf "%s://%s%s" $scheme $host $path -}}
77-
{{- else -}}
78-
{{- print "http://localhost:8085/" -}}
79-
{{- end -}}
65+
{{- if or .Values.ingress.host .Values.gateway.create -}}
66+
{{ ternary "https" "http" (include "bamboo.https" . | trim | eq "true") -}}
67+
://
68+
{{- include "bamboo.hostname" . -}}
69+
{{- if .Values.gateway.create -}}
70+
{{- if .Values.gateway.path -}}
71+
{{- .Values.gateway.path -}}
72+
{{- end -}}
73+
{{- else if .Values.ingress.path -}}
74+
{{- .Values.ingress.path -}}
75+
{{- end }}
76+
{{- else -}}
77+
{{- print "http://localhost:8085/" }}
78+
{{- end }}
8079
{{- end }}
8180

8281
{{/*
@@ -94,7 +93,9 @@ behavior consistent with ingress.path.
9493
*/}}
9594
{{- define "bamboo.ingressPath" -}}
9695
{{- if .Values.gateway.create -}}
96+
{{- if .Values.gateway.path -}}
9797
{{- .Values.gateway.path -}}
98+
{{- end -}}
9899
{{- else if .Values.ingress.path -}}
99100
{{- .Values.ingress.path -}}
100101
{{- else -}}
@@ -461,47 +462,47 @@ set -e; cp $JAVA_HOME/lib/security/cacerts /var/ssl/cacerts; chmod 664 /var/ssl/
461462
Validate Gateway API configuration
462463
*/}}
463464
{{- define "bamboo.validateGatewayConfig" -}}
464-
{{- if and .Values.gateway.create .Values.ingress.create -}}
465-
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
466-
{{- end -}}
467-
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
468-
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
469-
{{- end -}}
470-
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
471-
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
472-
{{- end -}}
465+
{{- if and .Values.gateway.create .Values.ingress.create -}}
466+
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
467+
{{- end -}}
468+
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
469+
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
470+
{{- end -}}
471+
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
472+
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
473+
{{- end -}}
473474
{{- end -}}
474475

475476
{{/*
476477
Get the hostname for the service - works with both Ingress and Gateway API
477478
Returns the first hostname from gateway.hostnames if gateway is enabled, otherwise ingress.host
478479
*/}}
479480
{{- define "bamboo.hostname" -}}
480-
{{- if .Values.gateway.create -}}
481-
{{- index .Values.gateway.hostnames 0 -}}
482-
{{- else -}}
483-
{{- .Values.ingress.host -}}
484-
{{- end -}}
481+
{{- if .Values.gateway.create -}}
482+
{{- index .Values.gateway.hostnames 0 -}}
483+
{{- else -}}
484+
{{- .Values.ingress.host -}}
485+
{{- end -}}
485486
{{- end -}}
486487

487488
{{/*
488489
Returns true if HTTPS is enabled (gateway.https if gateway is enabled, otherwise ingress.https)
489490
*/}}
490491
{{- define "bamboo.https" -}}
491-
{{- if .Values.gateway.create -}}
492-
{{- .Values.gateway.https -}}
493-
{{- else -}}
494-
{{- .Values.ingress.https -}}
495-
{{- end -}}
492+
{{- if .Values.gateway.create -}}
493+
{{- .Values.gateway.https -}}
494+
{{- else -}}
495+
{{- .Values.ingress.https -}}
496+
{{- end -}}
496497
{{- end -}}
497498

498499
{{/*
499500
Returns the proxy port (gateway or ingress-based)
500501
*/}}
501502
{{- define "bamboo.proxyPort" -}}
502-
{{- if .Values.gateway.create -}}
503-
{{- ternary "443" "80" .Values.gateway.https -}}
504-
{{- else -}}
505-
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
506-
{{- end -}}
503+
{{- if .Values.gateway.create -}}
504+
{{- ternary "443" "80" .Values.gateway.https -}}
505+
{{- else -}}
506+
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
507+
{{- end -}}
507508
{{- end -}}

src/main/charts/bitbucket/templates/_helpers.tpl

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,10 @@ Mesh Pod labels
126126
{{- end }}
127127
128128
{{- define "bitbucket.baseUrl" -}}
129-
{{- $https := eq (include "bitbucket.https" . | trim) "true" -}}
130-
{{- $scheme := ternary "https" "http" $https -}}
131-
{{- $host := include "bitbucket.hostname" . -}}
132-
{{- $port := "" -}}
133-
{{- if and (not .Values.gateway.create) .Values.ingress.port -}}
134-
{{- $port = printf ":%v" .Values.ingress.port -}}
135-
{{- end -}}
136-
{{- printf "%s://%s%s" $scheme $host $port -}}
129+
{{ ternary "https" "http" (include "bitbucket.https" . | trim | eq "true") -}}
130+
://
131+
{{- include "bitbucket.hostname" . -}}
132+
{{ if and (not .Values.gateway.create) .Values.ingress.port }}:{{ .Values.ingress.port }}{{ end }}
137133
{{- end }}
138134
139135
{{/*
@@ -144,7 +140,9 @@ behavior consistent with ingress.path.
144140
*/}}
145141
{{- define "bitbucket.ingressPath" -}}
146142
{{- if .Values.gateway.create -}}
143+
{{- if .Values.gateway.path -}}
147144
{{- .Values.gateway.path -}}
145+
{{- end -}}
148146
{{- else if .Values.ingress.path -}}
149147
{{- .Values.ingress.path -}}
150148
{{- else -}}
@@ -622,54 +620,54 @@ set -e; cp $JAVA_HOME/lib/security/cacerts /var/ssl/cacerts; chmod 664 /var/ssl/
622620
Validate Gateway API configuration
623621
*/}}
624622
{{- define "bitbucket.validateGatewayConfig" -}}
625-
{{- if and .Values.gateway.create .Values.ingress.create -}}
626-
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
627-
{{- end -}}
628-
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
629-
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
630-
{{- end -}}
631-
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
632-
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
633-
{{- end -}}
623+
{{- if and .Values.gateway.create .Values.ingress.create -}}
624+
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
625+
{{- end -}}
626+
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
627+
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
628+
{{- end -}}
629+
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
630+
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
631+
{{- end -}}
634632
{{- end -}}
635633
636634
{{/*
637635
Get Gateway namespace - defaults to release namespace if not specified
638636
*/}}
639637
{{- define "bitbucket.gatewayNamespace" -}}
640-
{{- .Values.gateway.gatewayNamespace | default .Release.Namespace -}}
638+
{{- .Values.gateway.gatewayNamespace | default .Release.Namespace -}}
641639
{{- end -}}
642640
643641
{{/*
644642
Get the hostname for the service - works with both Ingress and Gateway API
645643
Returns the first hostname from gateway.hostnames if gateway is enabled, otherwise ingress.host
646644
*/}}
647645
{{- define "bitbucket.hostname" -}}
648-
{{- if .Values.gateway.create -}}
649-
{{- index .Values.gateway.hostnames 0 -}}
650-
{{- else -}}
651-
{{- .Values.ingress.host -}}
652-
{{- end -}}
646+
{{- if .Values.gateway.create -}}
647+
{{- index .Values.gateway.hostnames 0 -}}
648+
{{- else -}}
649+
{{- .Values.ingress.host -}}
650+
{{- end -}}
653651
{{- end -}}
654652
655653
{{/*
656654
Returns true if HTTPS is enabled (gateway.https if gateway is enabled, otherwise ingress.https)
657655
*/}}
658656
{{- define "bitbucket.https" -}}
659-
{{- if .Values.gateway.create -}}
660-
{{- .Values.gateway.https -}}
661-
{{- else -}}
662-
{{- .Values.ingress.https -}}
663-
{{- end -}}
657+
{{- if .Values.gateway.create -}}
658+
{{- .Values.gateway.https -}}
659+
{{- else -}}
660+
{{- .Values.ingress.https -}}
661+
{{- end -}}
664662
{{- end -}}
665663
666664
{{/*
667665
Returns the proxy port (gateway or ingress-based)
668666
*/}}
669667
{{- define "bitbucket.proxyPort" -}}
670-
{{- if .Values.gateway.create -}}
671-
{{- ternary "443" "80" .Values.gateway.https -}}
672-
{{- else -}}
673-
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
674-
{{- end -}}
668+
{{- if .Values.gateway.create -}}
669+
{{- ternary "443" "80" .Values.gateway.https -}}
670+
{{- else -}}
671+
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
672+
{{- end -}}
675673
{{- end -}}

src/main/charts/confluence/templates/_helpers.tpl

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ behavior consistent with ingress.path.
224224
*/}}
225225
{{- define "confluence.ingressPath" -}}
226226
{{- if .Values.gateway.create -}}
227+
{{- if .Values.gateway.path -}}
227228
{{- .Values.gateway.path -}}
229+
{{- end -}}
228230
{{- else if .Values.ingress.path -}}
229231
{{- .Values.ingress.path -}}
230232
{{- else -}}
@@ -831,47 +833,47 @@ set -e; cp $JAVA_HOME/lib/security/cacerts /var/ssl/cacerts; chmod 664 /var/ssl/
831833
Validate Gateway API configuration
832834
*/}}
833835
{{- define "confluence.validateGatewayConfig" -}}
834-
{{- if and .Values.gateway.create .Values.ingress.create -}}
835-
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
836-
{{- end -}}
837-
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
838-
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
839-
{{- end -}}
840-
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
841-
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
842-
{{- end -}}
836+
{{- if and .Values.gateway.create .Values.ingress.create -}}
837+
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
838+
{{- end -}}
839+
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
840+
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
841+
{{- end -}}
842+
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
843+
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
844+
{{- end -}}
843845
{{- end -}}
844846

845847
{{/*
846848
Get the hostname for the service - works with both Ingress and Gateway API
847849
Returns the first hostname from gateway.hostnames if gateway is enabled, otherwise ingress.host
848850
*/}}
849851
{{- define "confluence.hostname" -}}
850-
{{- if .Values.gateway.create -}}
851-
{{- index .Values.gateway.hostnames 0 -}}
852-
{{- else -}}
853-
{{- .Values.ingress.host -}}
854-
{{- end -}}
852+
{{- if .Values.gateway.create -}}
853+
{{- index .Values.gateway.hostnames 0 -}}
854+
{{- else -}}
855+
{{- .Values.ingress.host -}}
856+
{{- end -}}
855857
{{- end -}}
856858

857859
{{/*
858860
Returns true if HTTPS is enabled (gateway.https if gateway is enabled, otherwise ingress.https)
859861
*/}}
860862
{{- define "confluence.https" -}}
861-
{{- if .Values.gateway.create -}}
862-
{{- .Values.gateway.https -}}
863-
{{- else -}}
864-
{{- .Values.ingress.https -}}
865-
{{- end -}}
863+
{{- if .Values.gateway.create -}}
864+
{{- .Values.gateway.https -}}
865+
{{- else -}}
866+
{{- .Values.ingress.https -}}
867+
{{- end -}}
866868
{{- end -}}
867869

868870
{{/*
869871
Returns the proxy port (gateway or ingress-based)
870872
*/}}
871873
{{- define "confluence.proxyPort" -}}
872-
{{- if .Values.gateway.create -}}
873-
{{- ternary "443" "80" .Values.gateway.https -}}
874-
{{- else -}}
875-
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
876-
{{- end -}}
874+
{{- if .Values.gateway.create -}}
875+
{{- ternary "443" "80" .Values.gateway.https -}}
876+
{{- else -}}
877+
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
878+
{{- end -}}
877879
{{- end -}}

src/main/charts/crowd/templates/_helpers.tpl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -377,47 +377,47 @@ set -e; cp $JAVA_HOME/lib/security/cacerts /var/ssl/cacerts; chmod 664 /var/ssl/
377377
Validate Gateway API configuration
378378
*/}}
379379
{{- define "crowd.validateGatewayConfig" -}}
380-
{{- if and .Values.gateway.create .Values.ingress.create -}}
381-
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
382-
{{- end -}}
383-
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
384-
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
385-
{{- end -}}
386-
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
387-
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
388-
{{- end -}}
380+
{{- if and .Values.gateway.create .Values.ingress.create -}}
381+
{{- fail "ERROR: Cannot enable both gateway.create and ingress.create" -}}
382+
{{- end -}}
383+
{{- if and .Values.gateway.create (not .Values.gateway.gatewayName) -}}
384+
{{- fail "ERROR: gateway.gatewayName is required when gateway.create is true" -}}
385+
{{- end -}}
386+
{{- if and .Values.gateway.create (not .Values.gateway.hostnames) -}}
387+
{{- fail "ERROR: gateway.hostnames must contain at least one hostname when gateway.create is true" -}}
388+
{{- end -}}
389389
{{- end -}}
390390

391391
{{/*
392392
Get the hostname for the service - works with both Ingress and Gateway API
393393
Returns the first hostname from gateway.hostnames if gateway is enabled, otherwise ingress.host
394394
*/}}
395395
{{- define "crowd.hostname" -}}
396-
{{- if .Values.gateway.create -}}
397-
{{- index .Values.gateway.hostnames 0 -}}
398-
{{- else -}}
399-
{{- .Values.ingress.host -}}
400-
{{- end -}}
396+
{{- if .Values.gateway.create -}}
397+
{{- index .Values.gateway.hostnames 0 -}}
398+
{{- else -}}
399+
{{- .Values.ingress.host -}}
400+
{{- end -}}
401401
{{- end -}}
402402

403403
{{/*
404404
Returns true if HTTPS is enabled (gateway.https if gateway is enabled, otherwise ingress.https)
405405
*/}}
406406
{{- define "crowd.https" -}}
407-
{{- if .Values.gateway.create -}}
408-
{{- .Values.gateway.https -}}
409-
{{- else -}}
410-
{{- .Values.ingress.https -}}
411-
{{- end -}}
407+
{{- if .Values.gateway.create -}}
408+
{{- .Values.gateway.https -}}
409+
{{- else -}}
410+
{{- .Values.ingress.https -}}
411+
{{- end -}}
412412
{{- end -}}
413413

414414
{{/*
415415
Returns the proxy port (gateway or ingress-based)
416416
*/}}
417417
{{- define "crowd.proxyPort" -}}
418-
{{- if .Values.gateway.create -}}
419-
{{- ternary "443" "80" .Values.gateway.https -}}
420-
{{- else -}}
421-
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
422-
{{- end -}}
418+
{{- if .Values.gateway.create -}}
419+
{{- ternary "443" "80" .Values.gateway.https -}}
420+
{{- else -}}
421+
{{- default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}}
422+
{{- end -}}
423423
{{- end -}}

0 commit comments

Comments
 (0)