Skip to content

This is a Kubernetes validating webhook written in Python using Flask.

Notifications You must be signed in to change notification settings

ugur99/kubernetes-validating-webhook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Validating Webhook

This repo was forked from k-mitevski/kubernetes-validating-webhook. I suggest this great article for a newcomer on webhooks to get basic but valuable insight about writing a simple admission webhook.

Even though we can limit the requested cpu using the limitrange on the container level, I just wanted to do the same thing using the webhook.

How it works?

When a deployment is triggered, the request is intercepted by the webhook and forwarded to the backend. The backend checks the CPU requests of each container of the deployment. To approve the deployment request, the requested CPU values should be less than the threshold value which is given from the environment value of the webhook container.

env:
- name: cpu
  value: "2"

Threshold value can be given as core or milicores.

env:
- name: cpu
  value: "2500m"

Namespaces where our control logic is intended to be executed can be manipulated from the configmap.

data:
  properties.yaml: |
    default
    devteam

About

This is a Kubernetes validating webhook written in Python using Flask.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.9%
  • Dockerfile 10.1%