From 1658f51fcbef781c6f6f4d1ff80b394628e2660c Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sat, 14 Nov 2020 22:06:33 +0900 Subject: [PATCH] Make Runner{Deployment,ReplicaSet} replicas actually optional (#186) If omitted, it properly defaults to 1. Fixes #64 --- acceptance/testdata/runnerdeploy.yaml | 2 +- api/v1alpha1/runnerdeployment_types.go | 1 + api/v1alpha1/runnerreplicaset_types.go | 4 +++- .../crd/bases/actions.summerwind.dev_runnerdeployments.yaml | 1 + .../crd/bases/actions.summerwind.dev_runnerreplicasets.yaml | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/acceptance/testdata/runnerdeploy.yaml b/acceptance/testdata/runnerdeploy.yaml index 684a27251f..bff2ce3813 100644 --- a/acceptance/testdata/runnerdeploy.yaml +++ b/acceptance/testdata/runnerdeploy.yaml @@ -3,7 +3,7 @@ kind: RunnerDeployment metadata: name: example-runnerdeploy spec: - replicas: 1 +# replicas: 1 template: spec: repository: mumoshu/actions-runner-controller-ci diff --git a/api/v1alpha1/runnerdeployment_types.go b/api/v1alpha1/runnerdeployment_types.go index f6b68a2fbc..8a79d306c9 100644 --- a/api/v1alpha1/runnerdeployment_types.go +++ b/api/v1alpha1/runnerdeployment_types.go @@ -27,6 +27,7 @@ const ( // RunnerReplicaSetSpec defines the desired state of RunnerDeployment type RunnerDeploymentSpec struct { // +optional + // +nullable Replicas *int `json:"replicas,omitempty"` Template RunnerTemplate `json:"template"` diff --git a/api/v1alpha1/runnerreplicaset_types.go b/api/v1alpha1/runnerreplicaset_types.go index ffc357faa8..eaef7fd7ac 100644 --- a/api/v1alpha1/runnerreplicaset_types.go +++ b/api/v1alpha1/runnerreplicaset_types.go @@ -22,7 +22,9 @@ import ( // RunnerReplicaSetSpec defines the desired state of RunnerReplicaSet type RunnerReplicaSetSpec struct { - Replicas *int `json:"replicas"` + // +optional + // +nullable + Replicas *int `json:"replicas,omitempty"` Template RunnerTemplate `json:"template"` } diff --git a/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml b/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml index 54600d6d7c..e0b4e02a56 100644 --- a/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml +++ b/config/crd/bases/actions.summerwind.dev_runnerdeployments.yaml @@ -41,6 +41,7 @@ spec: description: RunnerReplicaSetSpec defines the desired state of RunnerDeployment properties: replicas: + nullable: true type: integer template: properties: diff --git a/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml b/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml index 522a2e19cb..e243ce4358 100644 --- a/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml +++ b/config/crd/bases/actions.summerwind.dev_runnerreplicasets.yaml @@ -41,6 +41,7 @@ spec: description: RunnerReplicaSetSpec defines the desired state of RunnerReplicaSet properties: replicas: + nullable: true type: integer template: properties: @@ -1533,7 +1534,6 @@ spec: type: object type: object required: - - replicas - template type: object status: