Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hydeenoble/helm-subenv

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.
https://github.com/hydeenoble/helm-subenv

env environment-variables helm helm-plugin helm-plugins substitute values

Last synced: 2 months ago
JSON representation

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.

Awesome Lists containing this project

README

        

# helm-subenv
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/hydeenoble/helm-subenv.svg)](https://github.com/hydeenoble/helm-subenv/releases)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/helm-subenv)](https://artifacthub.io/packages/search?repo=helm-subenv)

This Helm plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline.

## Install

The installation itself is simple as:

```bash
helm plugin install https://github.com/hydeenoble/helm-subenv.git
```
You can install a specific release version:
```bash
helm plugin install https://github.com/hydeenoble/helm-subenv.git --version
```

To use the plugin, you do not need any special dependencies. The installer will download the latest release with prebuilt binary from [GitHub releases](https://github.com/hydeenoble/helm-subenv/releases).

## Usage

### Single file usage
```bash
helm subenv -f
```

### Multiple files usage
```bash
helm subenv -f -f -f
```

### Directory usage
The plugin can also be used to recursively substitute environment variables in all the files in a specified directory.
```bash
helm subenv -f
```

### Mix files and directories
You can also decide to mix files and directories:
```bash
helm subenv -f -f
```

## Example
Sample helm values file:
```yaml
# values.yaml

image:
repository: $REGISTRY/$IMAGE_NAME
tag: $IMAGE_TAG
```
Environment variables configured in your environment (this should most likely be configured with your CI environment):
```txt
REGISTRY => docker.com
IMAGE_NAME => helm-subenv
IMAGE_TAG => test
```
Substitute Env:
```bash
helm subenv -f values.yaml
```
Result:
```yaml
image:
repository: docker.com/helm-subenv
tag: test
```
**Note:** If the value of the environment variable does not exist, it will be replaced with an empty string. For instance, from the above example, if `IMAGE_TAG` does not exist as an environment variable in the environment the result would have been:

```yaml
image:
repository: docker.com/helm-subenv
tag:
```

## Uninstall
```bash
helm plugin remove subenv
```

## Testing locally
To test locally, run the command below to build and run the binary:
> You need to have [Go](https://go.dev/) installed. Make sure to set `$GOPATH`
```bash
go build -o subenv && ./subenv -f
```
## License

[MIT](LICENSE)