Home  >  Article  >  Backend Development  >  Any equivalent/alternative for "kubectl get Provisioner" in golang

Any equivalent/alternative for "kubectl get Provisioner" in golang

PHPz
PHPzforward
2024-02-12 13:57:06730browse

golang 中“kubectl get Provisioner”的任何等效/替代项

Question content

We can use client-go to list the namespaces on the cluster, as follows:

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

Is there a similar option for the kubectl get provisioner command? I know client-go doesn't have this feature, but are there any other custom features I can use?

Solution

You can retrieve the required resources by using sigs.k8s.io/controller-runtime/pkg/client using unstructured objects.

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

The above is the detailed content of Any equivalent/alternative for "kubectl get Provisioner" in golang. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete