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
+10
View File
@@ -443,7 +443,17 @@ func TestDetermineDesiredReplicas_OrganizationalRunner(t *testing.T) {
Name: "testrd",
},
Spec: v1alpha1.RunnerDeploymentSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"foo": "bar",
},
},
Template: v1alpha1.RunnerTemplate{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"foo": "bar",
},
},
Spec: v1alpha1.RunnerSpec{
Organization: tc.org,
},