Skip to content

Instantly share code, notes, and snippets.

@thejimnicholson
Last active April 28, 2024 22:01
Show Gist options
  • Save thejimnicholson/3babcf7d64046bceaf6828ce6157f2f5 to your computer and use it in GitHub Desktop.
Save thejimnicholson/3babcf7d64046bceaf6828ce6157f2f5 to your computer and use it in GitHub Desktop.
Create flux HelmRepository for each helm repo in local environment

helm2flux.sh

This script will convert all the helm repositories in your local helm environemnt into HelmRepository sources for fluxcd.

Dependencies:

#!/usr/bin/env bash
readarray repos < <(helm repo list -o yaml | yq -o=j -I=0 '.[]')
for repo in "${repos[@]}"; do
name=$(echo "$repo" | yq '.name' -)
url=$(echo "$repo" | yq '.url' -)
flux create source helm "$name" --url="$url" --interval=10m --export > "${name}-source.yaml"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment