k8snetworkplumbingwg / network-resources-injector

A Kubernetes Dynamic Admission Controller that patches Pods to add additional information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow control of per-pod injection for a given resource

zshi-redhat opened this issue · comments

commented

In a large cluster, user may want to apply a given NRI injection for certain pods, but not the others.
For example, NRI would inject resource requests/limits to first container in the pod, but this doesn't work for pod with multiple containers (with each requesting a userspace device). So user would like to disable resource injection for muiltiple userspace containers and keep using it for the rest of pods.

A possible solution for this issue:

  1. Define a k8s label for each NRI supported injection

Such as:
network-resources-injector-downward-api-volume: true
network-resources-injector-k8s-extended-resource: false

These labels will be recognized by NRI and has default value being true.

  1. User add the labels in pod spec indicating whether or not a certain resource injection should be enabled/disabled. Default is true (enabled) in the cases that label is not added or label value is not set.
  2. Based on the label key and/or value, NRI would enable or disable resource injection for that particular pod.