Skip to content

Commit

Permalink
Add minLength restriction to Tuned CR (#689)
Browse files Browse the repository at this point in the history
Add minLength == 1 to Tuned spec.profile[].name and spec.recommend[].profile
The profile name always has at least 1 character and this will also
prevent TuneD daemon traceback when recommending an empty-string
profile.

Also see: redhat-performance/tuned#537

Co-authored-by: Jiri Mencak <jmencak@users.noreply.github.com>
  • Loading branch information
jmencak and jmencak committed Jun 15, 2023
1 parent d320807 commit 7654a51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/20-tuned.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ spec:
name:
description: Name of the Tuned profile to be used in the recommend
section.
minLength: 1
type: string
required:
- data
Expand Down Expand Up @@ -139,6 +140,7 @@ spec:
type: integer
profile:
description: Name of the Tuned profile to recommend.
minLength: 1
type: string
required:
- priority
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/tuned/v1/tuned_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type TunedSpec struct {
// A Tuned profile.
type TunedProfile struct {
// Name of the Tuned profile to be used in the recommend section.
// +kubebuilder:validation:MinLength=1
Name *string `json:"name"`
// Specification of the Tuned profile to be consumed by the Tuned daemon.
Data *string `json:"data"`
Expand All @@ -79,6 +80,7 @@ type TunedProfile struct {
// Selection logic for a single Tuned profile.
type TunedRecommend struct {
// Name of the Tuned profile to recommend.
// +kubebuilder:validation:MinLength=1
Profile *string `json:"profile"`

// Tuned profile priority. Highest priority is 0.
Expand Down

0 comments on commit 7654a51

Please sign in to comment.