Dynamicly determine portal settings (#253)

* Setup dynamic portal config map.

- Includes tests

* Add portal docs

* Update charts/calibre-web/2.0.0/questions.yaml

Co-authored-by: Troy Prelog <35702532+tprelog@users.noreply.github.com>

* Fix feedback from @stavros-k

* Update charts/jackett/2.0.0/test_values.yaml

* Update charts/jackett/2.0.0/test_values.yaml

* Update charts/zwavejs2mqtt/2.0.0/questions.yaml

Co-authored-by: Troy Prelog <35702532+tprelog@users.noreply.github.com>

* Update charts/home-assistant/2.0.0/questions.yaml

Co-authored-by: Troy Prelog <35702532+tprelog@users.noreply.github.com>

* Update charts/esphome/2.0.0/questions.yaml

Co-authored-by: Troy Prelog <35702532+tprelog@users.noreply.github.com>

* Update charts/handbrake/2.0.0/questions.yaml

Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

Co-authored-by: Troy Prelog <35702532+tprelog@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Kjeld Schouten-Lebbing
2021-03-11 17:41:17 +01:00
committed by kjeld Schouten-Lebbing
co-authored by Troy Prelog Stavros Kois
parent 34762190a3
commit 3eeaea10af
82 changed files with 1392 additions and 227 deletions
Binary file not shown.
+1
View File
@@ -40,5 +40,6 @@ Main entrypoint for the common library chart. It will render all underlying temp
{{- end -}}
{{ include "common.services" . | nindent 0 }}
{{ include "common.ingress" . | nindent 0 }}
{{ include "common.resources.portal" . | nindent 0 }}
{{ include "common.storage.permissions" . | nindent 0 }}
{{- end -}}
-37
View File
@@ -1,37 +0,0 @@
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
`SPDX-License-Identifier: Apache-2.0`
This file is considered to be modified by the TrueCharts Project.
*/}}
{{- define "common.service" -}}
{{- if .Values.service.enabled -}}
{{- /* Generate primary service */ -}}
{{- include "common.classes.service" . }}
{{- /* Generate additional services as required */ -}}
{{- range $index, $extraService := .Values.service.additionalServices }}
{{- if $extraService.enabled -}}
{{- print ("---") | nindent 0 -}}
{{- $serviceValues := $extraService -}}
{{- if not $serviceValues.nameSuffix -}}
{{- $_ := set $serviceValues "nameSuffix" $index -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
{{- include "common.classes.service" $ -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
+1 -1
View File
@@ -16,7 +16,7 @@ of the main Service and any additionalServices.
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
{{- include "common.classes.service" $ -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -1,21 +1,4 @@
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
`SPDX-License-Identifier: Apache-2.0`
This file is considered to be modified by the TrueCharts Project.
*/}}
{{/*
This template serves as a blueprint for all Ingress objects that are created
within the common library.
*/}}
@@ -0,0 +1,59 @@
{{- define "common.resources.portal" -}}
{{- if .Values.portal }}
{{- if .Values.portal.enabled }}
{{- $host := "$node_ip" }}
{{- $port := 443 }}
{{- $protocol := "https" }}
{{- if hasKey .Values "ingress" }}
{{- if hasKey .Values.ingress "main" -}}
{{- range .Values.ingress.main.hosts }}
{{- if .hostTpl }}
{{- $host = ( tpl .hostTpl $ | quote ) }}
{{- else }}
{{- $host = ( .host | quote ) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if and ( .Values.portal.ingressPort ) ( ne $host "$node_ip" ) }}
{{- $port = .Values.portal.ingressPort }}
{{- else if and ( eq $host "$node_ip" ) ( hasKey .Values "services" ) }}
{{- if hasKey .Values.services "main" }}
{{- if and (hasKey .Values.services.main.port "nodePort" ) ( eq .Values.services.main.type "NodePort" ) }}
{{- $port = .Values.services.main.port.nodePort }}
{{- end }}
{{- end }}
{{- end }}
{{- if and (.Values.portal.nodePortProtocol ) ( eq $host "$node_ip" ) }}
{{- $protocol = .Values.portal.nodePortProtocol }}
{{- else if and ( ne $host "$node_ip" ) }}
{{- if .Values.ingress.main.certType }}
{{- if eq .Values.ingress.main.certType "" }}
{{- $protocol = "http" }}
{{- end }}
{{- end }}
{{- end }}
{{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }}
{{- $host = .Values.portal.host }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
labels: {{ include "common.labels" . | nindent 4 }}
data:
protocol: {{ $protocol }}
host: {{ $host }}
port: {{ $port | quote }}
{{- end }}
{{- end }}
{{- end -}}
+3 -3
View File
@@ -100,7 +100,7 @@ probes:
## The spec field contains the values for the default livenessProbe.
## If you selected custom: true, this field holds the definition of the livenessProbe.
spec:
initialDelaySeconds: 30
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
@@ -112,7 +112,7 @@ probes:
## The spec field contains the values for the default readinessProbe.
## If you selected custom: true, this field holds the definition of the readinessProbe.
spec:
initialDelaySeconds: 30
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
@@ -124,7 +124,7 @@ probes:
## The spec field contains the values for the default startupProbe.
## If you selected custom: true, this field holds the definition of the startupProbe.
spec:
initialDelaySeconds: 5
initialDelaySeconds: 0
timeoutSeconds: 10
## This means it has a maximum of 5*30=150 seconds to start up before it fails
periodSeconds: 10