Skip to content

Commit

Permalink
Fix how we set the resources for mysqldExporter
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Dec 2, 2024
1 parent 0035266 commit 8e40859
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/operator/vttablet/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,15 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
},
SecurityContext: securityContext,
VolumeMounts: mysqldMounts,
Resources: corev1.ResourceRequirements{
// TODO(enisoc): Add readiness and liveness probes that make sense for mysqld-exporter.
// This depends on the exact semantics of each of mysqld-exporter's HTTP handlers,
// so we need to do more investigation. For now it's better to leave them empty.
}

if spec.MysqldExporter != nil && (len(spec.MysqldExporter.Resources.Limits) > 0 || len(spec.MysqldExporter.Resources.Requests) > 0) {
mysqldExporterContainer.Resources = spec.MysqldExporter.Resources
} else {
mysqldExporterContainer.Resources = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: *resource.NewMilliQuantity(mysqldExporterCPURequestMillis, resource.DecimalSI),
corev1.ResourceMemory: *resource.NewQuantity(mysqldExporterMemoryRequestBytes, resource.BinarySI),
Expand All @@ -234,14 +242,7 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
corev1.ResourceCPU: *resource.NewMilliQuantity(mysqldExporterCPULimitMillis, resource.DecimalSI),
corev1.ResourceMemory: *resource.NewQuantity(mysqldExporterMemoryLimitBytes, resource.BinarySI),
},
},
// TODO(enisoc): Add readiness and liveness probes that make sense for mysqld-exporter.
// This depends on the exact semantics of each of mysqld-exporter's HTTP handlers,
// so we need to do more investigation. For now it's better to leave them empty.
}

if spec.MysqldExporter != nil {
update.ResourceRequirements(&mysqldExporterContainer.Resources, &spec.MysqldExporter.Resources)
}
}
}

Expand Down

0 comments on commit 8e40859

Please sign in to comment.