-
Notifications
You must be signed in to change notification settings - Fork 126
Add CRD versioning developer doc #2404
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
14c944b
Add CRD versioning developer doc
sjberman 664d536
Address code review
sjberman cee5790
Suggestions
sjberman 32a5ada
Merge branch 'main' into docs/crd-versioning
sjberman e9accc3
Merge branch 'main' into docs/crd-versioning
sjberman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# CRD Versioning | ||
|
||
This document discusses how we version our CustomResourceDefinitions (CRDs) that define Policies, Filters, or other configuration objects. NGINX Gateway Fabric distributes a few CRDs, such as NginxGateway, NginxProxy, ClientSettingsPolicy, and ObservabilityPolicy. More will inevitably be added over time. | ||
|
||
## Initial Version | ||
|
||
When creating a new CRD, the initial version should be `v1alpha1`. This version indicates a new API that needs time for use and feedback. By starting at the alpha version, it also allows us a little more flexibility in changing the API. | ||
|
||
## Changing an API | ||
|
||
When changing an API in a CRD, it's important to understand the impact of those changes. This will determine if and how we need to update the API version. | ||
|
||
**No change in version required** | ||
|
||
- Adding new optional fields. | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Documentation updates. | ||
|
||
**Compatible changes, requires a version change** | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- When making schema changes (in other words, renaming or changing the structure of an existing field), a change of version is required (`v1alpha` to `v1alpha2`) and a [conversion webhook](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion) is utilized to preserve compatibility for a user and allow our controller to support both versions. | ||
- As part of this, the old API version should be marked as deprecated, and then removed after 3 releases. | ||
- The new API should not be marked as the preferred or `stored` version until old API is removed. | ||
- To reduce complexity, we should only support a maximum of 2 API versions at the same time. | ||
|
||
For more in depth information on compatible changes, see the Kubernetes [API changes doc](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#on-compatibility). | ||
|
||
**Breaking changes, requires a version change** | ||
|
||
The following API changes are incompatible with previous API versions, and therefore not only require a version bump, but cannot use a conversion webhook. These types of changes should be avoided if at all possible due to the disruption for users. A user will need to update their configurations when upgrading NGF. These types of changes need clear messaging in release notes and docs. | ||
|
||
We'll allow a bit more flexibility for this case when dealing with alpha APIs. | ||
|
||
- Adding new required fields. | ||
- Removing fields. If possible, we should try to deprecate fields for 3 releases to slowly phase them out before removing. | ||
- Changing validation and allowed values of a field. | ||
|
||
For more in depth information on how to handle API changes, see the Kubernetes [API changes doc](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#backward-compatibility-gotchas). | ||
|
||
|
||
The NGINX Gateway Fabric version should not need to change when CRD versions change. CRDs are not embedded into NGF; they have their own versions. | ||
|
||
NGINX Gateway Fabric releases are directly tied to the CRD version they support and users are required to upgrade CRD versions when upgrading NGF. This ensures that the CRDs remain compatible with NGINX Gateway Fabric. | ||
|
||
However, the user may need to fix any incompatible CRDs. | ||
|
||
## Graduating to v1 (stable) | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
An alpha API allows us more flexibility in making breaking API changes as we further design and craft the API to fit the necessary use cases. However, at some point these APIs need to become stable and no longer have breaking changes, so that a user can rely on them without the worry of things not working from release to release. | ||
|
||
When we've determined that an API is stable and should no longer have breaking changes or refactors, we can promote it to `v1`. Once promoted, this API **should not** be subject to changes that require a version bump. Only when absolutely necessary should we consider changes that would lead to a `v2alpha1` or `v2` version. | ||
|
||
We are skipping the usual alpha -> beta -> v1 graduation for a couple of reasons. | ||
|
||
1. It matches the pattern of Gateway API graduation. | ||
2. Our APIs are likely going to be simple enough that we don't need to go through 3 stages of graduation. There is overhead in this that is probably not necessary for our project. | ||
|
||
Since we are still early in the API development process for NGF, a specific timeframe for this is not yet determined. We need to get user feedback to determine if the APIs are being utilized and if any issues arise. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.