mammoth-rainbow-82717
06/26/2024, 1:35 PMfast-vr-44972
06/26/2024, 2:48 PMkubernetes decorator itself though.mammoth-rainbow-82717
06/26/2024, 2:59 PMancient-application-36103
06/26/2024, 6:05 PMMETAFLOW_KUBERNETES_QOS=burstable could unset limits, METAFLOW_KUBERNETES_QOS=guaranteed could set requests=limits, METAFLOW_KUBERNETES_QOS=optimum could set requests=limits for everything but cpu.
i am yet to come across a use case where requests and limits would be set to non-zero yet different values for running ML workloads.mammoth-rainbow-82717
06/27/2024, 7:58 AMre: mutations - you could use a kyverno policy. we use that internally to apply validation checks, enforce priorities and heuristics to set requests & limits.
Do you have an example, or can you point me to a reference on how you can use kyverno to set a resource limit to match the resource request of the pod?
I don't seem to be able to see how one can use the current object as part of the mutation, but maybe I am missing something obvious. I know it is definitely not possible with gatekeppermammoth-rainbow-82717
06/27/2024, 8:00 AMMETAFLOW_KUBERNETES_QOS=burstable could unset limits, METAFLOW_KUBERNETES_QOS=guaranteed could set requests=limits, METAFLOW_KUBERNETES_QOS=optimum could set requests=limits for everything but cpu.
>
> i am yet to come across a use case where requests and limits would be set to non-zero yet different values for running ML workloads.
This is effectively the proposal we originally agreed upon and for which I subsequently made a PR. However, I wasn't able to make much progress in getting a review on it on the Metaflow side and you suggested using a policy agent instead.prehistoric-salesclerk-95013
06/27/2024, 6:19 PMancient-application-36103
06/27/2024, 6:23 PMprehistoric-salesclerk-95013
06/27/2024, 6:27 PMancient-application-36103
06/27/2024, 6:30 PMmammoth-rainbow-82717
06/28/2024, 7:17 AMmammoth-rainbow-82717
06/28/2024, 7:21 AMancient-application-36103
06/28/2024, 2:49 PMapiVersion: <http://kyverno.io/v1|kyverno.io/v1>
kind: ClusterPolicy
metadata:
name: set-limits-equal-to-requests
spec:
rules:
- name: set-limits-equal-to-requests
match:
resources:
kinds:
- Pod
mutate:
foreach:
- list: "spec.containers"
context:
- name: requestsCpu
variable: "{{ element.resources.requests.cpu }}"
- name: requestsMemory
variable: "{{ element.resources.requests.memory }}"
patchStrategicMerge:
spec:
containers:
- (name): "{{ element.name }}"
resources:
limits:
cpu: "{{ requestsCpu }}"
memory: "{{ requestsMemory }}"
preconditions:
all:
- key: "{{ element.resources.requests.cpu }}"
operator: Exists
- key: "{{ element.resources.requests.memory }}"
operator: Exists
- key: "{{ element.resources.limits.cpu }}"
operator: NotExists
- key: "{{ element.resources.limits.memory }}"
operator: NotExistsmammoth-rainbow-82717
06/28/2024, 4:21 PM