Last active
June 19, 2020 03:07
-
-
Save yuanying/e0d56e98c7bd3914bc27c7baf7cc05ef to your computer and use it in GitHub Desktop.
LabelSelectorRequirement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cms := &v1.ConfigMapList{} | |
requirement, err := labels.NewRequirement( | |
apis.LabelKey, | |
selection.Exists, | |
nil, | |
) | |
if err != nil { | |
return nil, err | |
} | |
ls := labels.NewSelector().Add(*requirement) | |
if err := c.List(context.Background(), cms, | |
client.InNamespace(cmns), | |
client.MatchingLabelsSelector{Selector: ls}, | |
); err != nil { | |
return nil, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment