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

# What this PR does
Added 'resources limits' definition for wait-for-db container

## Which issue(s) this PR fixes

I face a problem: when i install OnCall by Helm, my pods with
oncall-engine and oncall-celery stuck on Init state, because they don't
have enough resources to run.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
This commit is contained in:
Ivan Shelestov 2023-07-12 17:30:20 +02:00 committed by GitHub
parent 79fc529019
commit 939590fe4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 0 deletions

View file

@ -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

View file

@ -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 }}

View file

@ -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: {}

View file

@ -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

View file

@ -422,3 +422,10 @@ init:
# runAsGroup: 1337
# runAsNonRoot: true
# runAsUser: 1337
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi