From eccced231b2a2eaccb2e05f9de5dabf77413d994 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Tue, 16 Feb 2016 12:16:03 +0100 Subject: [PATCH] Updated label selector for daemon set --- docs/admin/daemons.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/admin/daemons.md b/docs/admin/daemons.md index 4caf4632b72..fb034fa00e0 100644 --- a/docs/admin/daemons.md +++ b/docs/admin/daemons.md @@ -100,11 +100,17 @@ A pod template in a DaemonSet must have a [`RestartPolicy`](../user-guide/pod-st ### Pod Selector The `.spec.selector` field is a pod selector. It works the same as the `.spec.selector` of -a [ReplicationController](../user-guide/replication-controller.md) or -[Job](../user-guide/jobs.md). +a [Job](../user-guide/jobs.md) or other new resources. -If the `.spec.selector` is specified, it must equal the `.spec.template.metadata.labels`. If not -specified, the are default to be equal. Config with these unequal will be rejected by the API. +The `spec.selector` is an object consisting of two fields: +* `matchLabels` - works the same as the `.spec.selector` of a [ReplicationController](../user-guide/replication-controller.md) +* `matchExpressions` - allows to build more sophisticated selectors by specifying key, + list of values and an operator that relates the key and values. + +When the two are specified the result is ANDed. + +If the `.spec.selector` is specified, it must match the `.spec.template.metadata.labels`. If not +specified, they are defaulted to be equal. Config with these not matching will be rejected by the API. Also you should not normally create any pods whose labels match this selector, either directly, via another DaemonSet, or via other controller such as ReplicationController. Otherwise, the DaemonSet