Allow using kubectl built-in kustomize if separate kustomize binary is missing
You can run kustomize commands with kubectl like this:
kubectl kustomize ...
Either fall back automatically to the kubectl built-in kustomize, or allow the user to select it.
The feature to add a custom binary recently got added(#62), maybe it can be used to solve this problem.
As far as I can tell I could just feed kubectl kustomize as the kustomizeBinary, and it should work, the runner implementation handles args passed in kustomizeBinary by splitting and treating args correctly:
https://github.com/helmfile/chartify/blob/a67147abb126ef064864cb2cd067b8f859290bde/runner.go#L128-L138
I'm using chartify through helmfile, so I'll wait until this feature lands in helmfile to verify.
Managed to get around testing this.
So problem is that when I pass kustomizeBinary: kubectl kustomize to helmfile, I get this:
kubectl build /var/folders/qn/hzhf777s1vx9lr4xc8zj1f_h0000gn/T/chartify3414166477/actions/actions-runner-controller --output /var/folders/qn/hzhf777s1vx9lr4xc8zj1f_h0000gn/T/chartify3414166477/actions/actions-runner-controller/all.patched.yaml --enable_alpha_plugins
OUTPUT:
error: unknown command "build" for "kubectl"]
I did manage to write a kustomize-shim script to make kubectl kustomize work with helmfile:
#!/usr/bin/env bash
if [ "$1" == "version" ]; then
kubectl version --client --short 2>/dev/null | awk '/Kustomize/{print $NF}'
exit
elif [ "$1" == "build" ]; then
shift
exec kubectl kustomize $@
else
echo "Could not shim kustomize: $@" >&2
exit 99
fi
Then in helmfile.yaml:
kustomizeBinary: kustomize-shim
Turns out the above shim doesn't always work because chartify also runs kustomize edit in some cases, but kubectl kustomize does not support edit...