Questions tagged [kubebuilder]

Kubebuilder is a toolkit for building Kubernetes controllers in Go. Use this tag for questions about building custom Kubernetes controllers or operators using the Kubebuilder framework.

Kubebuilder is a toolkit for building Kubernetes controllers in . It provides several of the required parts of a controller, including a core event loop that can monitor changes to Kubernetes resources, freeing you to write only the object-reconciliation code.

In addition to the material in The Kubebuilder Book it will be helpful to understand core concepts, especially The Kubernetes API and the API reference documentation.

Questions about building custom controllers or operators using Kubebuilder should have the tag. These questions will also frequently be related to and . An operator frequently builds as well.

79 questions
0
votes
0 answers

k8s CRD embed k8s native type

using Operator-SDK to develop K8s operator. Requirement is to listen to CR and perform actions like create secrets and configmaps then update the workload(Deployment/DaemonSet/StatefulSet) by mounting the secret and configmaps. Until CR is…
TheCoder
  • 49
  • 1
  • 8
0
votes
1 answer

Restart pods/deployments from Kubernetes controller/operator

we have kubernetes deployment controller build using kubebuilder. in controller we are updating ConfigMap in controller and then want all pods backed by deployment to restart so latest ConfigMap will be reloaded. How can I trigger this…
0
votes
1 answer

Setting status conditions for controller-runtime's client Get errors

Under which conditions will client.Client return a non-nil error and the client object will be also filled (or at least the namespace and name object meta)? The Kubernetes operator framework book suggests to set a status condition in case of getting…
Kubus
  • 677
  • 6
  • 18
0
votes
1 answer

Method re-use in go code using controller-runtime

I need help with method re-usage in Go. I have two function signatures in my Kubernetes operator (in different controllers): func myFunc(ctx context.Context, r *MyKindReconciler, myKind *myApiVersion.myKind) (ctrl.Result, error) { and func…
stiller_leser
  • 1,512
  • 1
  • 16
  • 39
0
votes
0 answers

ArgoCD Rollback

I'm trying to implement a controller that on a rollback event in ArgoCD, will implement certain logic. So can I catch all attempts to go to the CRD Application and add my own logic at the time of calling this API:…
Garamoff
  • 84
  • 1
  • 6
0
votes
0 answers

How to use enum of validation in the kubebuilder

+kubebuilder:validation:Enum specifies that this (scalar) field is restricted to the exact values specified here. // +kubebuilder:default:=release // +kubebuilder:validation:Enum=dev;test;rc;release ReleaseState string `json:"ReleaseState" demo
Wangxf
  • 1
  • 3
0
votes
0 answers

Namespaced kubernetes operator for multiple namespaces

I am thinking about using cluster vs namespaced scope k8s operators. In theory i have a lot of namespaces and i can deploy some kubernetes operator KO for each namespace. I suppose that in this case in each namespace KO subscribed for events in…
0
votes
2 answers

create dynamic object in GO operator controller

I am following the below blog which explains how to create operator and import another CR into existing one. http://heidloff.net/article/accessing-third-party-custom-resources-go-operators/ here…
0
votes
0 answers

Kubebuilder Kustomize Shell

Using the Kubebuilder initializer and I don't know to get the Kustomize shell. Whenever I try to install my operator onto minikube I get the error below: go: added sigs.k8s.io/kustomize/kyaml v0.9.4 go: added sigs.k8s.io/structured-merge-diff/v3…
0
votes
1 answer

Kubernetes customized controller for collaborated auto scaling

I am very new to Kubernetes CRD and customized controller. I am trying to implement a customized controller that horizontally scale my CRD instances in a collaborated way. For example, suppose I have 5 CPUs and two Jobs. Each of them has 2 replicas…
0
votes
1 answer

Kubernetes Webhook - Multiple hubs defined for group-kind

Trying to deploy my webhook using operator-sdk I got this error in the logs: conversion check failed {"object": {"metadata":{"creationTimestamp":null},"spec":{},"status":{}}, "error": "multiple(2) hubs defined for group-kind '' "
0
votes
1 answer

Manage immutable fields in Kubebuilder validating webhook

According to Kubebuilder documentation, it is possible to implement immutable fields for a given CRD: We separate out ValidateCreate from ValidateUpdate to allow behavior like making certain fields immutable, so that they can only be set…
Fabrice Jammes
  • 2,275
  • 1
  • 26
  • 39
0
votes
2 answers

PersistemVolumeClaim Metadata can not be decoded correctly

Environment Kubectl Version Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.4", GitCommit:"c96aede7b5205121079932896c4ad89bb93260af", GitTreeState:"clean", BuildDate:"2020-06-18T02:59:13Z", GoVersion:"go1.14.3", Compiler:"gc",…
Huzhenyu
  • 97
  • 2
  • 8
0
votes
1 answer

I want to create a custom controller that extends Cronjob

I'd like to create a custom controller for a Cronjob that doesn't generate jobs in certain situations. Is there any way to easily create a custom controller that works almost exactly like a Cronjob?
tkst7
  • 1
0
votes
2 answers

Controllers creating/watching resources in different namespace than their Custom Resource

I have a controller which Reconciles MyKind Custom Resource in 'foo' namespace. Within the reconcile loop, it creates a deployment MyDeployment in 'bar' namespace. I am wondering how can I setup a watch on the MyDeployment created in 'bar' namespace…