Skip to content

Commit 5796a5e

Browse files
committed
Make mysqldExporter.resources optional
It's possible that mysqldExporter.extraFlags are provided while mysqldExporter.resources are not. Signed-off-by: Sergey Stankevich <stankevich@users.noreply.github.com>
1 parent 1283719 commit 5796a5e

6 files changed

Lines changed: 8 additions & 21 deletions

File tree

deploy/crds/planetscale.com_vitessclusters.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,8 +2049,6 @@ spec:
20492049
x-kubernetes-int-or-string: true
20502050
type: object
20512051
type: object
2052-
required:
2053-
- resources
20542052
type: object
20552053
name:
20562054
default: ""
@@ -2494,8 +2492,6 @@ spec:
24942492
x-kubernetes-int-or-string: true
24952493
type: object
24962494
type: object
2497-
required:
2498-
- resources
24992495
type: object
25002496
name:
25012497
default: ""

deploy/crds/planetscale.com_vitesskeyspaces.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ spec:
590590
x-kubernetes-int-or-string: true
591591
type: object
592592
type: object
593-
required:
594-
- resources
595593
type: object
596594
name:
597595
default: ""
@@ -1035,8 +1033,6 @@ spec:
10351033
x-kubernetes-int-or-string: true
10361034
type: object
10371035
type: object
1038-
required:
1039-
- resources
10401036
type: object
10411037
name:
10421038
default: ""

deploy/crds/planetscale.com_vitessshards.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,6 @@ spec:
573573
x-kubernetes-int-or-string: true
574574
type: object
575575
type: object
576-
required:
577-
- resources
578576
type: object
579577
name:
580578
default: ""

pkg/apis/planetscale/v2/vitessshard_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ type MysqldExporterSpec struct {
326326
ExtraFlags map[string]string `json:"extraFlags,omitempty"`
327327

328328
// Resources specify the compute resources to allocate for just the MySQL Exporter.
329-
Resources corev1.ResourceRequirements `json:"resources"`
329+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
330330
}
331331

332332
// VitessTabletPoolType represents the tablet types for which it makes sense

pkg/operator/vttablet/pod.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
248248
corev1.ResourceMemory: *resource.NewQuantity(mysqldExporterMemoryLimitBytes, resource.BinarySI),
249249
},
250250
}
251+
// TODO(enisoc): Add readiness and liveness probes that make sense for mysqld-exporter.
252+
// This depends on the exact semantics of each of mysqld-exporter's HTTP handlers,
253+
// so we need to do more investigation. For now it's better to leave them empty.
254+
}
255+
256+
if spec.MysqldExporter != nil && (len(spec.MysqldExporter.Resources.Limits) > 0 || len(spec.MysqldExporter.Resources.Requests) > 0) {
257+
update.ResourceRequirements(&mysqldExporterContainer.Resources, &spec.MysqldExporter.Resources)
251258
}
252259
}
253260

test/endtoend/operator/operator-latest.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,8 +3931,6 @@ spec:
39313931
x-kubernetes-int-or-string: true
39323932
type: object
39333933
type: object
3934-
required:
3935-
- resources
39363934
type: object
39373935
name:
39383936
default: ""
@@ -4376,8 +4374,6 @@ spec:
43764374
x-kubernetes-int-or-string: true
43774375
type: object
43784376
type: object
4379-
required:
4380-
- resources
43814377
type: object
43824378
name:
43834379
default: ""
@@ -5758,8 +5754,6 @@ spec:
57585754
x-kubernetes-int-or-string: true
57595755
type: object
57605756
type: object
5761-
required:
5762-
- resources
57635757
type: object
57645758
name:
57655759
default: ""
@@ -6203,8 +6197,6 @@ spec:
62036197
x-kubernetes-int-or-string: true
62046198
type: object
62056199
type: object
6206-
required:
6207-
- resources
62086200
type: object
62096201
name:
62106202
default: ""
@@ -7201,8 +7193,6 @@ spec:
72017193
x-kubernetes-int-or-string: true
72027194
type: object
72037195
type: object
7204-
required:
7205-
- resources
72067196
type: object
72077197
name:
72087198
default: ""

0 commit comments

Comments
 (0)