Giter VIP home page Giter VIP logo

helm-sops's Introduction

Helm Sops

Helm Sops is a Helm wrapper which decrypts Sops encrypted value files before invoking Helm. It does so by using named pipes to pass cleartext value files to Helm in order to avoid secrets being written to disk in clear.

Installation

Prerequisites

Helm is needed for Helm Sops to work. Follow the instructions here to install it.

Getting Helm Sops binary

Helm Sops releases

Helm Sops released binaries can be downloaded from GitHub.

Building from sources

Helm Sops can be built using the go build command.

Deploying Helm Sops

Deploy Helm Sops executable (helm-sops) in a directory present in the PATH. When invoking Helm Sops, it will look for a Helm executable named helm in the PATH.

Alternatively, Helm Sops executable can be renamed helm before deploying it. When invoked as helm, Helm Sops will look for a Helm executable named _helm in the PATH.

Usage

Create encrypted value files using Sops

To pass these encrypted value files to Helm, just invoke Helm Sops with the same arguments which would be used for the Helm invocation (for example
helm-sops template . --values secrets.yaml --values secrets-production.yaml or
helm template . --values secrets.yaml --values secrets-production.yaml
depending on how Helm Sops was deployed).

Example application

An example application as well as an example Argo CD setup to deploy it can be found here.

Git diff helper

The following script (sops-git-diff-helper) can be placed in the PATH to be used as a Git diff helper for Sops encrypted value files:

#! /bin/sh

if [ $# -ne 1 ]
then
	exit 1
fi

if [ -n "${SOPS_ENCRYPTED_DIFF}" ]
then
	cat "$1"
else
	sops -d "$1" 2>&1 || cat "$1"
fi

To enable it, run git config --global diff.sops.textconv sops-git-diff-helper and add the following lines to the .gitattributes file in your Git repository:

*.yaml diff=sops

helm-sops's People

Contributors

dependabot[bot] avatar hbollon avatar teejaded avatar vampouille avatar yann-soubeyrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helm-sops's Issues

Extend helm-sops to support pass-through of exit codes returned by plugins.

helm-sops summarily returns an exit code of 1 irrespective of the error encountered (and hence, exit code generated) upstream by helm (please cf. https://git.lystit.com/lyst/helm-sops/blob/f6776ac5af1ac0b2e49b67aa6b7f1401b0c44425/main.go#L223). As a result, it breaks workflows where other tools rely on the various exit codes generated by helm to perform further actions. As an example, please consider our workflow for deploying Helm charts.

We use Helmfile to deploy Helm charts. Helmfile's USP is that it allows one to maintain declarative manifests of customisations to a chart and provides the facility to conditionally update them in a cluster. In order for the conditional part to work, Helmfile relies on helm-diff under the hood to check for deltas.

Post-execution, helm returns:

  • the exit code of the plugin if a plugin was executed or,
  • an exit code of 1 if there was an issue or of 0 if everything worked

If the plugin in question is helm-diff, then one of the following exit codes gets returned:

  • 0, if there's no error and no diff,
  • 1, if there's an error, or,
  • 2, if there no error but a diff

To tie this back to our workflow, an exit code of 2 is used by Helmfile to determine whether to (re)install a chart or not.

Now, introducing helm-sops into our workflow breaks it instantly since it gobbles up the exit code of 2 returned by helm and passes the exit code of 1 to Helmfile instead, causing it to exit with an error.

May I, therefore, request that helm-sops be extended to support pass-through of exit codes returned by plugins?

Thanks.

References

Limitation on secrets filenames is a poor UX

The secrets*.yaml type naming restriction is a bit awkward - it's a bad user experience that has tripped me up a few times even when I knew it existed. It misses out on matching .yml files or secret-things.yaml, and at least some more recent forks of the plugin (e.g. https://github.com/jkroepke/helm-secrets that I use) have no such restriction - so helm secrets xxx works and helm-sops doesn't.

Can you not peek at every values-file in the argument list, and see if they contain a valid-looking sops/version key so its likely it's a sops file?

This was also requested on the original futuresimple version, see zendesk/helm-secrets#155.

AGE support

Does this tool support AGE inplace of GNU PG?

Please add a LICENSE

Hi, this looks very useful, but it does not have a license, so strictly speaking nobody has the right to use this (besides the original authors, ofc).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.