Skip to content

Commit

Permalink
Increase cpu limits for postgres (#636)
Browse files Browse the repository at this point in the history
Increase cpu limits for postgres

If we don't set cpu limits they are being set by default (500m) but this value is too low for some of our pods.
Keep cpu limits.
Increase postgres cpu limit.

Reviewed-by: Laura Barcziová
  • Loading branch information
softwarefactory-project-zuul[bot] authored Jan 16, 2025
2 parents 442eb44 + 972d20a commit 7812e9d
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions openshift/dashboard.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ spec:
cpu: "5m"
limits:
memory: "256Mi"
cpu: "50m"
volumes:
- name: packit-secrets
secret:
Expand Down
1 change: 1 addition & 0 deletions openshift/flower.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
cpu: "5m"
limits:
memory: "128Mi"
cpu: "50m"
replicas: 1
strategy:
type: Recreate
Expand Down
1 change: 1 addition & 0 deletions openshift/nginx.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
cpu: "5m"
limits:
memory: "32Mi"
cpu: "10m"
replicas: 1
strategy:
type: Recreate
Expand Down
1 change: 1 addition & 0 deletions openshift/packit-service-beat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ spec:
ephemeral-storage: "80Ki"
limits:
memory: "256Mi"
cpu: "50m"
replicas: 1
strategy:
type: Recreate
1 change: 1 addition & 0 deletions openshift/packit-service-fedmsg.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
cpu: "5m"
limits:
memory: "128Mi"
cpu: "50m"
livenessProbe:
exec:
command:
Expand Down
3 changes: 2 additions & 1 deletion openshift/packit-service.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ spec:
# you have to temporarily increase (in webUI/console) the limit
# and once the alembic upgrade passes, revert.
memory: "{{ '4Gi' if project == 'packit--prod' else '512Mi' }}"
cpu: "200m"
# In TLS world, hostname needs to match whatever is set in the cert
# in our cause, k8s is doing here something like curl https://172.15.2.4:8443/api/healthz/
# which will fail TLS validation.
Expand Down Expand Up @@ -142,7 +143,7 @@ spec:
readOnly: true
resources:
requests: {memory: "128Mi", cpu: "10m"}
limits: {memory: "128Mi"}
limits: {memory: "128Mi", cpu: "100m"}
{% endif %}
---
apiVersion: v1
Expand Down
7 changes: 4 additions & 3 deletions openshift/packit-worker.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ spec:
component: {{ component }}
serviceName: "{{ component }}"
replicas: {{ worker_replicas }}
volumeClaimTemplates:
{% if with_repository_cache and 'long-running' in queues %}
volumeClaimTemplates:
- metadata:
name: packit-worker-repository-cache
{% if managed_platform %}
Expand Down Expand Up @@ -94,7 +94,7 @@ spec:
- name: DEPLOYMENT
value: {{ deployment }}
- name: DISTGIT_URL
value: {{ distgit_url }}
value: "{{ distgit_url }}"
- name: DISTGIT_NAMESPACE
value: {{ distgit_namespace }}
{% if sourcegit_namespace %}
Expand Down Expand Up @@ -166,6 +166,7 @@ spec:
cpu: {{ worker_requests_cpu }}
limits:
memory: {{ worker_limits_memory }}
cpu: {{ worker_limits_cpu }}
livenessProbe:
exec:
command:
Expand Down Expand Up @@ -196,7 +197,7 @@ spec:
readOnly: true
resources:
requests: {memory: "128Mi", cpu: "10m"}
limits: {memory: "128Mi"}
limits: {memory: "128Mi", cpu: "100m"}
{% endif %}
---
kind: ImageStream
Expand Down
1 change: 1 addition & 0 deletions openshift/postgres.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ spec:
# based on this limit, so keep the limit reasonably high.
memory: "{{ '4Gi' if project == 'packit--prod' else '512Mi' }}"
# Not utilized most of the time, but useful during migrations and for some queries
cpu: "2"
volumeMounts:
- name: postgres-data
mountPath: /var/lib/pgsql/data
Expand Down
1 change: 1 addition & 0 deletions openshift/pushgateway.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ spec:
cpu: "5m"
limits:
memory: "32Mi"
cpu: "50m"
replicas: 1
strategy:
type: Recreate
Expand Down
1 change: 1 addition & 0 deletions openshift/redict.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
cpu: "10m"
limits:
memory: "256Mi"
cpu: "10m"
volumes:
- name: redict-pv
persistentVolumeClaim:
Expand Down
1 change: 1 addition & 0 deletions openshift/redis-commander.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
cpu: "10m"
limits:
memory: "32Mi"
cpu: "10m"
replicas: 1
strategy:
type: Recreate
Expand Down
1 change: 1 addition & 0 deletions openshift/redis.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ spec:
cpu: "10m"
limits:
memory: "64Mi"
cpu: "10m"
volumes:
- name: redis-pv
persistentVolumeClaim:
Expand Down
1 change: 1 addition & 0 deletions openshift/valkey.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
cpu: "10m"
limits:
memory: "256Mi"
cpu: "50m"
volumes:
- name: valkey-pv
persistentVolumeClaim:
Expand Down
1 change: 1 addition & 0 deletions playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
cpu: "5m"
limits:
memory: "128Mi"
cpu: "50m"
appcode: PCKT-002
servicephase: lab
costcenter: "700"
Expand Down
1 change: 1 addition & 0 deletions roles/deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ tokman:
cpu: "5m"
limits:
memory: "128Mi"
cpu: "50m"
appcode: PCKT-002
servicephase: lab
costcenter: "700"
Expand Down
3 changes: 3 additions & 0 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
worker_requests_memory: "384Mi"
worker_requests_cpu: "100m"
worker_limits_memory: "1024Mi"
worker_limits_cpu: "400m"
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
Expand All @@ -205,6 +206,7 @@
worker_requests_memory: "320Mi"
worker_requests_cpu: "80m"
worker_limits_memory: "640Mi"
worker_limits_cpu: "2"
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
Expand Down Expand Up @@ -236,6 +238,7 @@
worker_requests_memory: "768Mi"
worker_requests_cpu: "100m"
worker_limits_memory: "2048Mi"
worker_limits_cpu: "600m"
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
Expand Down
3 changes: 2 additions & 1 deletion tasks/check-up-to-date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
# Remove the keys expected to be different and lines specific to the diff-format.
cmd: >-
diff vars/{{ service }}/{{ deployment }}.yml vars/{{ service }}/{{ deployment }}_template.yml |
sed '/api_key/d;/[0-9]\+c[0-9]\+/d;/---/d'
sed '/api_key/d;/[0-9]\+c[0-9]\+/d;/---/d' |
sed '/host/d;/[0-9]\+c[0-9]\+/d;/---/d'
register: vars_diff
changed_when: vars_diff.rc != 0
failed_when: vars_diff.rc != 0
Expand Down
2 changes: 1 addition & 1 deletion vars/packit/dev_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ check_up_to_date: false
# Check that the current vars file us up to date with the template
# check_vars_template_diff: true

# with_tokman: true
with_tokman: true

# if you want to deploy fedmsg, please make sure to
# edit the queue name in secrets/*/fedora.toml
Expand Down
3 changes: 2 additions & 1 deletion vars/packit/prod_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ api_key: ""
# Check that the current vars file us up to date with the template
# check_vars_template_diff: true

# with_tokman: false
with_tokman: false

# if you want to deploy fedmsg, please make sure to
# edit the queue name in secrets/*/fedora.toml
Expand Down Expand Up @@ -99,3 +99,4 @@ tokman:
cpu: "20m"
limits:
memory: "160Mi"
cpu: "50m"
2 changes: 1 addition & 1 deletion vars/packit/stg_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ api_key: ""
# Check that the current vars file us up to date with the template
# check_vars_template_diff: true

# with_tokman: false
with_tokman: false

# if you want to deploy fedmsg, please make sure to
# edit the queue name in secrets/*/fedora.toml
Expand Down

0 comments on commit 7812e9d

Please sign in to comment.