From 453ef729106982453a852d1d9a0cd42b8497163d Mon Sep 17 00:00:00 2001 From: Maja Massarini Date: Wed, 15 Jan 2025 13:27:40 +0100 Subject: [PATCH] Remove cpu limits We are hitting several cpu limits and weird packit-service behaviour with it. Many resources on internet suggest not to use cpu limits (but instead adjust cpu requests if needed), like this one: https://medium.com/inside-sumup/are-kubernetes-cpu-limits-bad-a04430bf54e1 --- openshift/dashboard.yml.j2 | 1 - openshift/flower.yml.j2 | 1 - openshift/nginx.yml.j2 | 1 - openshift/packit-service-beat.yml.j2 | 1 - openshift/packit-service-fedmsg.yml.j2 | 1 - openshift/packit-service.yml.j2 | 3 +-- openshift/packit-worker.yml.j2 | 3 +-- openshift/postgres.yml.j2 | 1 - openshift/pushgateway.yml.j2 | 1 - openshift/redict.yml.j2 | 1 - openshift/redis-commander.yml.j2 | 1 - openshift/redis.yml.j2 | 1 - openshift/valkey.yml.j2 | 1 - playbooks/deploy.yml | 1 - roles/deploy/defaults/main.yml | 1 - roles/deploy/tasks/main.yml | 3 --- vars/packit/prod_template.yml | 1 - 17 files changed, 2 insertions(+), 21 deletions(-) diff --git a/openshift/dashboard.yml.j2 b/openshift/dashboard.yml.j2 index b9846f03..76f95ab6 100644 --- a/openshift/dashboard.yml.j2 +++ b/openshift/dashboard.yml.j2 @@ -48,7 +48,6 @@ spec: cpu: "5m" limits: memory: "256Mi" - cpu: "50m" volumes: - name: packit-secrets secret: diff --git a/openshift/flower.yml.j2 b/openshift/flower.yml.j2 index a1175a47..afa72188 100644 --- a/openshift/flower.yml.j2 +++ b/openshift/flower.yml.j2 @@ -40,7 +40,6 @@ spec: cpu: "5m" limits: memory: "128Mi" - cpu: "50m" replicas: 1 strategy: type: Recreate diff --git a/openshift/nginx.yml.j2 b/openshift/nginx.yml.j2 index faef227a..62077486 100644 --- a/openshift/nginx.yml.j2 +++ b/openshift/nginx.yml.j2 @@ -59,7 +59,6 @@ spec: cpu: "5m" limits: memory: "32Mi" - cpu: "10m" replicas: 1 strategy: type: Recreate diff --git a/openshift/packit-service-beat.yml.j2 b/openshift/packit-service-beat.yml.j2 index 2057f03f..27d04fdf 100644 --- a/openshift/packit-service-beat.yml.j2 +++ b/openshift/packit-service-beat.yml.j2 @@ -79,7 +79,6 @@ spec: ephemeral-storage: "80Ki" limits: memory: "256Mi" - cpu: "50m" replicas: 1 strategy: type: Recreate diff --git a/openshift/packit-service-fedmsg.yml.j2 b/openshift/packit-service-fedmsg.yml.j2 index 7cdbdb5f..256aae89 100644 --- a/openshift/packit-service-fedmsg.yml.j2 +++ b/openshift/packit-service-fedmsg.yml.j2 @@ -55,7 +55,6 @@ spec: cpu: "5m" limits: memory: "128Mi" - cpu: "50m" livenessProbe: exec: command: diff --git a/openshift/packit-service.yml.j2 b/openshift/packit-service.yml.j2 index ca6fc67e..6d2c7e9d 100644 --- a/openshift/packit-service.yml.j2 +++ b/openshift/packit-service.yml.j2 @@ -104,7 +104,6 @@ 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. @@ -143,7 +142,7 @@ spec: readOnly: true resources: requests: {memory: "128Mi", cpu: "10m"} - limits: {memory: "128Mi", cpu: "100m"} + limits: {memory: "128Mi"} {% endif %} --- apiVersion: v1 diff --git a/openshift/packit-worker.yml.j2 b/openshift/packit-worker.yml.j2 index 9269e0da..1c86cd0a 100644 --- a/openshift/packit-worker.yml.j2 +++ b/openshift/packit-worker.yml.j2 @@ -166,7 +166,6 @@ spec: cpu: {{ worker_requests_cpu }} limits: memory: {{ worker_limits_memory }} - cpu: {{ worker_limits_cpu }} livenessProbe: exec: command: @@ -197,7 +196,7 @@ spec: readOnly: true resources: requests: {memory: "128Mi", cpu: "10m"} - limits: {memory: "128Mi", cpu: "100m"} + limits: {memory: "128Mi"} {% endif %} --- kind: ImageStream diff --git a/openshift/postgres.yml.j2 b/openshift/postgres.yml.j2 index 541ef120..52fede4f 100644 --- a/openshift/postgres.yml.j2 +++ b/openshift/postgres.yml.j2 @@ -71,7 +71,6 @@ 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: "1" volumeMounts: - name: postgres-data mountPath: /var/lib/pgsql/data diff --git a/openshift/pushgateway.yml.j2 b/openshift/pushgateway.yml.j2 index 6bdab578..508eca0c 100644 --- a/openshift/pushgateway.yml.j2 +++ b/openshift/pushgateway.yml.j2 @@ -42,7 +42,6 @@ spec: cpu: "5m" limits: memory: "32Mi" - cpu: "10m" replicas: 1 strategy: type: Recreate diff --git a/openshift/redict.yml.j2 b/openshift/redict.yml.j2 index 4be86ecb..f21c2493 100644 --- a/openshift/redict.yml.j2 +++ b/openshift/redict.yml.j2 @@ -43,7 +43,6 @@ spec: cpu: "10m" limits: memory: "256Mi" - cpu: "10m" volumes: - name: redict-pv persistentVolumeClaim: diff --git a/openshift/redis-commander.yml.j2 b/openshift/redis-commander.yml.j2 index 0274e233..8414353a 100644 --- a/openshift/redis-commander.yml.j2 +++ b/openshift/redis-commander.yml.j2 @@ -51,7 +51,6 @@ spec: cpu: "10m" limits: memory: "32Mi" - cpu: "10m" replicas: 1 strategy: type: Recreate diff --git a/openshift/redis.yml.j2 b/openshift/redis.yml.j2 index dfd9c627..6bb7b16d 100644 --- a/openshift/redis.yml.j2 +++ b/openshift/redis.yml.j2 @@ -39,7 +39,6 @@ spec: cpu: "10m" limits: memory: "64Mi" - cpu: "10m" volumes: - name: redis-pv persistentVolumeClaim: diff --git a/openshift/valkey.yml.j2 b/openshift/valkey.yml.j2 index fb54e3d0..3cf982b5 100644 --- a/openshift/valkey.yml.j2 +++ b/openshift/valkey.yml.j2 @@ -43,7 +43,6 @@ spec: cpu: "10m" limits: memory: "256Mi" - cpu: "10m" volumes: - name: valkey-pv persistentVolumeClaim: diff --git a/playbooks/deploy.yml b/playbooks/deploy.yml index ad845ebd..f903862c 100644 --- a/playbooks/deploy.yml +++ b/playbooks/deploy.yml @@ -63,7 +63,6 @@ cpu: "5m" limits: memory: "128Mi" - cpu: "50m" appcode: PCKT-002 servicephase: lab costcenter: "700" diff --git a/roles/deploy/defaults/main.yml b/roles/deploy/defaults/main.yml index 89480d5a..d3e89b23 100644 --- a/roles/deploy/defaults/main.yml +++ b/roles/deploy/defaults/main.yml @@ -56,7 +56,6 @@ tokman: cpu: "5m" limits: memory: "128Mi" - cpu: "50m" appcode: PCKT-002 servicephase: lab costcenter: "700" diff --git a/roles/deploy/tasks/main.yml b/roles/deploy/tasks/main.yml index 4fee46d3..d950de9d 100644 --- a/roles/deploy/tasks/main.yml +++ b/roles/deploy/tasks/main.yml @@ -188,7 +188,6 @@ 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') }}" @@ -206,7 +205,6 @@ 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') }}" @@ -238,7 +236,6 @@ 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') }}" diff --git a/vars/packit/prod_template.yml b/vars/packit/prod_template.yml index 1048e5a3..b0bd0688 100644 --- a/vars/packit/prod_template.yml +++ b/vars/packit/prod_template.yml @@ -99,4 +99,3 @@ tokman: cpu: "20m" limits: memory: "160Mi" - cpu: "50m"