# README
opslevel-k8s-controller
A utility library for easily making and running k8s controllers
Installation
go get github.com/opslevel/opslevel-k8s-controller/v2023
Then to create a k8s controller you can simply do
selector := opslevel_k8s_controller.K8SSelector{
ApiVersion: "apps/v1",
Kind: "Deployment",
Excludes: []string{`.metadata.namespace == "kube-system"`}
}
resync := time.Hour*24
batch := 500
runOnce := false
controller, err := opslevel_k8s_controller.NewK8SController(selector, resync, batch, runOnce)
if err != nil {
//... Handle error ...
}
callback := func(items []interface{}) {
for _, item := range items {
// ... Process K8S Resource ...
}
}
controller.OnAdd = callback
controller.OnUpdate = callback
controller.Start()
Because of the way the selector works you can easily target any k8s resource in your cluster and you have the power of JQ to exclude resources that might match the expression.
# Functions
NewK8SClient This creates a wrapper which gives you an initialized and connected kubernetes client It then has a number of helper functions.
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author