k8s-sizing-webhook

module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: Apache-2.0

README

k8s-sizing-webhook

codecov

A production ready Kubernetes admission webhook making sure resources are sized correctly using Kubewebhook.

The webhook is based on the production ready Kubewebhook example and comes with:

  • Clean and decouple structure.
  • Metrics.
  • Gracefull shutdown.
  • Testing webhooks.
  • Serve multiple webhooks on the same application.

Structure

The application is mainly structured in 3 parts:

  • main: This is where everything is created, wired, configured and set up, cmd/k8s-sizing-webhook.
  • http: This is the package that configures the HTTP server, wires the routes and the webhook handlers. internal/http/webhook.
  • Application services: These services have the domain logic of the validators and mutators:
    • mutation/mem: Logic for memfix.bitteeinbit.dev webhook.
    • mutation/cpu: Logic for remove-cpu-limit.bitteeinbit.dev webhook. (TODO)

You can use the example YAML deploy folder to deploy it.

Webhooks

memfix.bitteeinbit.dev
  • Webhook type: Mutating.
  • Resources affected: deployments, daemonsets, cronjobs, jobs, statefulsets, pods

This webhooks makes the memory guaranteed. This way OOM can be reduced because memory balloning is avoided.

  • If both requests and limits are provided, the limit is also used for requests.
  • If only requests is set, then limit is set to requests' value.
  • If no value is provided, then the resource is left alone.

Directories

Path Synopsis
cmd
internal
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL