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

Add v1beta1 Go API types #1103

Merged
merged 6 commits into from
Jun 4, 2021
Merged

Add v1beta1 Go API types #1103

merged 6 commits into from
Jun 4, 2021

Conversation

dibyom
Copy link
Member

@dibyom dibyom commented May 20, 2021

Changes

This commit adds v1beta1 go types and the corresponding generated code. These types cannot be used yet until we enable them in the CRDs.

Part of #1067

Signed-off-by: Dibyo Mukherjee dibyo@google.com

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 20, 2021
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 20, 2021
@tekton-robot
Copy link

@dibyom dibyom marked this pull request as ready for review May 20, 2021 20:33
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2021
@dibyom
Copy link
Member Author

dibyom commented May 20, 2021

/assign @wlynch
/assign @savitaashture

@dibyom
Copy link
Member Author

dibyom commented May 21, 2021

/test pull-tekton-triggers-integration-tests

}

func (spec *EventListenerSpec) updatePodTemplate() {
if spec.DeprecatedPodTemplate != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these fields are deprecated, can we prune them from v1beta1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That particular field is going away with #1105 though generally it depends - we'd have to keep supporting fields in v1beta1 that are a part of v1alpha1 due to how kube api machinery works (v1beta1 is the stored version so all fields must be supported). We'll use the validation webhook to return errors for fields that should not be supported in v1beta1 version.

Copy link
Member

@wlynch wlynch May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also other deprecated fields for interceptors, etc. My worry is if we introduce these fields, if we're strictly following the deprecation policy this effectively resets the clock for removal since we're "introducing a new field" even though it's deprecated from the start.

If I'm understanding https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#on-compatibility correctly, we don't need to have 1:1 parity with every field in the stored version - we just need to make sure users can go from v1alpha1 to v1beta1 and back without data loss.
The same way we already mutate DeprecatedPodTemplate -> spec.Resources.KubernetesResource, I don't think we need to support the deprecated fields in v1beta1, since we can safely convert back to v1alpha1 by using KubernetesResource. This is analogous to the k8s example where v6 holds (Param, Params), where as the stored v7 version only stores Params and does not have the param field - it just populates it on conversion from Params.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a valid concern. I think there were some issues with JSON marshalling without having the fields set but let me verify. I think given the conversions we are doing in the defaulting webhook, we should not need an extra conversion webhook

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think this will actually work!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it works because when we upgrade from old version to new version there won't be API update so if user want they will create new resources with v1beta1 am i right ?

@dibyom
Copy link
Member Author

dibyom commented May 21, 2021

Integration test failed due to an install error this time.

/test pull-tekton-triggers-integration-tests

@dibyom
Copy link
Member Author

dibyom commented May 21, 2021

Here is the path I verified with the storage type set to v1beta1:

  1. Create a v1alpha1 EL with old deprecated Interceptor fields - the defaulting webhook fixes the old fields

  2. Create a v1beta1 EL with no deprecated fields - this works fine.

  3. Create a v1beta1 EL with deprecated Interceptor fields - this fails but that is expected since the old fields are not supported in beta.

Also, checked the coverage reports to verify we did not lose coverage when removing old fields.

One question is around what we do with the old style webhook interceptors since we can't auto-upgrade them to new fields. Maybe just a validation error is sufficient?

@dibyom
Copy link
Member Author

dibyom commented May 24, 2021

/retest

@dibyom
Copy link
Member Author

dibyom commented May 24, 2021

Logs say:

==== UNIT TESTS PASSED ====

🙃

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label May 26, 2021
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2021
@wlynch
Copy link
Member

wlynch commented Jun 3, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 3, 2021
@tekton-robot tekton-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 3, 2021
Comment on lines +48 to +52
v1beta1.SchemeGroupVersion.WithKind("ClusterTriggerBinding"): &v1beta1.ClusterTriggerBinding{},
v1beta1.SchemeGroupVersion.WithKind("EventListener"): &v1beta1.EventListener{},
v1beta1.SchemeGroupVersion.WithKind("TriggerBinding"): &v1beta1.TriggerBinding{},
v1beta1.SchemeGroupVersion.WithKind("TriggerTemplate"): &v1beta1.TriggerTemplate{},
v1beta1.SchemeGroupVersion.WithKind("Trigger"): &v1beta1.Trigger{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the above changes i assume we are not adding ClusterInterceptor to beta right ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they will be in the v1alpha1 type but can be used from v1beta1 triggers

This commit adds v1beta1 go types and the corresponding generated code. These types cannot be used yet until we enable them in the CRDs.

Part of tektoncd#1067

Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
These fields will still be supported in the v1alpha1 types.
At the moment, these are internal types and will not be usable
by the end user.
Copy link
Contributor

@savitaashture savitaashture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2021
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: savitaashture

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2021
@tekton-robot tekton-robot merged commit 1a2d8f0 into tektoncd:main Jun 4, 2021
@dibyom dibyom deleted the v1betatypes branch July 15, 2021 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants