Open mkocur-ledger opened 5 months ago
Hello @mkocur-ledger! I'm here to help you with any issues or questions you have regarding this repository. If you need assistance, feel free to ask.
To resolve the error "failed to load generator: expected file with Go object code at: /Users/user/.config/kustomize/plugin/viaduct.ai/v1/ksops/ksops.so" when running kustomize build --enable-alpha-plugins --enable-exec --enable-helm '/mydir'
, you need to ensure that the ksops
plugin is correctly installed and available in the expected directory.
Here are the steps to ensure the plugin is correctly installed:
Set the XDG_CONFIG_HOME
environment variable:
Ensure that XDG_CONFIG_HOME
is set to $HOME/.config
in your shell configuration file (.bashrc
or .zshrc
).
export XDG_CONFIG_HOME=$HOME/.config
Run the installation script:
Execute the provided installation script to download and place the ksops
plugin in the correct directory. You can use the following script:
#!/bin/bash
set -e
PLUGIN_PATH="$XDG_CONFIG_HOME/kustomize/plugin/viaduct.ai/v1/ksops/"
if [[ ! -d "$PLUGIN_PATH" ]]; then
mkdir -p "$PLUGIN_PATH"
fi
get_machine_arch () {
machine_arch=""
case $(uname -m) in
i386) machine_arch="i386" ;;
i686) machine_arch="i386" ;;
x86_64) machine_arch="x86_64" ;;
aarch64) machine_arch="arm64" ;;
arm64) machine_arch="arm64" ;;
esac
echo $machine_arch
}
ARCH=$(get_machine_arch)
OS=""
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
OS="Linux"
;;
darwin*)
OS="Darwin"
;;
msys*)
OS="Windows"
;;
windowsnt*)
OS="Windows"
;;
*)
echo "Unknown OS type: $(uname)"
echo "Please consider contributing to this script to support your OS."
exit 1
;;
esac
echo "Downloading latest release to ksops plugin path"
if [ -x "$(command -v wget)" ]; then
wget -c https://github.com/viaduct-ai/kustomize-sops/releases/latest/download/ksops_latest_${OS}_${ARCH}.tar.gz -O - | tar -zxvf - -C "$PLUGIN_PATH"
elif [ -x "$(command -v curl)" ]; then
curl -s -L https://github.com/viaduct-ai/kustomize-sops/releases/latest/download/ksops_latest_${OS}_${ARCH}.tar.gz | tar -zxvf - -C "$PLUGIN_PATH"
else
echo "This script requires either wget or curl."
exit 1
fi
echo "Successfully installed ksops"
Verify the plugin location:
Ensure that the ksops
plugin is located at $XDG_CONFIG_HOME/kustomize/plugin/viaduct.ai/v1/ksops/ksops
.
ls $XDG_CONFIG_HOME/kustomize/plugin/viaduct.ai/v1/ksops/
You should see the ksops
file in this directory.
Run kustomize
with the correct flags:
Ensure you are using the correct flags to enable plugins when running kustomize
.
kustomize build --enable-alpha-plugins --enable-exec --enable-helm '/mydir'
By following these steps, you should be able to resolve the error and successfully use the ksops
plugin with kustomize
[1][2].
To continue talking to Dosu, mention @dosu.
It started working after copying ksops binary into /Users/user/.config/kustomize/plugin/viaduct.ai/v1/ksops/
. Seems a bit undocumented, though...
Hey @mkocur-ledger sorry you ran into issues, but glad you were able to resolve it.
If you had to move the binary to that path that means your must have the legacy style plugins set up. Are you able to share your kustomize.yaml
and KSOPS generator.yaml
files?
Sure.
kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: xx
generators:
- secrets-generator.yaml
secrets-generator.yaml
apiVersion: viaduct.ai/v1
kind: ksops
metadata:
name: applications-secrets
files:
- one.sops.yaml
- two.sops.yaml
Nothing fancy here.
Hello, so just installed ksops and kustomize with brew:
I tried also official installation script but it just creates one binary in /usr/local/bin.
My understanding is that kustomize should allow executing a binary instead of looking for a library with
--enable-exec
but I have no clue how to convince it to do it.