diff --git a/CHANGELOG.md b/CHANGELOG.md index cf1c6c4ec..52b2f8d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Check [README.md](README.md#installation-on-helm-2) ### Added - Implement alternate syntax (https://github.com/jkroepke/helm-secrets/pull/52) - Remote values support (supporting http:// and helm downloader plugins) (https://github.com/jkroepke/helm-secrets/pull/54) +- Let downloader plugin supports remote files and all secrets drivers (https://github.com/jkroepke/helm-secrets/pull/55) ## [3.3.5] - 2020-10-16 diff --git a/USAGE.md b/USAGE.md index 8d3592251..3689c24bf 100644 --- a/USAGE.md +++ b/USAGE.md @@ -298,7 +298,15 @@ kind: Deployment Helm supports [downloader plugin](https://helm.sh/docs/topics/plugins/#downloader-plugins) for value files, too. ``` -helm upgrade . -f sops:// +helm upgrade . -f secrets:// +helm upgrade . -f secret:// +helm upgrade . -f sops:// +``` + +Example: +``` +helm upgrade . -f secrets://localfile.yaml +helm upgrade . -f secrets://git+https://github.com/jkroepke/helm-secrets@tests/assets/values/sops/secrets.yaml?ref=master ``` # Important Tips diff --git a/plugin.yaml b/plugin.yaml index 81d10ba1b..d9b8eba14 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -14,7 +14,7 @@ platformCommand: command: "cmd /c $HELM_PLUGIN_DIR/scripts/wrapper/sh.cmd $HELM_PLUGIN_DIR/scripts/run.sh" downloaders: - - command: "scripts/downloader.sh" + - command: "scripts/run.sh downloader" protocols: - "sops" - "secret" diff --git a/scripts/commands/downloader.sh b/scripts/commands/downloader.sh new file mode 100755 index 000000000..4f64c5465 --- /dev/null +++ b/scripts/commands/downloader.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +set -eu + +# shellcheck source=scripts/commands/view.sh +. "${SCRIPT_DIR}/commands/view.sh" + +downloader() { + # https://helm.sh/docs/topics/plugins/#downloader-plugins + # It's always the 4th parameter + file=$(printf '%s' "${4}" | sed -e 's!(sops|secrets?)://!!') + + view_helper "${file}" +} diff --git a/scripts/downloader.sh b/scripts/downloader.sh deleted file mode 100755 index 18b7b2ca0..000000000 --- a/scripts/downloader.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh - -# https://helm.sh/docs/topics/plugins/#downloader-plugins -# It's always the 4th parameter -file=$(printf '%s' "${4}" | sed -e 's!.*://!!') - -exec sops --decrypt --input-type "yaml" --output-type "yaml" "${file}" diff --git a/scripts/run.sh b/scripts/run.sh index d047cee7e..4707f68ea 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -155,6 +155,13 @@ while true; do clean "$2" break ;; + downloader) + # shellcheck source=scripts/commands/downloader.sh + . "${SCRIPT_DIR}/commands/downloader.sh" + + downloader "$2" "$3" "$4" "$5" + break + ;; --help | -h | help) usage break