I am trying to get some secret objects from my cluster using the k8s
go
client library as follows
secret, err := clientset.CoreV1().Secrets("mynamespace").Get("name-of-my-secret", metav1.GetOptions{})
This worked well as long as I had to get just one object.
I have a case now where I need to fetch several such secret objects, however this now has to be done based on labels. (i.e. fetch all such secret objects matching the foo=someprovider.someurl.com/path1=value1
label)
I don't see however in the relevant docs a way to pass label selectors to the GetOptions
struct that I assume performs such kind of filtering.
Any suggestions on how to select (potentially multiple) such resources based on labels?