mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 11:48:53 +00:00
prometheus: Do not attempt to set default memory request for 2.0
Default memory request was created, in order to be able to estimate target heap size for Prometheus 1.x servers. This is no longer necessary in Prometheus 2.x, as memory management is automated with mmap which is handled by the underlying kernel.
This commit is contained in:
parent
f7cb6f5906
commit
3a27eee3dc
1 changed files with 9 additions and 1 deletions
|
@ -89,6 +89,14 @@ func makeStatefulSet(p monitoringv1.Prometheus, old *appsv1.StatefulSet, config
|
|||
if p.Spec.Version == "" {
|
||||
p.Spec.Version = DefaultVersion
|
||||
}
|
||||
|
||||
versionStr := strings.TrimLeft(p.Spec.Version, "v")
|
||||
|
||||
version, err := semver.Parse(versionStr)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "parse version")
|
||||
}
|
||||
|
||||
if p.Spec.Replicas == nil {
|
||||
p.Spec.Replicas = &minReplicas
|
||||
}
|
||||
|
@ -105,7 +113,7 @@ func makeStatefulSet(p monitoringv1.Prometheus, old *appsv1.StatefulSet, config
|
|||
}
|
||||
_, memoryRequestFound := p.Spec.Resources.Requests[v1.ResourceMemory]
|
||||
memoryLimit, memoryLimitFound := p.Spec.Resources.Limits[v1.ResourceMemory]
|
||||
if !memoryRequestFound {
|
||||
if !memoryRequestFound && version.Major == 1 {
|
||||
defaultMemoryRequest := resource.MustParse("2Gi")
|
||||
compareResult := memoryLimit.Cmp(defaultMemoryRequest)
|
||||
// If limit is given and smaller or equal to 2Gi, then set memory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue