communishift: set default resource limits for pods

Once a resource quota is set for a namespace, kube will refuse to
schedule any pod without limits set, including build pod.
This can be difficult to figure out unless you know where to look, and
can be challenging for new openshift/kubernetes users.
Setting a default limit would, at least, avoid the non-schedulable
issue.
This commit is contained in:
Francois Andrieu 2023-02-03 15:44:56 +01:00 committed by kevin
parent 57065bd9b0
commit 7e979cb2f7
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,21 @@
---
- name: Create a k8s LimitRange
community.okd.k8s:
api_key: "{{ communishift_ocp_api_token }}"
host: "{{ communishift_ocp_api_host }}"
state: present
definition:
apiVersion: v1
kind: LimitRange
metadata:
name: "{{ communishift_project_name }}-limitrange"
namespace: "{{ communishift_project_name }}"
spec:
limits:
- default:
cpu: 500m
memory: 500Mi
defaultRequest:
cpu: 100m
memory: 100Mi
type: Container

View file

@ -12,3 +12,4 @@
- include_tasks: create-role.yml - include_tasks: create-role.yml
- include_tasks: create-role-binding.yml - include_tasks: create-role-binding.yml
- include_tasks: create-resource-quota.yml - include_tasks: create-resource-quota.yml
- include_tasks: create-limit-range.yml