Skip to content

Commit

Permalink
feat: added check_interval to runner configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
alekc committed Mar 16, 2022
1 parent 10d38ac commit 6560197
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/v1beta1/runner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -402,6 +405,7 @@ spec:
type: string
type: object
required:
- check_interval
- registration_config
type: object
status:
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rules:
- ""
resources:
- configmaps
- secrets
- serviceaccounts
verbs:
- create
Expand Down
1 change: 1 addition & 0 deletions internal/generate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
Expand Down

0 comments on commit 6560197

Please sign in to comment.