infinyon / k8-api

Native Rust implementation of Kubernetes api
Apache License 2.0
35 stars 17 forks source link

Support Microk8s #119

Closed sehz closed 2 years ago

sehz commented 2 years ago

see: https://github.com/infinyon/fluvio/issues/1933

sehz commented 2 years ago

@qrilka interesting in work on this issue?

qrilka commented 2 years ago

I will try to find time to have a look into this in the evening

qrilka commented 2 years ago

I'm not sure this is a problem of k8-api. The main thing seems to be about quite odd self-signed certs autocreated by microk8s. I've fixed certs to access the dashboard using this recipe - https://github.com/ubuntu/microk8s/issues/1046#issuecomment-765664937 but didn't get test_client_server_version working with microk8s yet (probably will have a look tomorrow).

qrilka commented 2 years ago

@sehz I've created my config for locally installed microk8s using microk8s config > config. Next problem was that k8-api doesn't support KUBECONFIG and only reads ~/.kube/config. Fixing that was easy. But then cargo test --features=k8 server_version fails with

thread 'canary_test::test_client_server_version_sync' panicked at 'cluster could not be configured: IoError(Custom { kind: InvalidInput, error: "no client cert crt path founded" })', src/k8-client/tests/canary.rs:19:42

Any idea why is client cert required for k8-api when for example kubectl has no problem with the same config? See e.g.

$ KUBECONFIG=config kubectl version
Client Version: version.Info{Major:"1", Minor:"19+", GitVersion:"v1.19.6-rc.0", GitCommit:"e338cf2c6d297aa603b50ad3a301f761b4173aa6", GitTreeState:"archive", BuildDate:"1980-01-01T00:00:00Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.3-3+9ec7c40ec93c73", GitCommit:"9ec7c40ec93c73c2281bdd2e4a75baf6247366a0", GitTreeState:"clean", BuildDate:"2021-11-03T10:17:37Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
sehz commented 2 years ago

Because that scenario wasn't implemented yet: https://github.com/infinyon/k8-api/blob/master/src/k8-client/src/cert.rs

qrilka commented 2 years ago

@sehz BTW why it says "not founded" and not "not found" - is it a typo? Also there are other places using the same phrase.

sehz commented 2 years ago

Typo

qrilka commented 2 years ago

123 adds needed functionality and with that cargo test --features=k8 server_version works fine with microk8s so I suppose infinyon/fluvio#1933 just needs k8-api to be updated

qrilka commented 2 years ago

And regarding the typo, is it also the case with https://docs.rs/k8-client/5.3.0/k8_client/enum.ClientError.html#method.not_founded ?

sehz commented 2 years ago

And regarding the typo, is it also the case with https://docs.rs/k8-client/5.3.0/k8_client/enum.ClientError.html#method.not_founded ?

let's deprecate and add new API

sehz commented 2 years ago

Confirm that I can run the integration test:

export KUBECONFIG=~/.microk8s/config
cargo test --features=k8 server_version

Great job. Thanks