Questions tagged [client-go]

208 questions
0
votes
1 answer

Using client-go API to list pods managed by a deployment controller not working

I'm using the native client-go API in Go to get the list of Pods managed by a Deployment type controller under a given namespace ("default"), but the returned list is not containing the list of Pods labelSelector :=…
Inian
  • 80,270
  • 14
  • 142
  • 161
0
votes
1 answer

Delete all kubernetes resources using client-go?

Is it possible to delete all resources with specific label using client go? The version of client-go is 0.17.3 I see in the client that there is a field for every resource type but they have different interfaces. type Clientset struct { …
aliench0
  • 109
  • 1
  • 8
0
votes
1 answer

Verifying that a kubernetes pod is deleted using client-go

I am trying to ensure that a pod is deleted before proceeding with another Kubernetes Operation. So the idea I have is to Call the Pod Delete Function and then call the Pod Get Function. // Delete Pod err :=…
tr_quest
  • 735
  • 2
  • 10
  • 24
0
votes
1 answer

Kubernetes go client api for version of a node

[root@gx dashboard]# kubectl get node NAME STATUS ROLES AGE **VERSION** minikube Ready master 7d20h **v1.15.0** returns the version for a particular node. How do I do this using client-go?
Gao.Xin
  • 1
  • 1
0
votes
1 answer

unstructured.UnstructuredList caused lots of reflect.go trace

I'm trying to use the unstructured.UnstructuredList to reuse come logic for configmap and secret. However, after adding the ListAndDeployReferredObject, I started to see tons of trace as Starting reflector *unstructured.Unstructured was added to my…
Ian Zhang
  • 402
  • 3
  • 17
0
votes
1 answer

Kubernetes client code generator: Can the code exist only locally and not on a repository for the core-generator to work?

I am trying to generate client code using k8s.io/code-generator. These are the instructions that I am following: https://itnext.io/how-to-generate-client-codes-for-kubernetes-custom-resource-definitions-crd-b4b9907769ba My question is, does my go…
codego123
  • 171
  • 2
  • 12
0
votes
1 answer

Retrieve data of Pod spec into a structure variable

I have been trying to retrieve pod details & fill those details into fields of the struct. However, I do get errors while filling the details into a struct. package main import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" //…
Sravan Kumar
  • 93
  • 1
  • 5
0
votes
1 answer

Retrieve objets using a specific secret / configmap via client-go library

I am trying to develop a simple controller using the client-go library. There is a requirement that each time a secret and/or a ConfigMap is updated on my cluster, I perform a specific action on the objects using those Secrets / ConfigMaps. I know…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
0
votes
1 answer

How to set EXTERNAL-IP for kubernetes Loadbalancer Service by Client-go?

I want to custom a loadbalancer-controller by client-go, now I just try to set a address for the service, but it not work. This is my code: func (c *Controller) syncToStdout(key string) error { obj, exists, err := c.indexer.GetByKey(key) if…
Bill Jay
  • 31
  • 4
0
votes
0 answers

Can I use client-go to get kubelet info such like do "ps -ef | grep kubelet"?

Can I use client-go to get kubelet info such like do ps -ef | grep kubelet? Thank you~
edselwang
  • 57
  • 8
0
votes
1 answer

MarshalYAML with Client Go resources

I'm writing a k8s operator with a CRD. Part of that resource's status field is an enum value, using iota like so: type Enum int const ( Enum1 = iota + 1 Enum2 Enum3 ... ) I have a function attached to the enum that converts it to a…
porgull
  • 102
  • 10
0
votes
1 answer

parsing K8s yaml spec into client-go data structures

I wrote some code but it doesn't work, it seems that client-go doesn't support parsing of K8s yaml spec into client-go data structures, could anyone tell me how to do it. func GetDeploymentFromYamlString(str string) (*apps.Deployment, error) { …
edselwang
  • 57
  • 8
0
votes
0 answers

How to deploy pods described in yaml files using client-go?

Without using kubectl, I want to use client-go to deploy deployment/services described in yaml files. Which approach is the best: clientset, rest or dynamic? I do not want to parse yaml file and set every attributes of Deployment objects in…
kyleqian
  • 311
  • 1
  • 3
  • 14
0
votes
1 answer

Kuberentes client-go method to drain a node

Is there a go client to drain a Kubernetes node. I am writing E2E testcases using existing kubernetes E2E framework and i need to cover a node drain scenario for storage.
ambikanair
  • 4,004
  • 11
  • 43
  • 83
0
votes
1 answer

calling the deployment yaml through client go examples

I am trying to call the update deployment through the client go for k8. But I am having hard time update the changes from deployment.yaml file any code examples for an equivalent to kubectl apply -f deployment.yaml through the client-go APIs
1 2 3
13
14