@@ -70,7 +70,7 @@ This will setup the initial structure for your project with:
70
70
71
71
- An empty boilerplate.go.txt (if one doesn't already exist)
72
72
- Base ` vendor/ ` go libraries and Gopkg.toml / Gopkg.lock (extracted from the kubebuilder installation directory)
73
- - Dockerfiles for creating your project's container images
73
+ - Dockerfile for creating your project's container image
74
74
- Optionally: A Bazel workspace and BUILD.bazel
75
75
- use the ` --bazel ` flag to enable this
76
76
@@ -141,30 +141,32 @@ go test ./pkg/...
141
141
142
142
## Build and run an image for your CRD and Controller
143
143
144
- ` Dockerfile ` s for the controller-manager and installer containers were created at the project root.
144
+ `A Dockerfile for the controller-manager was created at the project root.
145
145
The controller-manager Dockerfile will build the controller-manager from source and also run the tests under
146
146
` ./pkg/... ` and ` ./cmd/... ` .
147
147
148
148
``` sh
149
- docker build . -f Dockerfile.install -t < install-image> :< version> && docker push < install-image> :< version>
150
149
docker build . -f Dockerfile.controller -t < controller-image> :< version> && docker push < controller-image> :< version>
151
150
```
152
151
153
- ### Install using the container images
152
+ ### Generate and apply the configuration to install the CRD and run the controller manager
154
153
155
- To install the controller-manager into a cluster using the installer container - create an installer serviceaccount
156
- and run the installer container.
154
+ ``` sh
155
+ OUTPUT_YAML_FILE=hack/install.yaml
156
+ kubebuilder create config --name=< my-project-name> --controller-image=< controller-image> --output=$OUTPUT_YAML_FILE
157
+ ```
158
+
159
+ This generates the YAML config to create the following resources:
160
+
161
+ * Namespace
162
+ * ClusterRole
163
+ * ClusterRoleBinding
164
+ * CustomResourceDefinition
165
+ * Service
166
+ * StatefulSet (or Deployment)
157
167
158
168
``` sh
159
- kubectl create serviceaccount installer
160
- kubectl create clusterrolebinding installer-cluster-admin-binding --clusterrole=cluster-admin \
161
- --serviceaccount=default:installer
162
-
163
- export NAME=my-project-name
164
- export INSTALL_IMAGE=< install-image>
165
- export CONTROLLER_IMAGE=< controller-image>
166
- kubectl run $NAME --serviceaccount=installer --image=$INSTALL_IMAGE --restart=OnFailure -- ./installer \
167
- --controller-image=$CONTROLLER_IMAGE --name=$NAME
169
+ kubectl apply -f $OUTPUT_YAML_FILE
168
170
```
169
171
170
172
## Build docs for your APIs
@@ -180,4 +182,4 @@ kubebuilder create example --group group --version version --kind kind
180
182
kubebuilder docs
181
183
```
182
184
183
- For more information see [ creating reference documentation] ( creating_reference_documentation.md )
185
+ For more information see [ creating reference documentation] ( creating_reference_documentation.md )
0 commit comments