Skip to content

Commit

Permalink
use memory intensive resource for arbiter in mongodb v7+
Browse files Browse the repository at this point in the history
Signed-off-by: sayedppqq <[email protected]>
  • Loading branch information
sayedppqq committed Nov 15, 2024
1 parent f768526 commit fa97422
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,16 @@ var (
defaultArbiter = core.ResourceRequirements{
Requests: core.ResourceList{
core.ResourceStorage: resource.MustParse("2Gi"),
// these are the default cpu & memory for a coordinator container
core.ResourceCPU: resource.MustParse(".200"),
core.ResourceMemory: resource.MustParse("250Mi"),
},
Limits: core.ResourceList{
core.ResourceMemory: resource.MustParse("250Mi"),
},
}
DefaultArbiterMemoryIntensive = core.ResourceRequirements{
Requests: core.ResourceList{
// these are the default cpu & memory for a coordinator container
core.ResourceCPU: resource.MustParse(".200"),
core.ResourceMemory: resource.MustParse("500Mi"),
Expand Down
6 changes: 5 additions & 1 deletion apis/kubedb/v1/mongodb_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,11 @@ func (m *MongoDB) setContainerDefaultValues(container *core.Container, mgVersion
defaultResource core.ResourceRequirements, isArbiter ...bool,
) {
if len(isArbiter) > 0 && isArbiter[0] {
m.setContainerDefaultResources(container, kubedb.DefaultArbiter(true))
if m.isLaterVersion(mgVersion, 7) {
m.setContainerDefaultResources(container, kubedb.DefaultArbiterMemoryIntensive)
} else {
m.setContainerDefaultResources(container, kubedb.DefaultArbiter(true))
}
} else {
m.setContainerDefaultResources(container, defaultResource)
}
Expand Down

0 comments on commit fa97422

Please sign in to comment.