node-label-controller

command module
v0.0.0-...-f24ce87 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

README

node-label-controller

This repository implements a simple controller for watching Node resources and sets the kubermatic.io/uses-container-linux label to true if the node is operating Container Linux.

This controller was build using the sample controller at its source. This allowed me to learn about the internals of the kubernetes API and how to build controller from scratch

Details

The node-label-controller uses client-go library extensively.

Running

# assumes you have a working kubeconfig, not required if operating in-cluster
cd node-label-controller
go build -o node-label-controller .
./node-label-controller -kubeconfig=$HOME/.kube/config

# Deploy the operator in its namespace with rbac
kubectl apply -f config/deploy/rbac
kubectl apply -f config/deploy

# check nodes operating container linux were updated
kubectl get nodes

Cleanup

You can clean up the created controller with:

kubectl delete -f config/deploy

Ideas for the future

  • Try to implement it using kubebuilder, kudos or operator sdk
  • Add label to other nodes for different oses
  • Unit test it

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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