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

plugins/v4/config/source/configmap list/watch error #98

Closed
redscholar opened this issue Mar 24, 2023 · 0 comments
Closed

plugins/v4/config/source/configmap list/watch error #98

redscholar opened this issue Mar 24, 2023 · 0 comments

Comments

@redscholar
Copy link

When I use ConfigMap as my config plugin, I found that the REST client for List/Watch is missing the GroupVersion information.

my configmap code is

err := config.DefaultConfig.Load(configmap.NewSource(configmap.WithName("auth-config"), configmap.WithNamespace("yunhang"), configmap.WithConfigPath("~/.kube/config")))

and the error log is

W0324 16:05:11.020136   88445 reflector.go:424] pkg/mod/k8s.io/client-go@v0.26.3/tools/cache/reflector.go:169: failed to list *v1.ConfigMap: the server could not find the requested resource (get configmaps.meta.k8s.io)
E0324 16:05:11.020164   88445 reflector.go:140] pkg/mod/k8s.io/client-go@v0.26.3/tools/cache/reflector.go:169: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: the server could not find the requested resource (get configmaps.meta.k8s.io)

and than i found list/watch url is

https://kubernetes.docker.internal:6443/namespaces/yunhang/configmaps

the correct url should be that.(miss api/v1)

https://kubernetes.docker.internal:6443/api/v1/namespaces/yunhang/configmaps

https://github.com/go-micro/plugins/blob/0bbab425e86658eeb7b55602f184d37c1ea75094/v4/config/source/configmap/watcher.go#L38
I think the code might be like that, or do you have any better ideas?

 lw := cache.NewListWatchFromClient(w.client.CoreV1().RESTClient(), "configmaps", w.namespace, fields.OneTermEqualSelector("metadata.name", w.name))
redscholar pushed a commit to redscholar/go-micro-plugins that referenced this issue May 31, 2023
jochumdev added a commit that referenced this issue Aug 7, 2023
fix: [#98]plugins/v4/config/source/configmap list/watch error
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

No branches or pull requests

1 participant