diff --git a/doc/user-guide.md b/doc/user-guide.md index b2983ee76c5..42503c808a7 100644 --- a/doc/user-guide.md +++ b/doc/user-guide.md @@ -106,6 +106,29 @@ After modifying the `*_types.go` file always run the following command to update $ operator-sdk generate k8s ``` +### OpenAPI validation +To update the OpenAPI validation section in the CRD `deploy/crds/cache_v1alpha1_memcached_crd.yaml`, run the following command. + +```console +$ operator-sdk generate openapi +``` +This validation section allows Kubernetes to validate the properties in a Memcached Custom Resource when it is created or updated. An example of the generated YAML is as follows: + +```YAML +spec: + validation: + openAPIV3Schema: + properties: + spec: + properties: + size: + format: int32 + type: integer +``` + +To learn more about OpenAPI v3.0 validation schemas in Custom Resource Definitions, refer to the [Kubernetes Documentation][doc_validation_schema]. + + ## Add a new Controller Add a new [Controller][controller-go-doc] to the project that will watch and reconcile the Memcached resource: @@ -619,3 +642,4 @@ When the operator is not running in a cluster, the Manager will return an error [result_go_doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Result [metrics_doc]: ./user/metrics/README.md [quay_link]: https://quay.io +[doc_validation_schema]: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#specifying-a-structural-schema