kubebuilder | Kubebuilder - SDK for building Kubernetes APIs using CRDs | REST library

 by   kubernetes-sigs Go Version: v3.10.0 License: Apache-2.0

kandi X-RAY | kubebuilder Summary

kandi X-RAY | kubebuilder Summary

kubebuilder is a Go library typically used in Web Services, REST, Framework applications. kubebuilder has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Kubebuilder is a framework for building Kubernetes APIs using custom resource definitions (CRDs). Similar to web development frameworks such as Ruby on Rails and SpringBoot, Kubebuilder increases velocity and reduces the complexity managed by developers for rapidly building and publishing Kubernetes APIs in Go. It builds on top of the canonical techniques used to build the core Kubernetes APIs to provide simple abstractions that reduce boilerplate and toil. Note: kubebuilder does not exist as an example to copy-paste, but instead provides powerful libraries and tools to simplify building and publishing Kubernetes APIs from scratch. Kubebuilder is developed on top of the controller-runtime and controller-tools libraries.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              kubebuilder has a medium active ecosystem.
              It has 6573 star(s) with 1280 fork(s). There are 90 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 61 open issues and 1264 have been closed. On average issues are closed in 78 days. There are 16 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of kubebuilder is v3.10.0

            kandi-Quality Quality

              kubebuilder has 0 bugs and 0 code smells.

            kandi-Security Security

              kubebuilder has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              kubebuilder code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              kubebuilder is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              kubebuilder releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.
              It has 28056 lines of code, 1296 functions and 453 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kubebuilder
            Get all kandi verified functions for this library.

            kubebuilder Key Features

            No Key Features are available at this moment for kubebuilder.

            kubebuilder Examples and Code Snippets

            No Code Snippets are available at this moment for kubebuilder.

            Community Discussions

            QUESTION

            Getting "rpc error: code = Unavailable desc = error reading from server: EOF" when trying to create a new etcdv3 client
            Asked 2022-Mar-21 at 08:25

            I'm trying to access my ETCD database from a K8s controller, but getting rpc error/EOF when trying to open ETCD client.

            My setup:

            • ETCD service is deployed in my K8s cluster and included in my Istio service mesh (its DNS record: my-etcd-cluster.my-etcd-namespace.svc.cluster.local)
            • I have a custom K8s controller developed with use of Kubebuilder framework and deployed in the same cluster, different namespace, but configured to be a part of the same Istio service mesh
            • I'm trying to connect to ETCD database from the controller, using Go client SDK library for ETCD

            Here's my affected Go code:

            ...

            ANSWER

            Answered 2022-Mar-21 at 08:25

            Turned out to be version mismatch - my ETCD db is v3.5.2 and the clientv3 library that I used was v3.5.0. As seen in ETCD changelog (https://github.com/etcd-io/etcd/blob/main/CHANGELOG/CHANGELOG-3.5.md):

            Source https://stackoverflow.com/questions/71509351

            QUESTION

            Is it possible to update the log level of a zap logger at runtime?
            Asked 2022-Mar-17 at 18:11

            I created a logger with kubebuilder, it is based on zap logger:

            ...

            ANSWER

            Answered 2022-Mar-17 at 18:11

            Better answer: as suggested by @Oliver Dain, use zap.AtomicLevel. See their answer for details.

            Another option is to create a core with a custom LevelEnabler function. You can use zap.LevelEnablerFunc to convert a closure to a zapcore.LevelEnabler.

            The relevant docs:

            LevelEnabler decides whether a given logging level is enabled when logging a message.

            LevelEnablerFunc is a convenient way to implement zapcore.LevelEnabler with an anonymous function.

            That function may then return true or false based on some other variable that changes at runtime:

            Source https://stackoverflow.com/questions/69738222

            QUESTION

            How to trigger a rollout restart on deployment resource from controller-runtime
            Asked 2022-Feb-10 at 17:01

            I have been using kubebuilder for writing custom controller, and aware of Get(), Update(), Delete() methods that it provides. But Now I am looking for a method which mimic the behaviour of kubectl rollout restart deployment. If there is no such direct method then I am looking for correct way to mimic the same.

            ...

            ANSWER

            Answered 2022-Feb-10 at 17:01

            In all cases where you wish to replicate kubectl behavior, the answer is always to increase its verbosity and it'll show you exactly -- sometimes down to the wire payloads -- what it is doing.

            For rollout restart, one will find that it just bumps an annotation on the Deployment/StatefulSet/whatever and that causes the outer object to be "different," and triggering a reconciliation run

            You can squat on their annotation, or you can make up your own, or you can use a label change -- practically any "meaningless" change will do

            Source https://stackoverflow.com/questions/71066578

            QUESTION

            How to add RBAC roles to a Controller for a different kind of resource in Kubebuilder
            Asked 2022-Jan-12 at 10:39

            I am creating a new Operator with Kubebuilder to deploy a Kubernetes controller to manage a new CRD Custom Resource Definition.

            This new CRD (let's say is called MyNewResource), needs to list/create/delete CronJobs.

            So in the Controller Go code where the Reconcile(...) method is defined I added a new RBAC comment to allow the reconciliation to work on CronJobs (see here):

            ...

            ANSWER

            Answered 2022-Jan-12 at 09:40

            You need to create new Role or ClusterRole (depending if you want your permissions to be namespaced or cluster-wide) and bind that to your system:serviceaccount:myrepo-system:myrepo-controller-manager user using RoleBinding/ClusterRoleBinding. I will provide examples for cluster-wide configuration.

            ClusterRole:

            Source https://stackoverflow.com/questions/70664728

            QUESTION

            How to print Status fields defined in Kubebuilder to show up when using Kubectl
            Asked 2022-Jan-08 at 13:07

            How do I have to specify the comments like +kubebuilder:printcolumn to add columns to the output of the command kubectl get my-crd.my-group.my-domain.com?

            I've a CRD (Custom Resource Definition) with the usual structs for the specs and the status (similar to what's explained in the Kubebuilder tutorial here https://book.kubebuilder.io/cronjob-tutorial/new-api.html#adding-a-new-api).

            I've a Status struct like this:

            ...

            ANSWER

            Answered 2022-Jan-08 at 13:07

            The solution was to add the code to update the resource status in the reconciler method of the controller - Reconcile(ctx context.Context, req ctrl.Request), like this:

            Source https://stackoverflow.com/questions/70517823

            QUESTION

            why does controller-runtime say resource 'not found' while updating resource that exists?
            Asked 2021-Dec-27 at 23:55

            I have written a k8s controller with kubebuilder which reconciles my CustomResource object (MyResource).

            During update, controller-runtime gives me an error 'not found' even though my resource exists on the cluster.

            ...

            ANSWER

            Answered 2021-Dec-27 at 23:55

            I was able to resolve this issue myself using:

            r.Update(ctx, myResource) instead of r.Status().Update(ctx, myResource)

            Source https://stackoverflow.com/questions/70501227

            QUESTION

            PersistemVolumeClaim Metadata can not be decoded correctly
            Asked 2021-Dec-27 at 09:50

            Environment

            Kubectl Version

            ...

            ANSWER

            Answered 2021-Dec-27 at 02:53

            see kubebuilder issue#2460, use the controller-gen option crd:generateEmbeddedObjectMeta=true will work

            Source https://stackoverflow.com/questions/70485009

            QUESTION

            How do you deploy GitLab Operator to a AWS EKS cluster?
            Asked 2021-Nov-02 at 20:51

            My goal is do deploy a self-hosted instance of GitLab on EKS. I have read through the guide on the GitLab docs and am attempting the operator install method. I setup my cluster using eksctl v0.61.0 and three t4g.large instances. The cluster comes up and seems healthy.

            ...

            ANSWER

            Answered 2021-Nov-02 at 20:51

            After investigating a little more, I found that running logs on the container yielded standard_init_linux.go:228: exec user process caused: exec format error I opened an issue with the GitLab Operator project and they advised that GitLab Operator must be run on x64_86 architecture. The T4g series is AArch64/arm64. I switched to t2.xlarge and was able to bring up the operator.

            Source https://stackoverflow.com/questions/69761627

            QUESTION

            Is there a tool to generate customer resouce object from a Custom resource definition?
            Asked 2021-Sep-27 at 10:51

            I have a complex kubernetes customer resource definition. I want to generate a valid custom resource object from the definition and then replace some values with mine. This is for quick testing purposes.

            Instead of creating a yaml file from scratch, I'd like to use a tool to automatically generate it. Like what kubebuilder does when creating an API (put sample objects under config/samples).

            Question: Is there any existing tool for this purpose?

            ...

            ANSWER

            Answered 2021-Sep-27 at 10:51

            Generally, for generating custom Kubernetes objects based on template there are two solutions:

            Both of them have a good documentations with examples - you can find them here for Kustomize and here for Helm.

            For better understanding what exactly are they used for and what are differences between them I suggest reading this article and this StackOverFlow answer.

            Source https://stackoverflow.com/questions/69341723

            QUESTION

            Kubebuilder: resource deletion not having expected side effects
            Asked 2021-Aug-02 at 16:42

            I'm creating a custom resource definition (CRD) with an associated controller using kubebuilder. My controller reconcile loop creates a deployment sub-resource and parents it to the custom resource using controllerutil.SetControllerReference(&myResource, deployment, r.Scheme). I've also configured my reconciler so "own" the sub-resource, as follows:

            ...

            ANSWER

            Answered 2021-Aug-02 at 16:42

            Using @coderanger's hint, I could see that the metadata.ownerReferences weren't being set correctly when running the following command:

            Source https://stackoverflow.com/questions/68606307

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install kubebuilder

            It is strongly recommended that you use a released version. Release binaries are available on the releases page. Follow the instructions to install Kubebuilder.
            See the Getting Started documentation.

            Support

            Check out the Kubebuilder book.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/kubernetes-sigs/kubebuilder.git

          • CLI

            gh repo clone kubernetes-sigs/kubebuilder

          • sshUrl

            git@github.com:kubernetes-sigs/kubebuilder.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular REST Libraries

            public-apis

            by public-apis

            json-server

            by typicode

            iptv

            by iptv-org

            fastapi

            by tiangolo

            beego

            by beego

            Try Top Libraries by kubernetes-sigs

            kind

            by kubernetes-sigsGo

            kustomize

            by kubernetes-sigsGo

            external-dns

            by kubernetes-sigsGo

            krew

            by kubernetes-sigsGo

            metrics-server

            by kubernetes-sigsGo