directory
Version:
v0.9.1
Opens a new window with list of versions in this module.
Published: Jun 21, 2021
License: Apache-2.0
Opens a new window with license information.
README
¶
Examples
These two examples represent the usage of controller-runtime
libraries for built-in Kubernetes resources as well as custom resources.
builtins/
This example implements a custom controller and webhooks for the existing ReplicaSet resource.
controller.go
: implements a reconciler for ReplicaSets
mutatingwebhook.go
: implements a mutating webhook that adds an annotation to every incoming Pod ("example-mutating-admission-webhook" = "foo")
validatingwebhook.go
: implements a validating webhook that checks to see if a Pod has the aforementioned annotation
main.go
- Creates a new manager
- Creates a new controller that watches both ReplicaSets and Pods and reconciles the objects with the implemented reconciler
- Registers the mutating and validating webhooks with the manager
- Starts the manager
crd/
This example implements a new Kubernetes resource, ChaosPod, and creates a custom controller that watches it and webhooks that mutate and validate.
pkg/
resource.go
: defines the schema for the ChaosPod API and implements validate and mutate webhooks
groupversion_info.go
: specifies the Group and Version for the ChaosPod API
zz_generated.deepcopy.go
: deep copy functions generated by kubebuilder
main.go
- Creates a new manager
- Adds ChaosPod resource to the manager's schema
- Implements a reconciler to execute the desired behavior of the ChaosPod API
- Creates a new controller that watches ChaosPods and reconciles the objects with the implemented reconciler
- Adds ChaosPod webhooks to manager
- Starts the manager
Deploying and Running
To install and run the provided examples, see the Kubebuilder Quick Start.
Directories
¶
|
|
configfile
|
|
|
|
|
|
custom/v1alpha1
Package v1alpha1 provides the CustomControllerManagerConfiguration used for demoing componentconfig +kubebuilder:object:generate=true
|
Package v1alpha1 provides the CustomControllerManagerConfiguration used for demoing componentconfig +kubebuilder:object:generate=true |
|
|
pkg
+kubebuilder:object:generate=true +groupName=chaosapps.metamagical.io
|
+kubebuilder:object:generate=true +groupName=chaosapps.metamagical.io |
|
|
|
|
Click to show internal directories.
Click to hide internal directories.