func labelNamespace(clusterAdminKubeClient kclient.NamespacesInterface, namespaceName string) error { ns1, err := clusterAdminKubeClient.Namespaces().Get(namespaceName) if err != nil { return err } if ns1.Labels == nil { ns1.Labels = map[string]string{} } ns1.Labels["foo"] = "bar" if _, err := clusterAdminKubeClient.Namespaces().Update(ns1); err != nil { return err } return nil }
// GetNamespaceListChannel returns a pair of channels to a Namespace list and errors that both must be read // numReads times. func GetNamespaceListChannel(client client.NamespacesInterface, numReads int) NamespaceListChannel { channel := NamespaceListChannel{ List: make(chan *api.NamespaceList, numReads), Error: make(chan error, numReads), } go func() { list, err := client.Namespaces().List(listEverything) for i := 0; i < numReads; i++ { channel.List <- list channel.Error <- err } }() return channel }