Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kustomize can't load builtin transformers when leveraging 'transformers:' entry #1508

Closed
jbrette opened this issue Sep 6, 2019 · 5 comments · Fixed by #1532
Closed

kustomize can't load builtin transformers when leveraging 'transformers:' entry #1508

jbrette opened this issue Sep 6, 2019 · 5 comments · Fixed by #1532
Assignees

Comments

@jbrette
Copy link
Contributor

jbrette commented Sep 6, 2019

This example is a reproduction of automatic feature test: customconfigofbuiltinplugin_test.go but is run from the command line as a normal user:

kustomize does not seem to be able to locate the plugin and looks for it XDG_CONFIG_HOME

To reproduce:

DEMO_HOME=$(mktemp -d)
mkdir -p ${DEMO_HOME}
cat <<'EOF' >${DEMO_HOME}/kustomization.yaml
resources:
- deployment.yaml
- role.yaml
- service.yaml
transformers:
- prefixer.yaml
EOF
cat <<'EOF' >${DEMO_HOME}/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myDeployment
spec:
  template:
    metadata:
      labels:
        backend: awesome
    spec:
      containers:
      - name: whatever
        image: whatever
EOF
cat <<'EOF' >${DEMO_HOME}/prefixer.yaml
apiVersion: builtin
kind: PrefixSuffixTransformer
metadata:
  name: customPrefixer
prefix: zzz-
fieldSpecs:
- kind: Deployment
  path: metadata/name
- kind: Service
  path: metadata/name
EOF
cat <<'EOF' >${DEMO_HOME}/role.yaml
apiVersion: v1
kind: Role
metadata:
  name: myRole
EOF
cat <<'EOF' >${DEMO_HOME}/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: myService
EOF
$HOME/bin/kustomize.3.1.0 version

Version: {KustomizeVersion:3.1.0 GitCommit:95f3303493fdea243ae83b767978092396169baf BuildDate:2019-07-26T18:11:16Z GoOs:linux GoArch:amd64}
$HOME/bin/kustomize.3.1.0 build $DEMO_HOME --enable_alpha_plugins
Error: plugin 

xxxx/.config/kustomize/plugin/builtin/prefixsuffixtransformer/PrefixSuffixTransformer fails to load: plugin: not implemented
@jbrette
Copy link
Contributor Author

jbrette commented Sep 6, 2019

After rebuilding kustomize from master (make install) :

$HOME/bin/kustomize build $DEMO_HOME --enable_alpha_plugins
Error: plugin /home/xxx/.config/kustomize/plugin/builtin/prefixsuffixtransformer/PrefixSuffixTransformer fails to load: plugin.Open("/home/xxx/.config/kustomize/plugin/builtin/prefixsuffixtransformer/PrefixSuffixTransformer.so"): realpath failed

and building and installing the PrefixSuffixTransformer.go (GOPATH=$myGoPath GO111MODULE=on go build -buildmode plugin -o ${HOME}/.config/kustomize/${i}.so ./$i.go), it seems to behave properly

$HOME/bin/kustomize build $DEMO_HOME --enable_alpha_plugins
apiVersion: v1
kind: Role
metadata:
  name: myRole
---
apiVersion: v1
kind: Service
metadata:
  name: zzz-myService
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: zzz-myDeployment
spec:
  template:
    metadata:
      labels:
        backend: awesome
    spec:
      containers:
      - image: whatever
        name: whatever

@jbrette
Copy link
Contributor Author

jbrette commented Sep 6, 2019

@ian-howell
Copy link
Contributor

I've been able to replicate this in my environment. It seems that configuring plugins requires the user to have the compiled .so files regardless of whether the plugin is builtin or not. These seems like a major issue for anyone who wants to be able to use kustomize with minimal setup.

@monopole
Copy link
Contributor

Thanks guys, my fault.

@jbrette
Copy link
Contributor Author

jbrette commented Sep 13, 2019

@monopole Cool, this is one major step in being able to use built in plugins, bring a lot of flexibility and still keep the kustomization.yaml simple. I'll revisit the KEP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants