Manage runner with label (#355)

* Update RunnerDeploymentSpec to have Selector field

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Update RunnerReplicaSetSpec to have Selector field

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Add CloneSelectorAndAddLabel to add Selector field

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Fix tests

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Use label to find RunnerReplicaSet/Runner

Signed-off-by: binoue <[email protected]>

* Update controller-gen versions in CRD

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Update autoscaler to list Pods with labels

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Add debug log

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Modify RunnerDeployment tests

Signed-off-by: binoue <[email protected]>

* Modify RunnerReplicaset test

Signed-off-by: binoue <[email protected]>

* Modify integration test

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Use RunnerDeployment Template Labels as the default selector for backward compatibility

* Fix labeling

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Update func in Eventually to return (int, error)

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Update RunnerDeployment controller not to use label selector

Signed-off-by: Hiroshi Muraoka <[email protected]>

* Fix potential replicaset controller breakage on replicaset created before v0.17.0

* Fix errors on existing runner replica sets

* Ensure RunnerReplicaSet Spec Selector addition does not break controller

* Ensure RunnerDeployment Template.Spec.Labels change does result in template hash change

* Fix comment

Co-authored-by: binoue <[email protected]>
Co-authored-by: Yusuke Kuoka <[email protected]>
This commit is contained in:
Hiroshi Muraoka
2021-03-05 10:15:39 +09:00
committed by GitHub
co-authored by binoue Yusuke Kuoka
parent f220fefe92
commit 11e58fcc41
14 changed files with 667 additions and 61 deletions
@@ -38,11 +38,42 @@ spec:
metadata:
type: object
spec:
description: RunnerReplicaSetSpec defines the desired state of RunnerDeployment
description: RunnerDeploymentSpec defines the desired state of RunnerDeployment
properties:
replicas:
nullable: true
type: integer
selector:
description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: 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.
type: object
type: object
template:
properties:
metadata:
@@ -43,6 +43,37 @@ spec:
replicas:
nullable: true
type: integer
selector:
description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: 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.
type: object
type: object
template:
properties:
metadata: