Skip to content

Commit

Permalink
Make mysqldExporter.resources optional
Browse files Browse the repository at this point in the history
It's possible that mysqldExporter.extraFlags are provided while
mysqldExporter.resources are not.
  • Loading branch information
stankevich committed Nov 8, 2024
1 parent 392f857 commit 8b0d8a0
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 22 deletions.
4 changes: 0 additions & 4 deletions deploy/crds/planetscale.com_vitessclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2029,8 +2029,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -2474,8 +2472,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down
4 changes: 0 additions & 4 deletions deploy/crds/planetscale.com_vitesskeyspaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -1032,8 +1030,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down
2 changes: 0 additions & 2 deletions deploy/crds/planetscale.com_vitessshards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/planetscale/v2/vitessshard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ type MysqldExporterSpec struct {
ExtraFlags map[string]string `json:"extraFlags,omitempty"`

// Resources specify the compute resources to allocate for just the MySQL Exporter.
Resources corev1.ResourceRequirements `json:"resources"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

// VitessTabletPoolType represents the tablet types for which it makes sense
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/vttablet/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
// so we need to do more investigation. For now it's better to leave them empty.
}

if spec.MysqldExporter != nil {
if spec.MysqldExporter != nil && (len(spec.MysqldExporter.Resources.Limits) > 0 || len(spec.MysqldExporter.Resources.Requests) > 0) {
update.ResourceRequirements(&mysqldExporterContainer.Resources, &spec.MysqldExporter.Resources)
}
}
Expand Down
10 changes: 0 additions & 10 deletions test/endtoend/operator/operator-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3886,8 +3886,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -4331,8 +4329,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -5708,8 +5704,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -6153,8 +6147,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down Expand Up @@ -7146,8 +7138,6 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
required:
- resources
type: object
name:
default: ""
Expand Down

0 comments on commit 8b0d8a0

Please sign in to comment.