• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    Go
  • License
    Other
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Treat any Kustomization or K8s manifests directory as a Helm chart

Helm X Plugin

NOTE: The most important part of this plugin, "chartification" that turns a set of Kubernetes manifests or a kustomization into a temporary chart, is extracted to https://github.com/variantdev/chartify and maintained there. PTAL!

No more "Kustomize vs Helm".

helm-x makes helm better integrate with vanilla Kubernetes manifests, kustomize, and manual sidecar injections.


With helm-x, you can install and sidecar-inject helm charts, manifests, kustomize apps in the same way.

Installing your kustomize app as a helm chart is as easy as running:

$ helm x apply myapp examples/kustomize --version 1.2.3 \
  -f examples/kustomize/values.yaml

Then you can even run a helm test:

$ helm test myapp
RUNNING: myapp-test
PASSED: myapp-test

Show diff before further upgrade:

$ helm x diff myapp examples/kustomize --version 1.2.4 \
  -f examples/kustomize/values.2.yaml

Add an adhoc dependency:

$ helm x diff myapp examples/kustomize --version 1.2.4 \
  -f examples/kustomize/values.2.yaml \
  --adhoc-dependency $ALIAS=stable/mysql:$CHART_VER

Apply JSON patches or Strategic-Merge patches to K8s resources being helm installed:

# See examples/hpa.strategicmergepatch.yaml and examples/hpa.jsonpatch.yaml for examples
$ helm x diff myapp examples/kustomize --version 1.2.4 \
  -f examples/kustomize/values.2.yaml \
  --adhoc-dependency $ALIAS=stable/mysql:$CHART_VER \
  --strategic-merge-patch path/to/strategicmerge.patch.yaml \
  --jsonpatch path/to/json.patch.yaml

Check out the examples in the examples directory!


It keeps all the good things of helm as an extendable package manager.

That is, helm x apply is able to automatically remove resources that have gone from the desired state, without any additions like --prune and --prune-whitelist of kubectl apply.

Also, you can leverage useful helm commands like below, even though your app is written with a tool like kustomize:

  • helm diff to diff your app
  • helm test to test your app
  • helm list to list all the apps running on your cluster, written with whatever tool not only helm.
  • helm package to package your app into a helm chart(even if it was originally written as a kustomization)
  • helm s3 to stored packaged apps into AWS S3 as a chart registry(even if your app is written with kustomize)
  • helm tiller to go tillerless!

If you're familiar with helm, what makes helm-x unique is it runs helm upgrade --install to install your apps described as:

  1. kustomizations
  2. directories containing manifests
  3. local and remote helm charts.

Usage

helm x upgrade(a.k.a helm x apply)

Install or upgrade the helm release from the directory or the chart specified.

Under the hood, this generates Kubernetes manifests from (1)directory containing manifests/kustomization/local helm chart or (2)remote helm chart, then inject sidecars, and finally install the result as a Helm release

When DIR_OR_CHART is a local helm chart, this copies it into a temporary directory, renders all the templates into manifests by running "helm template", and then run injectors to update manifests, and install the temporary chart by running "helm upgrade --install".

It's better than installing it with "kubectl apply -f", as you can leverage various helm sub-commands like "helm test" if you included tests in the "templates/tests" directory of the chart. It's also better in regard to security and reproducibility, as creating a helm release allows helm to detect Kubernetes resources removed from the desired state but still exist in the cluster, and automatically delete unnecessary resources.

When DIR_OR_CHART is a local directory containing Kubernetes manifests, this copies all the manifests into a temporary directory, and turns it into a local Helm chart by generating a Chart.yaml whose version and appVersion are set to the value of the --version flag.

When DIR_OR_CHART contains kustomization.yaml, this runs "kustomize build" to generate manifests, and then run injectors to update manifests, and install the temporary chart by running "helm upgrade --install".

Usage:
  helm-x apply [RELEASE] [DIR_OR_CHART] [flags]

Flags:
      --adhoc-dependency stringArray            Adhoc dependencies to be added to the temporary local helm chart being installed. Syntax: ALIAS=REPO/CHART:VERSION e.g. mydb=stable/mysql:1.2.3
      --adopt strings                           adopt existing k8s resources before apply
      --debug                                   enable verbose output
      --dry-run                                 simulate an upgrade
  -h, --help                                    help for apply
      --inject 'istioctl kube-inject -f FILE'   injector to use (must be pre-installed) and flags to be passed in the syntax of 'istioctl kube-inject -f FILE'. "FILE" is replaced with the Kubernetes manifest file being injected
      --injector --inject "CMD ARG1 ARG2"       DEPRECATED: Use --inject "CMD ARG1 ARG2" instead. injector to use (must be pre-installed) and flags to be passed in the syntax of `'CMD SUBCMD,FLAG1=VAL1,FLAG2=VAL2'`. Flags should be without leading "--" (can specify multiple). "FILE" in values are replaced with the Kubernetes manifest file being injected. Example: "--injector 'istioctl kube-inject f=FILE,injectConfigFile=inject-config.yaml,meshConfigFile=mesh.config.yaml"
      --install                                 install the release if missing (default true)
      --json-patch stringArray                  Kustomize JSON Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --kubecontext string                      name of the kubeconfig context to use
      --namespace string                        namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace
      --set stringArray                         set values on the command line (can specify multiple)
      --strategic-merge-patch stringArray       Kustomize Strategic Merge Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --tiller-namespace string                 namespace to in which release configmap/secret objects reside (default "kube-system")
      --timeout int                             time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300)
      --tls                                     enable TLS for request
      --tls-cert string                         path to TLS certificate file (default: $HELM_HOME/cert.pem)
      --tls-key string                          path to TLS key file (default: $HELM_HOME/key.pem)
  -f, --values stringArray                      specify values in a YAML file or a URL (can specify multiple)
      --version string                          specify the exact chart version to use. If this is not specified, the latest version is used

helm x diff

Show a diff explaining what helm x apply would change.

Under the hood, this generates Kubernetes manifests from (1)directory containing manifests/kustomization/local helm chart or (2)remote helm chart, then inject sidecars, and finally print the resulting manifests

When DIR_OR_CHART is a local helm chart, this copies it into a temporary directory, renders all the templates into manifests by running "helm template", and then run injectors to update manifests, and prints the results.

When DIR_OR_CHART is a local directory containing Kubernetes manifests, this copies all the manifests into a temporary directory, and turns it into a local Helm chart by generating a Chart.yaml whose version and appVersion are set to the value of the --version flag.

When DIR_OR_CHART contains kustomization.yaml, this runs "kustomize build" to generate manifests, and then run injectors to update manifests, and prints the results.

Usage:
  helm-x diff [RELEASE] [DIR_OR_CHART] [flags]

Flags:
      --adhoc-dependency stringArray            Adhoc dependencies to be added to the temporary local helm chart being installed. Syntax: ALIAS=REPO/CHART:VERSION e.g. mydb=stable/mysql:1.2.3
      --debug                                   enable verbose output
  -h, --help                                    help for diff
      --inject 'istioctl kube-inject -f FILE'   injector to use (must be pre-installed) and flags to be passed in the syntax of 'istioctl kube-inject -f FILE'. "FILE" is replaced with the Kubernetes manifest file being injected
      --injector --inject "CMD ARG1 ARG2"       DEPRECATED: Use --inject "CMD ARG1 ARG2" instead. injector to use (must be pre-installed) and flags to be passed in the syntax of `'CMD SUBCMD,FLAG1=VAL1,FLAG2=VAL2'`. Flags should be without leading "--" (can specify multiple). "FILE" in values are replaced with the Kubernetes manifest file being injected. Example: "--injector 'istioctl kube-inject f=FILE,injectConfigFile=inject-config.yaml,meshConfigFile=mesh.config.yaml"
      --json-patch stringArray                  Kustomize JSON Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --kubecontext string                      name of the kubeconfig context to use
      --namespace string                        namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace
      --set stringArray                         set values on the command line (can specify multiple)
      --strategic-merge-patch stringArray       Kustomize Strategic Merge Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --tiller-namespace string                 namespace to in which release configmap/secret objects reside (default "kube-system")
      --tls                                     enable TLS for request
      --tls-cert string                         path to TLS certificate file (default: $HELM_HOME/cert.pem)
      --tls-key string                          path to TLS key file (default: $HELM_HOME/key.pem)
  -f, --values stringArray                      specify values in a YAML file or a URL (can specify multiple)
      --version string                          specify the exact chart version to use. If this is not specified, the latest version is used

helm x template

Print Kubernetes manifests that would be generated by helm x apply

Under the hood, this generates Kubernetes manifests from (1)directory containing manifests/kustomization/local helm chart or (2)remote helm chart, then inject sidecars, and finally print the resulting manifests

When DIR_OR_CHART is a local helm chart, this copies it into a temporary directory, renders all the templates into manifests by running "helm template", and then run injectors to update manifests, and prints the results.

When DIR_OR_CHART is a local directory containing Kubernetes manifests, this copies all the manifests into a temporary directory, and turns it into a local Helm chart by generating a Chart.yaml whose version and appVersion are set to the value of the --version flag.

When DIR_OR_CHART contains kustomization.yaml, this runs "kustomize build" to generate manifests, and then run injectors to update manifests, and prints the results.

Usage:
  helm-x template [DIR_OR_CHART] [flags]

Flags:
      --adhoc-dependency stringArray            Adhoc dependencies to be added to the temporary local helm chart being installed. Syntax: ALIAS=REPO/CHART:VERSION e.g. mydb=stable/mysql:1.2.3
      --as-release helm [upgrade|install]       turn the result into a proper helm release, by removing hooks from the manifest, and including a helm release configmap/secret that should otherwise created by helm [upgrade|install]
      --debug                                   enable verbose output
  -h, --help                                    help for template
      --inject 'istioctl kube-inject -f FILE'   injector to use (must be pre-installed) and flags to be passed in the syntax of 'istioctl kube-inject -f FILE'. "FILE" is replaced with the Kubernetes manifest file being injected
      --injector --inject "CMD ARG1 ARG2"       DEPRECATED: Use --inject "CMD ARG1 ARG2" instead. injector to use (must be pre-installed) and flags to be passed in the syntax of `'CMD SUBCMD,FLAG1=VAL1,FLAG2=VAL2'`. Flags should be without leading "--" (can specify multiple). "FILE" in values are replaced with the Kubernetes manifest file being injected. Example: "--injector 'istioctl kube-inject f=FILE,injectConfigFile=inject-config.yaml,meshConfigFile=mesh.config.yaml"
      --json-patch stringArray                  Kustomize JSON Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --kubecontext string                      name of the kubeconfig context to use
      --name string                             release name (default "release-name") (default "release-name")
      --namespace string                        namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace
      --set stringArray                         set values on the command line (can specify multiple)
      --strategic-merge-patch stringArray       Kustomize Strategic Merge Patch file to be applied to the rendered K8s manifests. Allows customizing your chart without forking or updating
      --tiller-namespace string                 namespace to in which release configmap/secret objects reside (default "kube-system")
      --tiller-namsepace string                 namespace in which release confgimap/secret objects reside (default "kube-system")
  -f, --values stringArray                      specify values in a YAML file or a URL (can specify multiple)
      --version string                          specify the exact chart version to use. If this is not specified, the latest version is used

helm x adopt

Adopt a set of existing K8s resources as if they are installed originally as a Helm chart.

Adopt the existing kubernetes resources as a helm release

RESOURCES are represented as a whitespace-separated list of kind/name, like:

  configmap/foo.v1 secret/bar deployment/myapp

So that the full command looks like:

  helm x adopt myrelease configmap/foo.v1 secret/bar deployment/myapp

Usage:
  helm-x adopt [RELEASE] [RESOURCES]... [flags]

Flags:
  -h, --help                      help for adopt
      --kubecontext string        the kubeconfig context to use
      --namespace string          The namespace in which the resources to be adopted reside
      --tiller-namespace string   the tiller namespaceto use (default "kube-system")
      --tls                       enable TLS for request
      --tls-cert string           path to TLS certificate file (default: $HELM_HOME/cert.pem)
      --tls-key string            path to TLS key file (default: $HELM_HOME/key.pem)

Install

$ helm plugin install https://github.com/mumoshu/helm-x

The above will fetch the latest binary release of helm-x and install it.

Developer (From Source) Install

If you would like to handle the build yourself, instead of fetching a binary, this is how recommend doing it.

First, set up your environment:

  • You need to have Go 1.12 or greater installed.

Clone this repo anywhere OUSTSIDE of your $GOPATH:

$ git clone [email protected]:mumoshu/helm-x
$ make install

If you don't want to install it as a helm plugin, you can still run it stand-alone:

$ make build
$ ./helm-x template --name myapp examples/manifests/ --version 1.2.3
$ ./helm-x diff myapp examples/manifests/ --version 1.2.3 --debug
$ ./helm-x apply myapp examples/manifests/ --version 1.2.3 --debug

Notes

  • Not all flags present in the original helm diff, helm template, helm upgrade flags are implemented. If you need any other flags, please feel free to open issues and even submit pull requests.
  • If you are using the --kube-context flag, you need to change it to --kubecontext, since helm plugins drop this flag.

Prior Arts

  1. Customizing Upstream Helm Charts with Kustomize | Testing Clouds at 128bpm

Relies on helm template to generate K8s manifests that kustomize can work on. This method implies that you can't use helm for release management, as also explained in the original article as follows:

First, Helm is no longer controlling releases of manifests into the cluster. This means that you cannot use helm rollback or helm list or any of the helm release related commands to manage your deployments.

helm-x, on the other hand, solves this issue by treating the final output of kustomize as a temporary Helm chart, and actually helm-install it.

Acknowledgements

This project's implementation has been largely inspired from the awesome helm-inject project maintained by @maorfr. Thanks a lot for your work, @maorfr!

More Repositories

1

kube-airflow

A docker image and kubernetes config files to run Airflow on Kubernetes
Python
649
star
2

aws-secret-operator

A Kubernetes operator that automatically creates and updates Kubernetes secrets according to what are stored in AWS Secrets Manager.
Go
309
star
3

variant

Wrap up your bash scripts into a modern CLI today. Graduate to a full-blown golang app tomorrow.
Go
301
star
4

terraform-provider-eksctl

Manage AWS EKS clusters using Terraform and eksctl
Go
232
star
5

play2-memcached

A memcached plugin for Play 2.x
Scala
162
star
6

variant2

Turn your bash scripts into a modern, single-executable CLI app today
Go
134
star
7

terraform-provider-helmfile

Deploy Helmfile releases from Terraform
Go
115
star
8

kube-ssm-agent

Secure, access-controlled, and audited terminal sessions to EKS nodes without SSH
Dockerfile
106
star
9

kube-spot-termination-notice-handler

Moved to https://github.com/kube-aws/kube-spot-termination-notice-handler
Shell
97
star
10

concourse-aws

Auto-scaling Concourse CI v2.2.1 on AWS with Terraform (since 2016.04.14)
Go
72
star
11

play2-typescript

TypeScript assets handling for Play 2.0. Compiles .ts files under the /assets dir along with the project.
Scala
72
star
12

crossover

Minimal sufficient Envoy xDS for Kubernetes that knows https://smi-spec.io/
Go
71
star
13

helmfile-operator

Kubernetes operator that continuously syncs any set of Chart/Kustomize/Manifest fetched from S3/Git/GCS to your cluster
Go
62
star
14

okra

Hot-swap Kubernetes clusters while keeping your service up and running.
Go
48
star
15

decouple-apps-and-eks-clusters-with-tf-and-gitops

Smarty
31
star
16

kodedeploy

CodeDeploy for EKS. Parallel and Continuous (re)delivery to multiple EKS clusters. Blue-green deployment "of" EKS clusters.
Shell
29
star
17

config-registry

Switch between kubeconfigs and avoid unintentional operation on your production clusters.
Go
28
star
18

gosh

(Re)write your bash script in Go and make it testable too
Go
24
star
19

tiny-mmo

A work-in-progress example of server-side implementation of a tiny massive multi-player online game, implemented with Scala 2.10.2 and Akka 2.2
Java
23
star
20

geohash-scala

Geohash library for scala
Scala
23
star
21

prometheus-process-exporter

Helml chart for Prometheus process-exporter
Mustache
22
star
22

waypoint-plugin-helmfile

Helmfile deployment plugin for HashiCorp Waypoint
Go
15
star
23

kube-magic-ip-address

daemonset that assigns a magic IP address to pods. Useful for implementing node-local services on Kubernetes. Use in combination with dd-agent, dd-zipkin-proxy, kube2iam, kiam, and Elastic's apm-server
Shell
15
star
24

kube-fluentd

An ubuntu-slim/s6-overlay/confd based docker image for running fluentd in Kubernetes pods/daemonsets
Makefile
15
star
25

node-detacher

Practically and gracefully stop your K8s node on (termination|scale down|maintenance)
Go
13
star
26

kube-node-init

Kubernetes daemonset for node initial configuration. Currently for modifying files and systemd services on eksctl nodes without changing userdata
Smarty
13
star
27

lambda_bot

JavaScript
12
star
28

argocd-clusterset

A command-line tool and Kubernetes controller to sync EKS clusters into ArgoCD cluster secrets
Go
12
star
29

dcind

Docker Compose (and Daemon) in Docker
Shell
12
star
30

flux-repo

Enterprise-grade secrets management for GitOps
Go
10
star
31

brigade-helmfile-demo

Demo for building an enhanced GitOps pipeline with Flux, Brigade and Helmfile
JavaScript
9
star
32

kubeherd

A opinionated toolkit to automate herding your cattles = ephemeral Kubernetes clusters
Shell
9
star
33

sopsed

Spawning and storage of secure environments powered by sops, inspired from vaulted. Out-of-box support for kubectl, kube-aws, helm, helmfile
Go
9
star
34

helmfile-gitops

8
star
35

nodelocaldns

Temporary location of the nodelocaldns chart until it is upstreamed to helm/charts
Smarty
8
star
36

kube-logrotate

An ubuntu-slim/s6-overlay/confd based docker image for running logrotate via Kubernetes daemonsets
Makefile
7
star
37

idea-play

A plugin for IntelliJ IDEA which supports development of Play framework applications.
Java
7
star
38

actions-runner-controller-ci

Test repo for https://github.com/summerwind/actions-runner-controller
Go
6
star
39

kargo

Deploy your Kubernetes application directly or indirectly
Go
6
star
40

shoal

Declarative, Go-embeddable, and cross-platform package manager powered by https://gofi.sh/
Go
6
star
41

ingress-daemonset-controller

Build your own highly available and efficient external ingress loadbalancer on Kubernetes
Go
6
star
42

conflint

Unified lint runners for various configuration files
Go
5
star
43

fluent-plugin-datadog-log

Sends logs to Datadog Log Management: A port/translation of https://github.com/DataDog/datadog-log-agent to a Fluentd plugin
Ruby
5
star
44

play20-zentasks-tests

Added spec2 tests to Play20's 'zentasks
Scala
4
star
45

nomidroid

Android app to find nearby restaurants, bars, etc with Recruit Web API
Java
4
star
46

versapack

Versatile package manager. Version and host anything in Helm charts repositories
4
star
47

vote4music-play20

A Play 2.0 RC1 port of https://github.com/loicdescotte/vote4music
Scala
4
star
48

homebrew-anyenv

Ruby
4
star
49

terraform-provider-kubectl

Run kubectl against multiple K8s clusters in a single terraform-apply. AWS auth/AssumeRole supported.
Go
3
star
50

kube-node-index-prioritizing-scheduler

Kubernetes scheduler extender that uses sorted nodes' positions as priorities. Use in combination with resource request/limit to implement low-latency highly available front proxy cluster
Go
3
star
51

depot

Ruby
2
star
52

kokodoko

JavaScript
2
star
53

brigade-cd

Go
2
star
54

scripts

my scripts for linux machines
Shell
2
star
55

courier

Go
2
star
56

nodejs-chat

JavaScript
2
star
57

ooina

JavaScript
2
star
58

play-websocket-growl-sample

A sample application notifies the server on Growl, and other users via WebSocket
Java
2
star
59

heartbeat-operator

Monitor any http and tcp services via Kubernetes custom resources
Shell
2
star
60

brigade-automation

TypeScript
2
star
61

nbxmpfilter

xmpfilter for NetBeans
2
star
62

play-scala-lobby-example

Java/Scala mixed app with a WebSocketController in Java, while others are in Scala.
JavaScript
2
star
63

wy

Go
2
star
64

docker-squid-gem-proxy

Dockerfile for building docker image to run Squid-based reverse proxies to rubygems.org, for speeding-up `gem install` or `bundle install`
Shell
2
star
65

hcl2-yaml

YAML syntax for HashiCorp Configuration Language Version 2
Go
2
star
66

tweet_alarm_clock_android

Java
2
star
67

testkit

A toolkit for writing Go tests for your cloud apps, infra-as-code, and gitops configs
Go
1
star
68

elasticdrone

A set of tools to configure auto-scaled Drone.io cluster on AWS in ease
JavaScript
1
star
69

kubeaws-cicd-pipeline-golang

An example of the opinionated deployment pipeline for your Kubernetes-on-AWS-native apps. Secure, declarative, customizable, open app deployments at your hand.
Shell
1
star
70

akka-parallel-tasks

Scala
1
star
71

sing

1
star
72

good-code-is-red-example-for-idea-scala-plugin

Scala
1
star
73

share-snippets

JavaScript
1
star
74

scala-scalable-programming-sidenote

Scala
1
star
75

teleport-on-minikube

Shell
1
star
76

genrun

Go
1
star
77

nomidroid_test

tests for nomidroid the android app.
Java
1
star
78

web_smartphonizer

Scala
1
star
79

idobata4s

The Scala client library for idobata.io API
Scala
1
star
80

specs2-sandbox

Scala
1
star
81

kube-distributed-test-runner

Go
1
star
82

delimited-continuation

An example usage of Delimited Continuation in Scala,;implementing an async HTTP client.
Scala
1
star
83

play2-unit-tests-sample

1
star
84

syaml

Set YAML values with `cat your.yaml | syaml a.b.c newValue`
Go
1
star
85

scala-debian-package

1
star
86

glabel

A GOverlay implementation for putting text labels on GMap2
JavaScript
1
star
87

gitops-demo

Makefile
1
star
88

division

Control-plane of your microservices and Kubernetes clusters
Go
1
star
89

sam-containerized-go-example

Go
1
star
90

mumoauth

Yet another implementation of OAuth aiming to cover both OAuth 1.0a and 2, from Client to Server.
Scala
1
star
91

javascript-missiles-and-lasers

JavaScript
1
star
92

kube-veneur

Sidecar container to run local veneur and Kubernetes service for global https://github.com/stripe/veneur. Uses confd and s6-overlay under the hood.
Makefile
1
star
93

tweet_alarm_clock_android_test

Java
1
star
94

thread_local

An implementation of the thread-local variable for Ruby
Ruby
1
star
95

play-multijpa

a Play! plugin to switch databases for each play.db.jpa.Model subclass
Java
1
star
96

argocd-example-apps

Jsonnet
1
star
97

javascript-hue_circle

Draw a hue circle in JavaScript
JavaScript
1
star
98

logrus-bunyan-formatter

Logrus Bunyan Log Formatter
Go
1
star
99

crdb

Custom Resource DB - Kubernetes custom resources without Kubernetes or self-hosted databases. For any cloud, by leveraging cloudprovider-specific managed databases like AWS DynamoDB
Go
1
star