From cee4781e7afb9ef36e0815c9d77486edebcece52 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 4 Jul 2023 23:52:41 +0300 Subject: [PATCH] adds smb_client binary option (#1327) --- library/ix-dev/charts/nextcloud/Chart.yaml | 2 +- .../charts/nextcloud/ci/test-values.yaml | 1 + .../ix-dev/charts/nextcloud/questions.yaml | 6 ++++ .../nextcloud/templates/deployment.yaml | 29 ++++++++++++++----- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/library/ix-dev/charts/nextcloud/Chart.yaml b/library/ix-dev/charts/nextcloud/Chart.yaml index fffb3c71bf..c07d7d099b 100644 --- a/library/ix-dev/charts/nextcloud/Chart.yaml +++ b/library/ix-dev/charts/nextcloud/Chart.yaml @@ -4,7 +4,7 @@ description: A file sharing server that puts the control and security of your ow annotations: title: Nextcloud type: application -version: 1.6.31 +version: 1.6.32 apiVersion: v2 appVersion: 27.0.0 kubeVersion: '>=1.16.0-0' diff --git a/library/ix-dev/charts/nextcloud/ci/test-values.yaml b/library/ix-dev/charts/nextcloud/ci/test-values.yaml index a8926c1719..597503b117 100644 --- a/library/ix-dev/charts/nextcloud/ci/test-values.yaml +++ b/library/ix-dev/charts/nextcloud/ci/test-values.yaml @@ -14,6 +14,7 @@ nextcloud: datadir: /var/www/html/data host: nextcloud.kube.home install_ffmpeg: true + install_smbclient: true password: changeme username: admin postgresAppVolumeMounts: diff --git a/library/ix-dev/charts/nextcloud/questions.yaml b/library/ix-dev/charts/nextcloud/questions.yaml index bbc6e09794..25aa585e83 100644 --- a/library/ix-dev/charts/nextcloud/questions.yaml +++ b/library/ix-dev/charts/nextcloud/questions.yaml @@ -110,6 +110,12 @@ questions: schema: type: boolean default: false + - variable: install_smbclient + label: "Install smbclient" + description: "Automatically Install smbclient when the container starts" + schema: + type: boolean + default: false - variable: cronjob description: "Setup cronjob for nextcloud" diff --git a/library/ix-dev/charts/nextcloud/templates/deployment.yaml b/library/ix-dev/charts/nextcloud/templates/deployment.yaml index fc88cd52e3..c8ba72ea51 100644 --- a/library/ix-dev/charts/nextcloud/templates/deployment.yaml +++ b/library/ix-dev/charts/nextcloud/templates/deployment.yaml @@ -122,21 +122,34 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }} failureThreshold: 5 successThreshold: 1 startupProbe: - {{- if .Values.nextcloud.install_ffmpeg }} + {{ $cmds := list }} + {{ if .Values.nextcloud.install_ffmpeg }} + {{ $cmds = mustAppend $cmds "ffmpeg" }} + {{ end }} + {{ if .Values.nextcloud.install_smbclient }} + {{ $cmds = mustAppend $cmds "smbclient" }} + {{ end }} + {{ if $cmds }} exec: command: - /bin/sh - -c - | - command -v ffmpeg /dev/null 2>&1 || exit 1 - {{- else }} + commands_to_check={{ join " " $cmds }} + for comm in $commands_to_check; do + if ! command -v $comm /dev/null 2>&1; then + echo "Command $comm not found" + exit 1 + fi + done + {{ else }} httpGet: path: /status.php port: http httpHeaders: - name: Host value: localhost - {{- end }} + {{ end }} initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 @@ -168,7 +181,7 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }} - name: extrappvolume-{{ $index }} mountPath: {{ $hostPathConfiguration.mountPath }} {{ end }} - {{- if .Values.nextcloud.install_ffmpeg }} + {{ if $cmds }} lifecycle: postStart: exec: @@ -176,12 +189,12 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }} - /bin/sh - -c - | - echo "Installing ffmpeg..." + echo "Installing {{ join " " $cmds }}..." apt update && \ apt install -y --no-install-recommends \ - ffmpeg || echo "Failed to install ffmpeg" + {{ join " " $cmds }} || echo "Failed to install binary/binaries" echo "Finished." - {{- end }} + {{ end }} {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }} volumes: - name: nginx-configuration