mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-20 03:57:02 +08:00
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:
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-binding.yml
|
||||
- include_tasks: create-resource-quota.yml
|
||||
- include_tasks: create-limit-range.yml
|
||||
|
||||
Reference in New Issue
Block a user