A KRM function to enable Helm on Kustomize with Glob support
The motivation for this project is quite simple. While Helm integration in Kustomize is already available, it falls short in scenarios where dynamic use of Glob is required to fetch all necessary values.yaml files. In such cases, it lacks support. With the likelihood of glob support being added to Kustomize remaining uncertain for the foreseeable future, this project was initiated to address this limitation.
cat <<EOF > release-simple.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: simple-a
namespace: default
annotations:
config.kubernetes.io/function: |
exec:
path: helmize
spec:
chart: minecraft
repo:
name: minecraft
url: https://itzg.github.io/minecraft-server-charts
EOF
cat <<EOF > release-with-glob.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: service-a
namespace: default
annotations:
config.kubernetes.io/function: |
exec:
path: helmize
spec:
chart: common-app
repo:
name: ardikabs
url: https://charts.ardikabs.com
version: 0.4.1
values:
- values.yaml
- values/*.yaml
- values/**/*.yaml
EOF
cat <<EOF > release-with-oci-repo.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: envoy-gateway
namespace: envoy-gateway-system
annotations:
config.kubernetes.io/function: |
exec:
path: helmize
spec:
repo:
url: oci://docker.io/envoyproxy/gateway-helm
version: v0.5.0
includeCRDs: true
createNamespace: true
EOF
cat <<EOF > kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
generators:
- release-simple.yaml
- release-with-glob.yaml
- release-with-oci-repo.yaml
EOF
kustomize build --enable-alpha-plugins --enable-exec .
curl -sSfL -O https://github.com/ardikabs/helmize/releases/download/v0.1.1/helmize_0.1.1_linux_amd64
export HELMIZE_PLUGIN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/kustomize/plugin/toolkit.ardikabs.com/v1alpha1/helmrelease"
mkdir -p $HELMIZE_PLUGIN_DIR
mv helmize_0.1.1_linux_amd64 "${HELMIZE_PLUGIN_DIR}/HelmRelease"
cat <<EOF > release-simple.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: simple-a
namespace: default
spec:
chart: minecraft
repo:
name: minecraft
url: https://itzg.github.io/minecraft-server-charts
EOF
cat <<EOF > release-with-glob.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: service-a
namespace: default
spec:
chart: common-app
repo:
name: ardikabs
url: https://charts.ardikabs.com
version: 0.4.1
values:
- values.yaml
- values/*.yaml
- values/**/*.yaml
EOF
cat <<EOF > release-with-oci-repo.yaml
apiVersion: toolkit.ardikabs.com/v1alpha1
kind: HelmRelease
metadata:
name: envoy-gateway
namespace: envoy-gateway-system
spec:
repo:
url: oci://docker.io/envoyproxy/gateway-helm
version: v0.5.0
includeCRDs: true
createNamespace: true
EOF
cat <<EOF > kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
generators:
- release-simple.yaml
- release-with-glob.yaml
- release-with-oci-repo.yaml
EOF
kustomize build --enable-alpha-plugins .
For more example, please refer to examples directory.