问题描述
我有一个自定义资源,它有一个选择器,如下所示。我想检索与 matchexpressions 或 matchlabels 中的任何条件匹配的所有网络。
networkSelector:
matchExpressions:
- key: web
operator: In
values:
- dev
- infra
matchLabels:
net: db
infra-net: infra
我在下面尝试为 matchLabels
获取匹配网络,但无法弄清楚如何为 matchExpressions
执行此操作。可以通过selector
一起完成吗?
r is of type networkReconciler and
type networkReconciler struct {
client.Client
Log logr.Logger
ResourceScheme *runtime.Scheme
CtrlOptions controller.Options
}
opts := client.MatchingLabels(obj.Spect.networkSelector.MatchLabels)
r.List(ctx,netwList,opts)
感谢您对此的任何帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)