本文整理汇总了Golang中github.com/GoogleCloudPlatform/kubernetes/pkg/labels.Set类的典型用法代码示例。如果您正苦于以下问题:Golang Set类的具体用法?Golang Set怎么用?Golang Set使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Set类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Search
// Search finds events about the specified object. The namespace of the
// object must match this event's client namespace unless the event client
// was made with the "" namespace.
func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
ref, err := api.GetReference(objOrRef)
if err != nil {
return nil, err
}
if e.namespace != "" && ref.Namespace != e.namespace {
return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace)
}
fields := labels.Set{}
if ref.Kind != "" {
fields["involvedObject.kind"] = ref.Kind
}
if ref.Namespace != "" {
fields["involvedObject.namespace"] = ref.Namespace
}
if ref.Name != "" {
fields["involvedObject.name"] = ref.Name
}
if ref.UID != "" {
fields["involvedObject.uid"] = string(ref.UID)
}
return e.List(labels.Everything(), fields.AsSelector())
}
示例2: createDNSPod
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var dnsServiceLableSelector = labels.Set{
"k8s-app": "kube-dns",
"kubernetes.io/cluster-service": "true",
}.AsSelector()
func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd string) *api.Pod {
pod := &api.Pod{
TypeMeta: api.TypeMeta{
Kind: "Pod",
APIVersion: latest.Version,
},
ObjectMeta: api.ObjectMeta{
Name: "dns-test-" + string(util.NewUUID()),
Namespace: namespace,
},
Spec: api.PodSpec{
Volumes: []api.Volume{
{