A tool to take a deployed set of kubernetes resources and turn them into a helm release. Only works with helm3 > 3.2.0
Go to file
Martyn f31422e6b3
continuous-integration/drone/push Build is passing Details
Copy pasta typo
Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
2020-11-16 11:23:56 +01:00
build more ci fixes 2020-11-16 10:23:35 +01:00
cmd Copy pasta typo 2020-11-16 11:23:56 +01:00
internal/exporters Works, mostly. 2020-11-15 23:46:00 +01:00
.gitignore Initial commit 2020-11-12 15:11:25 +00:00
LICENSE Initial commit 2020-11-12 15:11:25 +00:00
Makefile Fixup CI with releases 2020-11-16 10:05:25 +01:00
README.md Updating readme 2020-11-16 00:04:41 +01:00
go.mod Works, mostly. 2020-11-15 23:46:00 +01:00
go.sum Works, mostly. 2020-11-15 23:46:00 +01:00

README.md

helm-import

A tool to take a deployed set of kubernetes resources and turn them into a helm release.

Only works with helm3 > 3.2.0

Only compiles with Go < 1.15

And it's a pain to cross-compile, and my ci is currently broken

You can add jq commands to tweak the generation.

You run it from the chart folder (the one with Chart.yaml) in it

It's fairly opinionated but that can be turned off.

There's some kinda hacky stuff in the code related to json->yaml->helm stuff.

so... erm here's a docker command that worked for me :

docker run -v $(pwd):/context -v $HOME/.kube:/root/.kube --rm -it -w /context/ imartyn/helm-import /helm-import -namespace some-namespace -deployment some-deployment

and here's the help screen :

Usage of helm-import:
  -configmap value
        configmap to import into the helm chart (can be specified multiple times)
  -configmapJqCommands value
        extra jq commands to apply to configmaps
  -deployment value
        deployment to import into the helm chart (can be specified multiple times)
  -deploymentJqCommands value
        extra jq commands to apply to deployments
  -globalJqCommands value
        extra jq commands to apply to all k8s objects
  -ingress value
        ingress to import into the helm chart (can be specified multiple times)
  -ingressJqCommands value
        extra jq commands to apply to ingresses
  -kubeconfig string
        (optional) absolute path to the kubeconfig file (default "/home/martyn/.kube/config")
  -lessopinions
        just import the objects into files, don't get opinionated
  -namespace string
        namespace to work in (default "default")
  -nobuiltinmods
        don't do the built-in modifications, only ones passed in by user
  -secret value
        secret to import into the helm chart (can be specified multiple times)
  -secretJqCommands value
        extra jq commands to apply to secrets
  -service value
        service to import into the helm chart (can be specified multiple times)
  -serviceJqCommands value
        extra jq commands to apply to services

TODO:

  • label the resources
  • make ci work again
  • cross-compile, now I know it was a go-1.15 issue first time