kubebuilder

module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: Apache-2.0

README

Build Status Go Report Card

Kubebuilder

Kubebuilder is a framework for building Kubernetes APIs using custom resource definitions (CRDs).

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.

Installalation

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

Getting Started

See the Getting Started documentation.

Quick Start

Documentation

Check out the Kubebuilder book.

Resources

Motivation

Building Kubernetes tools and APIs involves making a lot of decisions and writing a lot of boilerplate.

In order to facilitate easily building Kubernetes APIs and tools using the canonical approach, this framework provides a collection of Kubernetes development tools to minimize toil.

Kubebuilder attempts to facilitate the following developer workflow for building APIs

  1. Create a new project directory
  2. Create one or more resource APIs as CRDs and then add fields to the resources
  3. Implement reconcile loops in controllers and watch additional resources
  4. Test by running against a cluster (self-installs CRDs and starts controllers automatically)
  5. Update bootstrapped integration tests to test new fields and business logic
  6. Build and publish a container from the provided Dockerfile

Scope

Building APIs using CRDs, Controllers and Admission Webhooks.

Philosophy

Provide clean library abstractions with clear and well exampled godocs.

  • Prefer using go interfaces and libraries over relying on code generation
  • Prefer using code generation over 1 time init of stubs
  • Prefer 1 time init of stubs over forked and modified boilerplate
  • Never fork and modify boilerplate

Techniques

  • Provide higher level libraries on top of low level client libraries
    • Protect developers from breaking changes in low level libraries
    • Start minimal and provide progressive discovery of functionality
    • Provide sane defaults and allow users to override when they exist
  • Provide code generators to maintain common boilerplate that can't be addressed by interfaces
    • Driven off of //+ comments
  • Provide bootstrapping commands to initialize new packages

Troubleshooting

  • Bugs and Feature Requests:

    If you have what looks like a bug, or you would like to make a feature request, please use the Github issue tracking system. Before you file an issue, please search existing issues to see if your issue is already covered.

  • Slack

    For realtime discussion, you can join the #kubebuilder slack channel. Slack requires registration, but the Kubernetes team is open invitation to anyone to register here. Feel free to come and ask any questions.

Contributing

Contributions are greatly appreciated. The maintainers actively manage the issues list, and try to highlight issues suitable for newcomers. The project follows the typical GitHub pull request model. See CONTRIBUTING.md for more details. Before starting any work, please either comment on an existing issue, or file a new one.

Directories

Path Synopsis
cmd
pkg
config
The config package contains libraries for initializing rest configs for talking to the Kubernetes API
The config package contains libraries for initializing rest configs for talking to the Kubernetes API
controller
The controller package provides libraries for creating controllers.
The controller package provides libraries for creating controllers.
controller/eventhandlers
The handlefunctions defines mapping and event handling functions for controllers
The handlefunctions defines mapping and event handling functions for controllers
controller/informers
The informers defines a registry for sharing informers
The informers defines a registry for sharing informers
controller/metrics
The metrics package defines controller runtime metrics
The metrics package defines controller runtime metrics
controller/test
The test package contains fake informers for testing controllers
The test package contains fake informers for testing controllers
controller/types
The types package declares types used by the controller package
The types package declares types used by the controller package
gen/apis
The apis package describes the comment directives that may be applied to apis / resources
The apis package describes the comment directives that may be applied to apis / resources
gen/controller
The controller package describes comment directives that may be applied to controllers
The controller package describes comment directives that may be applied to controllers
imports
Package imports ensures that when "dep ensure" is run after creating a new kubebuilder project, it will fetch all of the dependencies needed for the project.
Package imports ensures that when "dep ensure" is run after creating a new kubebuilder project, it will fetch all of the dependencies needed for the project.
inject/args
The args package contains arguments for running controllers and admission webhooks
The args package contains arguments for running controllers and admission webhooks
inject/run
The run package contains initialization dependencies for creating controllers and admission webhooks
The run package contains initialization dependencies for creating controllers and admission webhooks
install
The install package contains strategies for installing controllers and admission webhooks into Kubernetes clusters.
The install package contains strategies for installing controllers and admission webhooks into Kubernetes clusters.
internal/admission
The admission package provides libraries for creating admission webhooks.
The admission package provides libraries for creating admission webhooks.
signals
The signals package contains libraries for handling signals to shutdown the system.
The signals package contains libraries for handling signals to shutdown the system.
test
The test package provides libaries for integration testing by starting a local control plane
The test package provides libaries for integration testing by starting a local control plane
samples
controller/pkg/apis/samplecontroller/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
controller/pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
controller/pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
controller/pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
controller/pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
controller/pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
full/controller/src/samplecontroller/pkg/apis/samplecontroller
Package api is the internal version of the API.
Package api is the internal version of the API.
full/controller/src/samplecontroller/pkg/apis/samplecontroller/v1alpha1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=samplecontroller/pkg/apis/samplecontroller +k8s:defaulter-gen=TypeMeta +groupName=samplecontroller.k8s.io
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=samplecontroller/pkg/apis/samplecontroller +k8s:defaulter-gen=TypeMeta +groupName=samplecontroller.k8s.io
test
e2e
The signals package contains e2e tests for kubebuilder
The signals package contains e2e tests for kubebuilder
e2e/framework/ginkgowrapper
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
projects/memcached-api-server/pkg/apis/myapps
Package api is the internal version of the API.
Package api is the internal version of the API.
projects/memcached-api-server/pkg/apis/myapps/v1alpha1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubernetes-sigs/kubebuilder/test/projects/memcached-api-server/pkg/apis/myapps +k8s:defaulter-gen=TypeMeta +groupName=myapps.memcached.example.com
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubernetes-sigs/kubebuilder/test/projects/memcached-api-server/pkg/apis/myapps +k8s:defaulter-gen=TypeMeta +groupName=myapps.memcached.example.com
projects/memcached-api-server/pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
projects/memcached-api-server/pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
projects/memcached-api-server/pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
projects/memcached-api-server/pkg/client/clientset/versioned/typed/myapps/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
Package fake has the automatically generated clients.
projects/validations/pkg/apis/apps
Package api is the internal version of the API.
Package api is the internal version of the API.
projects/validations/pkg/apis/apps/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubernetes-sigs/kubebuilder/test/projects/validations/pkg/apis/apps +k8s:defaulter-gen=TypeMeta +groupName=apps.validation.com
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubernetes-sigs/kubebuilder/test/projects/validations/pkg/apis/apps +k8s:defaulter-gen=TypeMeta +groupName=apps.validation.com
projects/validations/pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
projects/validations/pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
projects/validations/pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
projects/validations/pkg/client/clientset/versioned/typed/apps/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
projects/validations/pkg/client/clientset/versioned/typed/apps/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL