Closed swhoro closed 11 months ago
What does your kube config file look like? It should be in $HOME/.kube/config
Please paste it into this issue, but please make sure to redact any secret data (e.g. certificates) first.
What does your kube config file look like? It should be in
$HOME/.kube/config
Please paste it into this issue, but please make sure to redact any secret data (e.g. certificates) first.
apiVersion: v1
clusters:
- cluster:
certificate-authority: /home/***/.minikube/ca.crt
extensions:
- extension:
last-update: Sat, 15 Jul 2023 21:04:32 CST
provider: minikube.sigs.k8s.io
version: v1.30.1
name: cluster_info
server: https://192.168.49.2:8443
name: minikube
contexts:
- context:
cluster: minikube
extensions:
- extension:
last-update: Sat, 15 Jul 2023 21:04:32 CST
provider: minikube.sigs.k8s.io
version: v1.30.1
name: context_info
namespace: default
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /home/***/.minikube/profiles/minikube/client.crt
client-key: /home/***/.minikube/profiles/minikube/client.key
Looking at the code, we don't currently support loading from cetificate authorities from files outside of the kubeconfig file:
It wouldn't be hard to add support for this, we'd welcome a PR if you want to send it, the relevant code is here:
https://github.com/kubernetes-client/c/blob/master/kubernetes/config/kube_config_yaml.c#L215
Thanks.
In fact, I am a noob of c, so I am not sure if I can do this.
I will try to fix this.
You'll want to do something similar to this which loads client keys:
https://github.com/kubernetes-client/c/blob/master/kubernetes/config/kube_config_yaml.c#L225
You'll want to do something similar to this which loads client keys:
https://github.com/kubernetes-client/c/blob/master/kubernetes/config/kube_config_yaml.c#L225
Thanks for your hint, I have tested my modification and create a PR: #198
And I have another question: what does progress_func
do.
In this example: https://github.com/kubernetes-client/c/blob/master/examples/multi_thread/watch_pod.c
There are two functions in apiClient
named data_callback_func
and progress_func
I think the data_callback_func
will be called when the watched resources are changed (notified by k8s api server) . The program(thread) will be paused on CoreV1API_listNamespacedPod
, resumed when notification comes and execute data_callback_func
, and paused until next notification comes, keep looping like this.
But I do not know what does progress_func
do and when will this function be called? I searched in Google but nothing related found.
So here is my question: did I understand data_callback_func
correctly and what does progress_func
do and when will it be triggered?
data_callback_func
is called when new data is received by the C client library from API server. https://github.com/kubernetes-client/c/blob/c223563bda143b3ca9e38cbee5782b37cad040a3/kubernetes/src/apiClient.c#L470-L471
progress_func
is called by libcurl while transmitting:
https://github.com/kubernetes-client/c/blob/c223563bda143b3ca9e38cbee5782b37cad040a3/kubernetes/src/apiClient.c#L392-L393
https://curl.se/libcurl/c/CURLOPT_XFERINFOFUNCTION.html
Generally you don't need provide your progress_func
,
The example uses progress_func
to exit watching and avoid memory leak.
data_callback_func
is called when new data is received by the C client library from API server.
progress_func
is called by libcurl while transmitting:https://curl.se/libcurl/c/CURLOPT_XFERINFOFUNCTION.html
Generally you don't need provide your
progress_func
, The example usesprogress_func
to exit watching and avoid memory leak.
Thank you
Close this issue as it is resovled by https://github.com/kubernetes-client/c/pull/198 Thanks @swhoro
When I use this c lib on minikube,
CoreV1API_listNamespacedEndpoints
(and some other apis) will print error:It seems when
load_kube_config
, theapiKeys
cannot parse correctly (maybe it is because there is no api token in my~/.kube/config
?)But the golang lib runs normally.
minikube version:
kubectl version: