kubebuilder/quickstart: remove link header and add doc for enabling status subresource
----
-title: Golang Based Operator Quickstart
-linkTitle: Quickstart
-weight: 1
----
**NOTE:** This is a WIP doc for the Kubebuilder integration effort. This new CLI and workflow is currently alpha and there may be breaking changes.
Please refer to the [quickstart guide][legacy_quickstart_doc] for the default CLI and workflow.
@@ -109,6 +104,20 @@ type MemcachedStatus struct {
}
```
+Add the `+kubebuilder:subresource:status` [marker][status_marker] to add a [status subresource][status_subresource] to the CRD manifest so that the controller can update the CR status without changing the rest of the CR object:
+
+```Go
+// Memcached is the Schema for the memcacheds API
+// +kubebuilder:subresource:status
+type Memcached struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec MemcachedSpec `json:"spec,omitempty"`
+ Status MemcachedStatus `json:"status,omitempty"`
+}
+```
+
After modifying the `*_types.go` file always run the following command to update the generated code for that resource type:
```sh
@@ -455,3 +464,5 @@ See the [advanced topics][advanced_topics] doc for more use cases and under the
[legacy_quickstart_doc]: /docs/golang/quickstart/
[activate_modules]: https://github.com/golang/go/wiki/Modules#how-to-install-and-activate-module-support
[advanced_topics]: /docs/kubebuilder/advanced-topics/
+[status_marker]: https://book.kubebuilder.io/reference/generating-crd.html#status
+[status_subresource]: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#status-subresource
\ No newline at end of file
