Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add XValidations in the generated documentation #214

Merged
merged 1 commit into from
Mar 14, 2023

Commits on Mar 14, 2023

  1. feat: Add XValidations in the generated documentation

    With Kubernetes 1.25, CEL will be added, as an alternative to enforcing
    validations, rather than webhooks. This allows, among other things,
    the ability to enforce immutability on fields.
    
    Since this is documented in the CRD YAML itself, bubbling this up
    into the documentation allows one to see custom validation rules
    
    An example kubebuilder comment in Go would be:
    
    ```
    // +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Value is immutable"
    ```
    
    This would result in the following in the CRD:
    
    ```
    x-kubernetes-validations:
    - message: Value is immutable
      rule: self == oldSelf
    ```
    
    And now the generated documentation will reflect this:
    
    ```
    <i>Validations</i>:<li>self == oldSelf: Value is immutable</li>
    ```
    
    Signed-off-by: Trynity Mirell <trynity@mirell.org>
    trynity authored and roytman committed Mar 14, 2023
    Configuration menu
    Copy the full SHA
    64ff660 View commit details
    Browse the repository at this point in the history