roy-ht / extended-resource-toleration-webhook

Webhook implementation of ExtendedResourceToleration plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is it?

Dynamic version of ExtendedResourceToleration plugin for Kubernetes.

It automatically adds tolerations if Pod definition has extended resource requests/limits, like:

apiVersion: v1
kind: Pod
metadata:
  name: gpu-app
spec:
  containers:
    - name: gpu-app
      image: "some-gpu-required-image:latest"
      resources:
        limits:
          nvidia.com/gpu: 1 # requesting 1 GPU

into

apiVersion: v1
kind: Pod
metadata:
  name: gpu-app
spec:
  containers:
    - name: gpu-app
      image: "some-gpu-required-image:latest"
      resources:
        limits:
          nvidia.com/gpu: 1 # requesting 1 GPU
  tolerations:
    - key: "nvidia.com/gpu"
      operator: "Exists"
      effect: "NoSchedule"

dynamically when scheduling to create a pod.

See official Documentation for detail.

Usage

You need some dependencies:

git clone https://github.com/roy-ht/extended-resource-toleration.git
cd extended-resource-toleration
# You can check manifests if needed
KS_NAMESPACE=default KS_ARG="--dryrun" make apply-k8s
KS_NAMESPACE=default make apply-k8s

Acknowledgements

Some part of codes are derived from below:

About

Webhook implementation of ExtendedResourceToleration plugin

License:Apache License 2.0


Languages

Language:Go 69.8%Language:Shell 23.1%Language:Dockerfile 3.8%Language:Makefile 3.3%