add generalized label selector to the experimental API

pull/6/head
Mike Danese 2015-10-12 14:03:08 -07:00
parent 8e25b7c7bf
commit 3645d2f02b
1 changed files with 36 additions and 0 deletions

View File

@ -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"
)