diff --git a/CHANGELOG.md b/CHANGELOG.md index e902ca54b0..6b53a492a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- [Helm] Added ability to specify `resources` definition within the `wait-for-db` init container by @Shelestov7 + ([#2501](https://github.com/grafana/oncall/pull/2501)) + ### Changed - Deprecated `/maintenance` web UI page. Maintenance is now handled at the integration level and can be performed diff --git a/helm/oncall/templates/_helpers.tpl b/helm/oncall/templates/_helpers.tpl index e58f9edc20..4cf593eec6 100644 --- a/helm/oncall/templates/_helpers.tpl +++ b/helm/oncall/templates/_helpers.tpl @@ -92,6 +92,8 @@ Create the name of the service account to use command: ['sh', '-c', "until (python manage.py migrate --check); do echo Waiting for database migrations; sleep 2; done"] securityContext: {{ toYaml .Values.init.securityContext | nindent 4 }} + resources: + {{ toYaml .Values.init.resources | nindent 4 }} env: {{- include "snippet.oncall.env" . | nindent 4 }} {{- include "snippet.mysql.env" . | nindent 4 }} @@ -107,6 +109,8 @@ Create the name of the service account to use command: ['sh', '-c', "until (python manage.py migrate --check); do echo Waiting for database migrations; sleep 2; done"] securityContext: {{ toYaml .Values.init.securityContext | nindent 4 }} + resources: + {{ toYaml .Values.init.resources | nindent 4 }} env: {{- include "snippet.oncall.env" . | nindent 4 }} {{- include "snippet.postgresql.env" . | nindent 4 }} diff --git a/helm/oncall/tests/__snapshot__/wait_for_db_test.yaml.snap b/helm/oncall/tests/__snapshot__/wait_for_db_test.yaml.snap index 7d764bdef1..fc8d400e48 100644 --- a/helm/oncall/tests/__snapshot__/wait_for_db_test.yaml.snap +++ b/helm/oncall/tests/__snapshot__/wait_for_db_test.yaml.snap @@ -71,6 +71,13 @@ database.type=mysql -> should create initContainer for MySQL database (default): image: grafana/oncall:v1.2.36 imagePullPolicy: Always name: wait-for-db + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi securityContext: {} 2: | - command: @@ -144,6 +151,13 @@ database.type=mysql -> should create initContainer for MySQL database (default): image: grafana/oncall:v1.2.36 imagePullPolicy: Always name: wait-for-db + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi securityContext: {} database.type=postgresql -> should create initContainer for PostgreSQL database: 1: | @@ -220,6 +234,13 @@ database.type=postgresql -> should create initContainer for PostgreSQL database: image: grafana/oncall:v1.2.36 imagePullPolicy: Always name: wait-for-db + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi securityContext: {} 2: | - command: @@ -295,4 +316,11 @@ database.type=postgresql -> should create initContainer for PostgreSQL database: image: grafana/oncall:v1.2.36 imagePullPolicy: Always name: wait-for-db + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi securityContext: {} diff --git a/helm/oncall/tests/wait_for_db_test.yaml b/helm/oncall/tests/wait_for_db_test.yaml index e43b1ef8cb..9a8bdf8e20 100644 --- a/helm/oncall/tests/wait_for_db_test.yaml +++ b/helm/oncall/tests/wait_for_db_test.yaml @@ -8,6 +8,14 @@ chart: appVersion: v1.2.36 tests: - it: database.type=mysql -> should create initContainer for MySQL database (default) + set: + init.resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi asserts: - contains: path: spec.template.spec.initContainers @@ -26,6 +34,13 @@ tests: set: database.type: postgresql externalPostgresql.host: some-postgresql-host + init.resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi asserts: - contains: path: spec.template.spec.initContainers diff --git a/helm/oncall/values.yaml b/helm/oncall/values.yaml index 079ae51f17..63963c08ed 100644 --- a/helm/oncall/values.yaml +++ b/helm/oncall/values.yaml @@ -422,3 +422,10 @@ init: # runAsGroup: 1337 # runAsNonRoot: true # runAsUser: 1337 + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi