You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UPSTREAM: <carry>: add new admission for handling shared cpus
Adding a new mutation plugin that handles the following:
1. In case of `workload.openshift.io/enable-shared-cpus` request, it
adds an annotation to hint runtime about the request. runtime
is not aware of extended resources, hence we need the annotation.
2. It validates the pod's QoS class and return an error if it's not a
guaranteed QoS class
3. It validates that no more than a single resource is being request.
4. It validates that the pod deployed in a namespace that has mixedcpus
workloads allowed annotation.
For more information see - openshift/enhancements#1396
Signed-off-by: Talor Itzhak <[email protected]>
UPSTREAM: <carry>: Update management webhook pod admission logic
Updating the logic for pod admission to allow a pod creation with workload partitioning annotations to be run in a namespace that has no workload allow annoations.
The pod will be stripped of its workload annotations and treated as if it were normal, a warning annoation will be placed to note the behavior on the pod.
Signed-off-by: ehila <[email protected]>
UPSTREAM: <carry>: add support for cpu limits into management workloads
Added support to allow workload partitioning to use the CPU limits for a container, to allow the runtime to make better decisions around workload cpu quotas we are passing down the cpu limit as part of the cpulimit value in the annotation. CRI-O will take that information and calculate the quota per node. This should support situations where workloads might have different cpu period overrides assigned.
Updated kubelet for static pods and the admission webhook for regular to support cpu limits.
Updated unit test to reflect changes.
Signed-off-by: ehila <[email protected]>
allErrs=append(allErrs, field.Invalid(field.NewPath("spec.containers.resources.requests"), c.Resources.Requests, fmt.Sprintf("the pod without workload annotations can not have containers with workload resources %q", resourceName)))
601
634
}
602
-
} else {
603
-
if!doesNamespaceAllowWorkloadType(ns.Annotations, workloadType) { // pod has workload annotation, but the pod does not have workload annotation
604
-
allErrs=append(allErrs, getPodInvalidWorkloadAnnotationError(pod.Annotations, fmt.Sprintf("the pod can not have workload annotation, when the namespace %q does not allow it", ns.Name)))
605
-
}
606
-
607
-
for_, v:=rangeworkloadResourceAnnotations {
608
-
iflen(v) >1 {
609
-
allErrs=append(allErrs, field.Invalid(field.NewPath("metadata.annotations"), pod.Annotations, "the pod resource annotation value can not have more than one key"))
610
-
}
611
-
612
-
// the pod should not have any resource annotations with the value that includes keys different from cpushares
allErrs=append(allErrs, field.Invalid(field.NewPath("metadata.annotations"), pod.Annotations, "the pod resource annotation value should have only cpushares key"))
615
-
}
616
-
}
635
+
case!doesNamespaceAllowWorkloadType(ns.Annotations, workloadType): // pod has workload annotation, but the namespace does not allow specified workload
636
+
allErrs=append(allErrs, getPodInvalidWorkloadAnnotationError(pod.Annotations, fmt.Sprintf("the namespace %q does not allow the workload type %s", ns.Name, workloadType)))
workloadAdmissionWarning: "skipping pod CPUs requests modifications because the namespace namespace is not annotated with workload.openshift.io/allowed to allow workload partitioning",
expectedError: fmt.Errorf("the pod without workload annotations can not have containers with workload resources %q", "management.workload.openshift.io/cores"),
438
459
},
439
460
{
440
-
name: "should return invalid error when the pod has workload annotation, but the pod namespace does not have allowed annotation",
441
-
pod: testManagedPod(
461
+
name: "should return invalid error when the pod has workload annotation, but the pod namespace does not have allowed workload type",
0 commit comments