mirror of
https://github.com/truenas/charts.git
synced 2024-04-21 15:21:45 +00:00
add deployments
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
{{- define "nextcloud.workload" -}}
|
||||
workload:
|
||||
nextcloud:
|
||||
enabled: true
|
||||
primary: true
|
||||
type: Deployment
|
||||
podSpec:
|
||||
hostNetwork: false
|
||||
containers:
|
||||
nextcloud:
|
||||
enabled: true
|
||||
primary: true
|
||||
imageSelector: image
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
readOnlyRootFilesystem: false
|
||||
capabilities:
|
||||
add:
|
||||
- CHOWN
|
||||
- DAC_OVERRIDE
|
||||
- FOWNER
|
||||
- NET_BIND_SERVICE
|
||||
- NET_RAW
|
||||
{{ with .Values.ncConfig.additionalEnvs }}
|
||||
envList:
|
||||
{{ range $env := . }}
|
||||
- name: {{ $env.name }}
|
||||
value: {{ $env.value }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
type: http
|
||||
port: 80
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
readiness:
|
||||
enabled: true
|
||||
type: http
|
||||
port: 80
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
startup:
|
||||
enabled: true
|
||||
{{- include "nextcloud.validate-commands" $ -}}
|
||||
{{- $cmds := .Values.ncConfig.commands | mustUniq -}}
|
||||
{{- if not $cmds }}
|
||||
type: http
|
||||
port: 80
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
{{- else }}
|
||||
type: exec
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
check_commands={{ join " " $cmds }}
|
||||
for comm in $check_commands; do
|
||||
if ! command -v $comm /dev/null 2>&1; then
|
||||
echo "Command $comm not found"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
{{- end }}
|
||||
lifecycle:
|
||||
postStart:
|
||||
type: exec
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "Installing {{ join " " $cmds }}..."
|
||||
apt update && apt install -y --no-install-recommends \
|
||||
{{ join " " $cmds }} || echo "Failed to install binary/binaries..."
|
||||
echo "Finished."
|
||||
initContainers:
|
||||
{{- include "ix.v1.common.app.postgresWait" (dict "name" "postgres-wait"
|
||||
"secretName" "postgres-creds") | nindent 8 }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- define "nextcloud.validate-commands" -}}
|
||||
{{- $allowedCommmads := list "ffmpeg" "smbclient" -}}
|
||||
|
||||
{{- range $c := .Values.ncConfig.commands | mustUniq -}}
|
||||
{{- if not (mustHas $c $allowedCommmads) -}}
|
||||
{{- fail (printf "Nextcloud - Expected command to be one of [%s], but got [%s]" (join ", " $allowedCommmads) $c) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,76 @@
|
||||
{{- define "nginx.workload" -}}
|
||||
workload:
|
||||
nginx:
|
||||
enabled: true
|
||||
type: Deployment
|
||||
podSpec:
|
||||
hostNetwork: false
|
||||
containers:
|
||||
nginx:
|
||||
enabled: true
|
||||
primary: true
|
||||
imageSelector: nginxImage
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
readOnlyRootFilesystem: false
|
||||
capabilities:
|
||||
add:
|
||||
- CHOWN
|
||||
- DAC_OVERRIDE
|
||||
- FOWNER
|
||||
- NET_BIND_SERVICE
|
||||
- NET_RAW
|
||||
{{ with .Values.ncConfig.additionalEnvs }}
|
||||
envList:
|
||||
{{ range $env := . }}
|
||||
- name: {{ $env.name }}
|
||||
value: {{ $env.value }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
type: https
|
||||
port: {{ .Values.ncNetwork.webPort }}
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
readiness:
|
||||
enabled: true
|
||||
type: https
|
||||
port: {{ .Values.ncNetwork.webPort }}
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
startup:
|
||||
enabled: true
|
||||
type: https
|
||||
port: {{ .Values.ncNetwork.webPort }}
|
||||
path: /status.php
|
||||
httpHeaders:
|
||||
Host: localhost
|
||||
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
|
||||
{{- $ncUrl := printf "http://%s:80" $fullname }}
|
||||
{{- if .Values.ncNetwork.certificateID -}}
|
||||
{{- $ncUrl = printf "https://%s:%s" $fullname .Values.ncNetwork.webPort -}}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
01-wait-server:
|
||||
enabled: true
|
||||
type: init
|
||||
imageSelector: bashImage
|
||||
command:
|
||||
- bash
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for [{{ $ncUrl }}]";
|
||||
until wget --spider --quiet --timeout=3 --tries=1 {{ $ncUrl }}/status.php;
|
||||
do
|
||||
echo "Waiting for [{{ $ncUrl }}]";
|
||||
sleep 2;
|
||||
done
|
||||
echo "API is up: {{ $ncUrl }}";
|
||||
{{- end -}}
|
||||
@@ -3,17 +3,38 @@ service:
|
||||
nextcloud:
|
||||
enabled: true
|
||||
primary: true
|
||||
{{- if not .Values.ncNetwork.certificateID -}}
|
||||
type: NodePort
|
||||
{{- else }}
|
||||
type: ClusterIP
|
||||
{{- end }}
|
||||
targetSelector: nextcloud
|
||||
ports:
|
||||
webui:
|
||||
enabled: true
|
||||
primary: true
|
||||
{{- if not .Values.ncNetwork.certificateID }}
|
||||
nodePort: {{ .Values.ncNetwork.webPort }}
|
||||
port: {{ .Values.ncNetwork.webPort }}
|
||||
{{- else -}}
|
||||
port: 80
|
||||
{{- end }}
|
||||
targetPort: 80
|
||||
targetSelector: nextcloud
|
||||
{{- if .Values.ncNetwork.certificateID -}}
|
||||
nextcloud-nginx:
|
||||
enabled: true
|
||||
primary: true
|
||||
type: NodePort
|
||||
targetSelector: nginx
|
||||
ports:
|
||||
webui-tls:
|
||||
enabled: true
|
||||
port: {{ .Values.ncNetwork.webPort }}
|
||||
nodePort: {{ .Values.ncNetwork.webPort }}
|
||||
{{- if not .Values.ncNetwork.certificateID }}
|
||||
targetPort: 80
|
||||
{{- end }}
|
||||
targetSelector: nextcloud
|
||||
targetPort: {{ .Values.ncNetwork.webPort }}
|
||||
targetSelector: nginx
|
||||
{{- end }}
|
||||
|
||||
{{- include "ix.v1.common.app.postgresService" $ | nindent 2 }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
{{/* Merge the templates with Values */}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "nextcloud.workload" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "nginx.workload" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "postgres.workload" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "nextcloud.service" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "nextcloud.persistence" $ | fromYaml) -}}
|
||||
|
||||
@@ -17,3 +17,17 @@ resources:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
|
||||
podOptions:
|
||||
dnsConfig:
|
||||
options: []
|
||||
|
||||
ncConfig:
|
||||
additionalEnvs: []
|
||||
commands:
|
||||
- ffmpeg
|
||||
- smbclient
|
||||
|
||||
ncNetwork:
|
||||
webPort: 9001
|
||||
certificateID:
|
||||
|
||||
Reference in New Issue
Block a user