Skip to content

Commit a1b725b

Browse files
authored
Merge pull request #7 from vshn/feat/configure-resources
Make operator resources configurable
2 parents 06842e6 + 102b4ee commit a1b725b

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

class/defaults.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ parameters:
1414
sync_cluster_role: ""
1515
manifest_version: ${statefulset_resize_controller:images:operator:version}
1616
manifest_url: https://raw.githubusercontent.com/vshn/statefulset-resize-controller/${statefulset_resize_controller:manifest_version}/config
17+
operator:
18+
resources: {}

component/main.jsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ local objects = [
8080
c {
8181
image: image,
8282
args: controller_args,
83+
resources+: params.operator.resources,
8384
}
8485
else
8586
c

docs/modules/ROOT/pages/references/parameters.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ This ensures that the controller can create RoleBindings for the provided Cluste
4848
If the parameter is the empty string, no additional ClusterRole is configured for the sync jobs.
4949

5050
For example, this parameter can be used to allow the sync jobs to use a non-default PodSecurityPolicy, by specifying a ClusterRole which allows using that PodSecurityPolicy.
51+
52+
53+
== `operator.resources`
54+
55+
[horizontal]
56+
type:: obj
57+
default:: `{}`
58+
59+
Overrides for the resource requests and limits of the operator container.

tests/defaults.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
# Overwrite parameters here
2-
3-
# parameters: {...}
1+
parameters:
2+
statefulset_resize_controller:
3+
operator:
4+
resources:
5+
limits:
6+
memory: 300Mi

tests/operator_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func Test_OperatorDeployment(t *testing.T) {
4343
assert.Equal(t, rsyncImage, c.Args[1])
4444
assert.Equal(t, "", c.Args[3])
4545

46+
assert.Equal(t, "20Mi", c.Resources.Requests.Memory().String())
47+
assert.Equal(t, "300Mi", c.Resources.Limits.Memory().String())
48+
4649
assert.Equal(t, saName, deploy.Spec.Template.Spec.ServiceAccountName)
4750
}
4851

0 commit comments

Comments
 (0)