controller-tools
controller-tools copied to clipboard
Tools to use with the controller-runtime libraries
### Problem statement Currently, kubebuilder supports `rule` and `message` fields when specifying `+kubebuilder:validation:XValidation`. [Kubernetes 1.25 introduced CRD validation rules](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#validation-rules) (beta0 which also allow specifying [`messageExpression`](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). The following is now possible...
Recently I stumble upon a situation when running controller gen had no effect ``` controller-gen crd:headerFile="hack/boilerplate.go.txt",year=2024 paths="./pkg/api/..." output:dir="." ``` for the `crd` gen, but worked fine for `object` gen ```...
def: ``` type GuestbookSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file // DeploymentSpec use...
I'm using kubebuilder which generates webhooks with [these markers](https://book.kubebuilder.io/reference/markers/webhook.html). The generated mutating webhook has a hardcoded name of `mutating-webhook-configuration` [here](https://github.com/kubernetes-sigs/controller-tools/blob/881ffb4682cb5882f5764aca5a56fe9865bc9ed6/pkg/webhook/parser.go#L422), and the validating webhook has a hardcoded name of `validating-webhook-configuration`...
When building tooling that looks at CRDs or works with k8s yaml, understanding the types that are are being used is helpful for custom validations, rewrites, generation, and other rules....
Error loading module dependency packages while running manifests command with controller-gen v0.12.0
Golang version: 1.20.6 CONTROLLER_TOOLS_VERSION ?= v0.12.0 ``` Error /workspace/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases Error: load packages in root "/workspace/.bob/gopath/pkg/mod/gopkg.in/[email protected]": err: exit status 1: stderr: go: gopkg.in/[email protected]: missing go.sum entry...
Currently, it is only possible to generate a webhook manifest for a service running inside the cluster. However, I think it should also be possible to generate manifests for webhook...
controller-gen crd:trivialVersions=true,preserveUnknownFields=false,crdVersions=v1 rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=../config/crd/bases ;\ controller-gen crd:trivialVersions=true,preserveUnknownFields=false,crdVersions=v1 rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=../helm/chaos-mesh/crds ;  if use make generate in root path of chaos-mesh,this happened: 
Looking for suggestions. I am generating Kubernetes CRD (Custom Resource Definition) using kubebuilder. Along with CRD, I also need **to document** the REST endpoints by creating **OpenAPI v3 Spec (OAS)**...
Running the controller-gen works when using wildcards: ``` ./bin/controller-gen crd paths="./pkg/apis/foo/v1alpha1/..." output:stdout ``` but fails when running on a specific file: ``` ./bin/controller-gen crd paths="./pkg/apis/foo/v1alpha1/bar_types.go" output:stdout ``` with output: ```...