README ¶
Sample Project
Sample project is a project that created by kubebuilder and moved into samples
folder. It contains resources and controllers. The main purpose of sample projects is to test and validate the behavior of kubebuilder. Specifically, the new built kubebuilder commands don't break existing projects created by older version of kubebuilder commands.
Current Sample Projects
- memcached-api-apiserver
- validations
Test Sample Project
Run following command to test a sample project such as memcached-api-apiserver
go test -v ./samples/memcached-api-apiserver
Add Sample Project
We can test different aspects of kubebuilder in different sample projects. For example, we can test and validate how kubebuilder handles validation annotations in one sample project and validate how kubebuilder handles rbac rules in a different sample project. Here are steps to add a new project.
- Create a new subdirectory under samples to hold the new sample project and change directory to it
- run
kubebuilder init
to init a project - run
kubebuilder create resource
to create resources you want to add - Update the resource or controller files for your test purpose. For example, add validation annotations in resource file.
- Create the expected files under
test
. For example, memcached-api-server has an expected filetest/hack/install.yaml
, which is used to compare with the output ofkubebuilder create config
. - Write
<project>_test.go
file to test the new sample project similar to memcached_test.go.
Directories ¶
Path | Synopsis |
---|---|
memcached-api-server
|
|
pkg/apis/myapps
Package api is the internal version of the API.
|
Package api is the internal version of the API. |
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 |
pkg/client/clientset/versioned
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
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. |
pkg/client/clientset/versioned/typed/myapps/v1alpha1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
pkg/client/clientset/versioned/typed/myapps/v1alpha1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
validations
|
|
pkg/apis/apps
Package api is the internal version of the API.
|
Package api is the internal version of the API. |
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 |
pkg/client/clientset/versioned
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
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. |
pkg/client/clientset/versioned/typed/apps/v1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
pkg/client/clientset/versioned/typed/apps/v1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |