|
62 | 62 | Deduce the base URL for bamboo. |
63 | 63 | */}} |
64 | 64 | {{- define "bamboo.baseUrl" -}} |
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 }} |
| 65 | +{{- if eq (include "common.gateway.isConfigured" .) "true" -}} |
| 66 | +{{- include "common.gateway.origin" . -}}{{ include "bamboo.path" . -}} |
| 67 | +{{- else -}} |
| 68 | +{{- print "http://localhost:8085/" -}} |
| 69 | +{{- end -}} |
79 | 70 | {{- end }} |
80 | 71 |
|
81 | 72 | {{/* |
82 | | -Create default value for ingress port |
| 73 | +Create default value for the service path. |
| 74 | +Works with both Ingress and Gateway API. |
83 | 75 | */}} |
84 | | -{{- define "bamboo.ingressPort" -}} |
85 | | -{{ default (ternary "443" "80" .Values.ingress.https) .Values.ingress.port -}} |
| 76 | +{{- define "bamboo.path" -}} |
| 77 | +{{- include "common.gateway.path" (dict |
| 78 | + "useGatewayMode" (include "common.gateway.useGatewayMode" .) |
| 79 | + "gatewayPath" .Values.gateway.path |
| 80 | + "ingressPath" .Values.ingress.path |
| 81 | + "contextPath" .Values.bamboo.service.contextPath |
| 82 | +) -}} |
86 | 83 | {{- end }} |
87 | 84 |
|
88 | 85 | {{/* |
89 | | -Create default value for ingress path. |
90 | | -
|
91 | | -When using Gateway API, prefer gateway.path to keep URL/path |
92 | | -behavior consistent with ingress.path. |
| 86 | +Alias for backward compatibility with ingress templates. |
93 | 87 | */}} |
94 | 88 | {{- define "bamboo.ingressPath" -}} |
95 | | -{{- if .Values.gateway.create -}} |
96 | | -{{- if .Values.gateway.path -}} |
97 | | -{{- .Values.gateway.path -}} |
98 | | -{{- end -}} |
99 | | -{{- else if .Values.ingress.path -}} |
100 | | -{{- .Values.ingress.path -}} |
101 | | -{{- else -}} |
102 | | -{{ default ( "/" ) .Values.bamboo.service.contextPath -}} |
103 | | -{{- end }} |
| 89 | +{{- include "bamboo.path" . -}} |
104 | 90 | {{- end }} |
105 | 91 |
|
106 | 92 | {{/* |
@@ -458,51 +444,4 @@ set -e; cp $JAVA_HOME/lib/security/cacerts /var/ssl/cacerts; chmod 664 /var/ssl/ |
458 | 444 | {{- end }} |
459 | 445 | {{- end }} |
460 | 446 |
|
461 | | -{{/* |
462 | | -Validate Gateway API configuration |
463 | | -*/}} |
464 | | -{{- define "bamboo.validateGatewayConfig" -}} |
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 -}} |
474 | | -{{- end -}} |
475 | 447 |
|
476 | | -{{/* |
477 | | -Get the hostname for the service - works with both Ingress and Gateway API |
478 | | -Returns the first hostname from gateway.hostnames if gateway is enabled, otherwise ingress.host |
479 | | -*/}} |
480 | | -{{- define "bamboo.hostname" -}} |
481 | | - {{- if .Values.gateway.create -}} |
482 | | - {{- index .Values.gateway.hostnames 0 -}} |
483 | | - {{- else -}} |
484 | | - {{- .Values.ingress.host -}} |
485 | | - {{- end -}} |
486 | | -{{- end -}} |
487 | | - |
488 | | -{{/* |
489 | | -Returns true if HTTPS is enabled (gateway.https if gateway is enabled, otherwise ingress.https) |
490 | | -*/}} |
491 | | -{{- define "bamboo.https" -}} |
492 | | - {{- if .Values.gateway.create -}} |
493 | | - {{- .Values.gateway.https -}} |
494 | | - {{- else -}} |
495 | | - {{- .Values.ingress.https -}} |
496 | | - {{- end -}} |
497 | | -{{- end -}} |
498 | | - |
499 | | -{{/* |
500 | | -Returns the proxy port (gateway or ingress-based) |
501 | | -*/}} |
502 | | -{{- define "bamboo.proxyPort" -}} |
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 -}} |
508 | | -{{- end -}} |
0 commit comments