Files
chart/library/ix-dev/community/planka/templates/_portal.tpl
Stavros Kois c04afa05c8 NAS-123500 / 24.04 / add planka to community train (#1436)
* add `planka` to `community` train

* lock file

* add initial tempaltes

* add service

* fix url

* update portal

* test

* metadata

* questions

* typo

* add validation

* typo

* fix logic

* switch to uri type

* update description

* bump common
2023-08-30 14:23:46 +03:00

34 lines
1.0 KiB
Smarty

{{- define "planka.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
{{- $protocol := "http" -}}
{{- if hasPrefix "https://" .Values.plankaConfig.baseURL -}}
{{- $protocol = "https" -}}
{{- end -}}
{{- $host := "$node_ip" -}}
{{- $port := .Values.plankaNetwork.webPort -}}
{{- with .Values.plankaConfig.baseURL -}} {{/* Trim protocol and trailing slash */}}
{{- $host = (. | trimPrefix "https://" | trimPrefix "http://" | trimSuffix "/") -}}
{{- $host = mustRegexReplaceAll "(.*):[0-9]+" $host "${1}" -}}
{{- $tempPort := . | trimPrefix $protocol | trimPrefix "://" | trimPrefix $host | trimPrefix ":" -}}
{{- if $tempPort -}}
{{- $port = $tempPort -}}
{{- end -}}
{{- if not $tempPort -}}
{{- if eq $protocol "https" -}}
{{- $port = "443" -}}
{{- else -}}
{{- $port = "80" -}}
{{- end -}}
{{- end -}}
{{- end }}
path: "/"
port: {{ $port | quote }}
protocol: {{ $protocol }}
host: {{ $host }}
{{- end -}}