Skip to content

Commit

Permalink
Merge pull request #2 from projectsyn/resource_limits
Browse files Browse the repository at this point in the history
Support configuring container memory and CPU limits
  • Loading branch information
psy-q authored Aug 26, 2021
2 parents 13d7a7f + 833e425 commit 3736857
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
8 changes: 8 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ parameters:
monitor_user: maxscale
service_pwd: ?{vaultkv:${customer:name}/${cluster:name}/${_instance}/service_pwd}
monitor_pwd: ?{vaultkv:${customer:name}/${cluster:name}/${_instance}/monitor_pwd}
containers:
resources:
requests:
cpu: 1000m
memory: 128Mi
limits:
cpu: 2000m
memory: 512Mi
images:
maxscale:
image: docker.io/mariadb/maxscale
Expand Down
10 changes: 8 additions & 2 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ local deployment = kube.Deployment('maxscale') {
initialDelaySeconds: 15,
},
resources: {
requests: { cpu: '1000m', memory: '128Mi' },
limits: { cpu: '2000m', memory: '512Mi' },
requests: {
cpu: params.containers.resources.requests.cpu,
memory: params.containers.resources.requests.memory,
},
limits: {
cpu: params.containers.resources.limits.cpu,
memory: params.containers.resources.limits.memory,
},
},
volumeMounts: [
{
Expand Down
43 changes: 41 additions & 2 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Parameters
= Maxscale Parameters

The parent key for all of the following parameters is `maxscale`.
The parent key for the following parameters is `maxscale` and they affect MaxScale itself:

== `namespace`

Expand Down Expand Up @@ -82,6 +82,37 @@ default:: `?{vaultkv:${customer:name}/${cluster:name}/maxscale/service_pwd}`
type:: string
default:: `?{vaultkv:${customer:name}/${cluster:name}/maxscale/monitor_pwd}`


= Container Parameters

The parent key for the following parameters is `containers` and they affect the MaxScale containers:


== `resources.requests.cpu`

[horizontal]
type:: string
default:: `1000m`

== `resources.requests.memory`

[horizontal]
type:: string
default:: `128Mi`

== `resources.limits.cpu`

[horizontal]
type:: string
default:: `2000m`

== `resources.limits.memory`

[horizontal]
type:: string
default:: `512Mi`


== Example

[source,yaml]
Expand All @@ -96,4 +127,12 @@ maxscale:
db3_port: 3305
monitor_user: mymonitoruser
service_user: myserviceuser
containers:
resources:
requests:
cpu: 1000m
memory: 128Mi
limits:
cpu: 2000m
memory: 512Mi
----

0 comments on commit 3736857

Please sign in to comment.