Skip to content

Commit

Permalink
zuul-scheduler - add hold expiration settings
Browse files Browse the repository at this point in the history
- zuul-scheduler: add support for `default_hold_expiration`.
- zuul-scheduler: add support for `max_hold_expiration`.

Change-Id: I540564355bbc8e714c332b5807b6b9e180e573f8
  • Loading branch information
morucci committed Jul 24, 2024
1 parent 953180c commit 992e6ed
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/v1/softwarefactory_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ type ZuulSchedulerSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default={"memory": "2Gi", "cpu": "2000m"}
Limits *LimitsSpec `json:"limits"`
// the [DefaultHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.default_hold_expiration)
// +optional
// +kubebuilder:validation:Minimum:=0
DefaultHoldExpiration *uint32 `json:"DefaultHoldExpiration,omitempty"`
// the [MaxHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.max_hold_expiration)
// +optional
// +kubebuilder:validation:Minimum:=0
MaxHoldExpiration *uint32 `json:"MaxHoldExpiration,omitempty"`
}

// Zuul Merger Configuration, see [Zuul's documentation](https://zuul-ci.org/docs/zuul/latest/configuration.html#merger)
Expand Down
10 changes: 10 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,16 @@ spec:
scheduler:
description: Configuration of the scheduler microservice
properties:
DefaultHoldExpiration:
description: the [DefaultHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.default_hold_expiration)
format: int32
minimum: 0
type: integer
MaxHoldExpiration:
description: the [MaxHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.max_hold_expiration)
format: int32
minimum: 0
type: integer
limits:
default:
cpu: 2000m
Expand Down
8 changes: 8 additions & 0 deletions controllers/zuul.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,14 @@ func (r *SFController) EnsureZuulConfigSecret(skipDBSettings bool, skipAuthSetti
cfgINI.Section("auth "+*defaultAuthSection).NewKey("default", "true")
}

// Set scheduler settings
if r.cr.Spec.Zuul.Scheduler.DefaultHoldExpiration != nil {
cfgINI.Section("scheduler").NewKey("default_hold_expiration", strconv.Itoa(int(*r.cr.Spec.Zuul.Scheduler.DefaultHoldExpiration)))
}
if r.cr.Spec.Zuul.Scheduler.MaxHoldExpiration != nil {
cfgINI.Section("scheduler").NewKey("max_hold_expiration", strconv.Itoa(int(*r.cr.Spec.Zuul.Scheduler.MaxHoldExpiration)))
}

// Enable prometheus metrics
for _, srv := range []string{"web", "executor", "scheduler", "merger"} {
cfgINI.Section(srv).NewKey("prometheus_port", strconv.Itoa(zuulPrometheusPort))
Expand Down
4 changes: 4 additions & 0 deletions doc/reference/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
## [in development]

### Added

- zuul-scheduler: add support for `default_hold_expiration`.
- zuul-scheduler: add support for `max_hold_expiration`.

### Changed
### Deprecated
### Removed
Expand Down
2 changes: 2 additions & 0 deletions doc/reference/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ _Appears in:_
| `statsdTarget` _string_ | The address to forward statsd metrics to (optional), in the form "host:port" | -|
| `logLevel` _[LogLevel](#loglevel)_ | Specify the Log Level of the zuul-scheduler service.<br /><br />Valid values are:<br /><br />"INFO" (default),<br /><br />"WARN",<br /><br />"DEBUG".<br /><br />Changing this value will restart the service. | INFO|
| `limits` _[LimitsSpec](#limitsspec)_ | Memory/CPU Limit | {map[cpu:2000m memory:2Gi]}|
| `DefaultHoldExpiration` _integer_ | the [DefaultHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.default_hold_expiration) | -|
| `MaxHoldExpiration` _integer_ | the [MaxHoldExpiration](https://zuul-ci.org/docs/zuul/latest/configuration.html#attr-scheduler.max_hold_expiration) | -|


#### ZuulSpec
Expand Down

0 comments on commit 992e6ed

Please sign in to comment.