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:
parent
57065bd9b0
commit
7e979cb2f7
2 changed files with 22 additions and 0 deletions
21
roles/communishift/tasks/create-limit-range.yml
Normal file
21
roles/communishift/tasks/create-limit-range.yml
Normal 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
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue