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

Problems on plugin initialization with disabled syncers #11

Open
gruberro opened this issue Mar 11, 2022 · 1 comment
Open

Problems on plugin initialization with disabled syncers #11

gruberro opened this issue Mar 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@gruberro
Copy link

gruberro commented Mar 11, 2022

First of all thank you very much for the plugin SDK. Developing custom syncers is really fun.

I experienced a problem with the SDK when starting the plugin container due to a possible incompatibility of types/config. When the plugin is started, it tries to unmarshal the vcluster options from json. As far as I can see, the json looks like {"controllers":["-services", "-ingresses"],"serverCaCert":"/data/se.... So the controllers data is an array (also if only one syncer is disabled by bypassing something like --sync=-services,-ingresses into the syncer configuration.

Unfortunately this results in

panic: unmarshal vcluster options: json: cannot unmarshal array into Go struct field VirtualClusterOptions.controllers of type string

goroutine 1 [running]:
github.com/loft-sh/vcluster-sdk/plugin.MustInit(...)
	/go/vcluster/vendor/github.com/loft-sh/vcluster-sdk/plugin/plugin.go:55
main.main()
	/go/vcluster/main.go:11 +0x2bd

It looks like this is currently incompatible with the VirtualClusterOptions struct, defining Controllers as string only (Controllers string json:"controllers,omitempty").

For me, the problem does not happen when using devspace to develop a new plugin, but in "prod mode". This might also indicate a wrong configuration on my side 🙈.

/edit I tried to dig into the error a bit deeper: the plugin SDK seems perfectly compatible with loftsh/vcluster:0.6.0-alpha.8. With alpha.9 the types start to differ. This might have to do something with these changes.

At least this is the reason why my development env is still working. I used the example plugin as base. But I recognized too late, that it's using alpha.6 😅.

@FabianKramm
Copy link
Member

@gruberro thanks for creating this issue! Yes you are correct, seems like the types differ with the new version, we'll update this ASAP!

@FabianKramm FabianKramm added the bug Something isn't working label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants