GithubHelp home page GithubHelp logo

k8s-pod-labeler's Introduction

K8s pod labeler

This repo implelents a MutatingAdmissionWebhook that can add missing labels and annotations to pods. The webhook only adds the given label or mutation if it is not already present on the pod definition.

TODO:

  • add unit tests!
  • support external cert generation like cert-manager

Configuration

Configure the desired labels/annotations for your pods by setting the appInputs.labels and appInputs.annotations values.

appInputs:
  labels:
    "foo": "bar"
  annotations:
    "bar": "baz"

By default, this uses namespace selectors to enable the labeler in a given namespace by adding a namespace label troop.com/k8s-pod-labeler: enabled.

For all configurable settings, see the values.yaml file.

Deployment

Helm install...

# this enables pulling helm charts from github packages
export HELM_EXPERIMENTAL_OCI=1
# test your local config at local-values.yml
helm template \
  -f ./local-values.yml \
  --version 0.3.6 \
  oci://ghcr.io/troop-dev/helm/k8s-pod-labeler
# install helm from a local-values.yml config
helm install \
  -f ./local-values.yml \
  pod-labeler \
  --version 0.3.6 \
  oci://ghcr.io/troop-dev/helm/k8s-pod-labeler

Local Dev

This repo uses Earthly to build the golang application.

# install earthly on osx with homebrew
brew install earthly/earthly/earthly && earthly bootstrap
# build the docker image
earthly +build

Motivation

Troop uses the Linkerd service mesh in GKE, which requires a special annotation to inform the cluster autoscaler that it can evict pods despite them having a local volume.

Resources

k8s-pod-labeler's People

Contributors

zenyui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.