0

I'm in the process of creating a custom transformer for kustomize. However, I'm running into issues creating even the most basic Go Plugin. I'm trying to follow these steps here https://github.com/kubernetes-sigs/kustomize/blob/master/docs/plugins/goPluginGuidedExample.md

I'm using one of the plugins in mainline kustomize, ie. secretsfromdatabase [1]

According to the documentation, the instructions I'm following are:

tmpGoPath=$(mktemp -d)
GOPATH=$tmpGoPath go install sigs.k8s.io/kustomize/kustomize
GOPATH=$tmpGoPath go build -buildmode plugin -o SecretsFromDatabase.so SecretsFromDatabase.go
cp SecretsFromDatabase.so ~/.config/kustomize/plugin/mygenerators/sopsencodedsecrets/SopsEncodedSecrets

Now when I run kustomize, I get the following error:

Error: accumulating resources: recursed accumulation [...] fails to load: plugin.Open("$HOME/.config/kustomize/plugin/mygenerators/sopsencodedsecrets/SopsEncodedSecrets"): plugin was built with a different version of package internal/cpu

What is strange is I'm using the same tag in git as the version that is installed on my system.

kustomize version                                                                                                                                                     tags/kustomize/v3.5.4^0
{Version:3.5.4 GitCommit:3af514fa9f85430f0c1557c4a0291e62112ab026 BuildDate:2020-01-17T14:23:25+00:00 GoOs:darwin GoArch:amd64}

[1] https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/someteam.example.com/v1/secretsfromdatabase

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Gerb
  • 883
  • 12
  • 31

1 Answers1

2

As for now plugins are very difficult to write and support because the environment should be identical and in practice only original build system can reliably build the plugins. In result a lot of people like you finding little differences in their build environments. I think it is bad idea from design and strongly recommend to get acquainted with Reddit discussion here

Oleg
  • 662
  • 6
  • 10
  • Thank you for linking this reddit. I was wonder why I was having a difficult time but know i understand the complexity and the reason why this is not a good approach. – Gerb May 22 '20 at 15:57