From 65601974e3306f0fb29b2301cb0a869e71c05d5f Mon Sep 17 00:00:00 2001 From: Alexander Chernov Date: Wed, 16 Mar 2022 19:27:01 +0000 Subject: [PATCH] feat: added check_interval to runner configuration. --- api/v1beta1/runner_types.go | 7 ++++++- config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml | 4 ++++ config/rbac/role.yaml | 1 + internal/generate/config.go | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/api/v1beta1/runner_types.go b/api/v1beta1/runner_types.go index 3a270e0..c440e3f 100644 --- a/api/v1beta1/runner_types.go +++ b/api/v1beta1/runner_types.go @@ -37,7 +37,12 @@ type RunnerSpec struct { LogLevel string `json:"log_level,omitempty"` // +kubebuilder:validation:Minimum=1 - Concurrent int `json:"concurrent,omitempty"` + Concurrent int `json:"concurrent,omitempty"` + + // +kubebuilder:validation:Minimum=3 + // +kubebuilder:default:3 + CheckInterval int `json:"check_interval"` + ExecutorConfig KubernetesConfig `json:"executor_config,omitempty"` } diff --git a/config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml b/config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml index 29bdfcf..acca916 100644 --- a/config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml +++ b/config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml @@ -36,6 +36,9 @@ spec: spec: description: RunnerSpec defines the desired state of Runner properties: + check_interval: + minimum: 3 + type: integer concurrent: minimum: 1 type: integer @@ -402,6 +405,7 @@ spec: type: string type: object required: + - check_interval - registration_config type: object status: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 31e3639..b1b597d 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -22,6 +22,7 @@ rules: - "" resources: - configmaps + - secrets - serviceaccounts verbs: - create diff --git a/internal/generate/config.go b/internal/generate/config.go index ed3ee14..bf82cfa 100644 --- a/internal/generate/config.go +++ b/internal/generate/config.go @@ -32,6 +32,7 @@ func ConfigText(runnerObject *v1beta1.Runner) (gitlabConfig, configHashKey strin rootConfig := &config.Config{ ListenAddress: ":9090", Concurrent: int(math.Max(1, float64(runnerObject.Spec.Concurrent))), + CheckInterval: int(math.Max(3, float64(runnerObject.Spec.CheckInterval))), LogLevel: runnerObject.Spec.LogLevel, Runners: []*config.RunnerConfig{runnerConfig}, }