gokubernetesclient-go

Any equivalent/alternatives for "kubectl get provisioner" in golang


We can list namespaces on the cluster with the help of client-go, something like below:

clientset.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})

Whether any similar option for kubectl get provisioner command. I know like client-go doesn't have this feature, but any other custom ones which can be used?


Solution

  • Able to to get the required resources with the help of sigs.k8s.io/controller-runtime/pkg/client using unstructured objects to retrieve an object.

    Reference: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/client#example-Client-Get