-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add v1alpha2 API version #139
Conversation
ae174aa
to
5ae7ad6
Compare
This adds a v1alpha2 API, without changing the controller or tests to use it (yet). The new API has roughly the desired shape, per fluxcd/flux2#1124, but supporting only things that the controller supports now. It's necessary to give the v1alpha1 type a `storageversion` marker so that 1. code generation keeps working, and 2. tests still work, since they still expect v1alphav1 types. v1alpha1 will be removed once the controller and tests are ported to v1alpha2. Signed-off-by: Michael Bridgen <[email protected]>
This finishes the v1alpha2 API, and rewrites everything needed so that the controller supports it and the tests pass. For the most part, that is just changing the location of fields. However, there's a few notable extras: - check that the `sourceRef` is a git repo (that's the default), and that a `.spec.git` is supplied; - change a test that blindly patched an update object, so that it first gets the object it's patching. Previously, it succeeded because it was OK to patch everything to empty strings, but that's no longer the case since SourceReference.Kind is an enum. Signed-off-by: Michael Bridgen <[email protected]>
This is a bit neater to read and write, and since I'm making breaking changes anyway. The name is now optional; an email is enough. Signed-off-by: Michael Bridgen <[email protected]>
This changes the API so that the checkout field has a ref, the same as GItRepository. This means you can check out a branch or a tag or a particular commit. Most of these won't work unless you supply a branch to push to as well. An addtional change is that you can leave out the checkout altogether, and the ref will default to that given in the GitRepository, or its default. In the latter case, again you will need to provide a push branch. Signed-off-by: Michael Bridgen <[email protected]>
This switches the API doc generation from v1alpha1, to v1alpha2. Signed-off-by: Michael Bridgen <[email protected]>
This mostly adapts the material in the v1alpha1 spec explainer doc to the different structure of the v1alpha2 types. Signed-off-by: Michael Bridgen <[email protected]>
This commit adds a step-by-step guide to rewriting specs for v1alpha2. Signed-off-by: Michael Bridgen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @squaremo 🏅
Should this also remove the v1alpha1 types and CRD definition @stefanprodan? |
I think we need to test what happens with and without v1alpha1 after an upgrade if the manifests in the repo are on v1alpha1. For the other controllers we removed the alpha version when we switched to beta but this is different as we are moving from one alpha to another. |
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. For the automation types, leaving the old version `v1alpha1` definitions in place leads to Kubernetes trying to upgrade objects and dropping most fields (which have changed location), so they have been removed. That would not happen with the types here, but for consistency I am removing the old API version here too. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
If you have a The other situation is if you have a
.. which makes me think applying it as-is in a |
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. For the automation types, leaving the old version `v1alpha1` definitions in place leads to Kubernetes trying to upgrade objects and dropping most fields (which have changed location), so they have been removed. That would not happen with the types here, but for consistency I am removing the old API version here too. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. [1] fluxcd/image-automation-controller#139 Signed-off-by: Michael Bridgen <[email protected]>
This adds a v1alpha2 API, without changing the controller or tests to
use it (yet). The new API has roughly the desired shape, per
fluxcd/flux2#1124, but supporting only
things that the controller supports now.
TODO:
.spec.sourceRef
rather than.spec.checkout.gitRepositoryRef
.spec.git
.spec.git.commit.author.{email,user}
.spec.git.checkout.ref
rather than...branch
EDIT: I put the migration guide at the bottom of the v1alpha2 spec guide.