Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added resources limits definition for wait-for-db container #2501

Merged
merged 10 commits into from
Jul 12, 2023
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions helm/oncall/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
28 changes: 28 additions & 0 deletions helm/oncall/tests/__snapshot__/wait_for_db_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: {}
15 changes: 15 additions & 0 deletions helm/oncall/tests/wait_for_db_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions helm/oncall/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,10 @@ init:
# runAsGroup: 1337
# runAsNonRoot: true
# runAsUser: 1337
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi