diff --git a/pkg/apis/extensions/types.go b/pkg/apis/extensions/types.go index 5db02930f9d..21f3af562f1 100644 --- a/pkg/apis/extensions/types.go +++ b/pkg/apis/extensions/types.go @@ -638,3 +638,39 @@ type ClusterAutoscalerList struct { Items []ClusterAutoscaler `json:"items"` } + +// A pod selector is a label query over a set of pods. The result of matchLabels and +// matchExpressions are ANDed. An empty pod selector matches all objects. A null +// pod selector matches no objects. +type PodSelector struct { + // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + // map is equivalent to an element of matchExpressions, whose key field is "key", the + // operator is "In", and the values array contains only "value". The requirements are ANDed. + MatchLabels map[string]string `json:"matchLabels,omitempty"` + // matchExpressions is a list of pod selector requirements. The requirements are ANDed. + MatchExpressions []PodSelectorRequirement `json:"matchExpressions,omitempty"` +} + +// A pod selector requirement is a selector that contains values, a key and an operator that +// relates the key and values. +type PodSelectorRequirement struct { + // key is the label key that the selector applies to. + Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` + // operator represents a key's relationship to a set of values. + // Valid operators ard In, NotIn, Exists and DoesNotExist. + Operator PodSelectorOperator `json:"operator"` + // values is a set of string values. If the operator is In or NotIn, + // the values set must be non-empty. This array is replaced during a + // strategic merge patch. + Values []string `json:"stringValues,omitempty"` +} + +// A pod selector operator is the set of operators that can be used in a selector requirement. +type PodSelectorOperator string + +const ( + PodSelectorOpIn PodSelectorOperator = "In" + PodSelectorOpNotIn PodSelectorOperator = "NotIn" + PodSelectorOpExists PodSelectorOperator = "Exists" + PodSelectorOpDoesNotExist PodSelectorOperator = "DoesNotExist" +)