move daemonset to generalized label selector

This commit is contained in:
Mike Danese
2015-10-25 23:11:09 -07:00
parent abbed4f7e8
commit 7a7f31ead1
13 changed files with 91 additions and 64 deletions

View File

@@ -323,7 +323,11 @@ func (dsc *DaemonSetsController) updateNode(old, cur interface{}) {
// getNodesToDaemonSetPods returns a map from nodes to daemon pods (corresponding to ds) running on the nodes.
func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *extensions.DaemonSet) (map[string][]*api.Pod, error) {
nodeToDaemonPods := make(map[string][]*api.Pod)
daemonPods, err := dsc.podStore.Pods(ds.Namespace).List(labels.Set(ds.Spec.Selector).AsSelector())
selector, err := extensions.PodSelectorAsSelector(ds.Spec.Selector)
if err != nil {
return nil, err
}
daemonPods, err := dsc.podStore.Pods(ds.Namespace).List(selector)
if err != nil {
return nodeToDaemonPods, err
}

View File

@@ -55,7 +55,7 @@ func newDaemonSet(name string) *extensions.DaemonSet {
Namespace: api.NamespaceDefault,
},
Spec: extensions.DaemonSetSpec{
Selector: simpleDaemonSetLabel,
Selector: &extensions.PodSelector{MatchLabels: simpleDaemonSetLabel},
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
Labels: simpleDaemonSetLabel,