godaddy / kubernetes-client

Simplified Kubernetes API client for Node.js.
MIT License
961 stars 192 forks source link

new incluster swagger loading doesn;t work but depricated does #666

Open macakmujo opened 4 years ago

macakmujo commented 4 years ago

after getting this message kubernetes-client deprecated getInCluster see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- at .out/ReadOperator.js:7:48

I changed to new verion. That stopped working thios morning for no real reason so I consider it unstable const kubeconfig = new k8s.KubeConfig(); kubeconfig.loadFromCluster(); const backend = new Request({ kubeconfig }); const client = new Client({ backend: backend /, version: "1.13"/ }); // swagger-1.13.json.gz await client.loadSpec().catch((e: any) => console.log(e));

I am using minikube with k8 1.15.5

I switched back to depricated style and this started to work :)

const backend = new Request(Request.config.getInCluster()) const client = new Client({ backend }) await client.loadSpec()

Error that I was getting was "Error: Failed to get /openapi/v2 and /swagger.json: forbidden: User "system:anonymous" cannot get path "/swagger.json"

I guess it did not create right context since it is depending on other external library

Thanks

macakmujo commented 4 years ago

lol ticket 666 you should ban this number :)

jaliph commented 4 years ago

We are also using deprecated methods due to the same reason. It would be great if the examples are provided on how to initialize using the new constructor.