Skip to content

fix(PingSource): remove annotation based conversion logic#5153

Merged
knative-prow-robot merged 1 commit into
knative:mainfrom
eclipselu:fix
Apr 12, 2021
Merged

fix(PingSource): remove annotation based conversion logic#5153
knative-prow-robot merged 1 commit into
knative:mainfrom
eclipselu:fix

Conversation

@eclipselu
Copy link
Copy Markdown
Contributor

@eclipselu eclipselu commented Mar 25, 2021

Fixes #5137

Proposed Changes

  • 🧹 v1beta1 will not always be roundtrip-able (in the case that jsonData cannot be marshalled into json, e.g. jsonData="hello"), but the cloudevent on the wire stays the same.
  • 🐛 duckv1.SourceSpec, TimeZone, Schedule will be populated when called by v1beta1 clients
  • 🧹 object with v1beta2-specific features (dataBase64, contentType beyond application/json) will not populate jsonData field when converted to v1beta1.

Release Note

:bug: duckv1.SourceSpec, TimeZone, Schedule will be populated when called by v1beta1/v1alpha2 clients

Docs

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 25, 2021
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 25, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2021

Codecov Report

Merging #5153 (92bb7ea) into main (d3e856a) will increase coverage by 0.59%.
The diff coverage is 95.00%.

❗ Current head 92bb7ea differs from pull request most recent head df8dfd8. Consider uploading reports for the commit df8dfd8 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5153      +/-   ##
==========================================
+ Coverage   83.41%   84.01%   +0.59%     
==========================================
  Files         283      283              
  Lines        7955     7933      -22     
==========================================
+ Hits         6636     6665      +29     
+ Misses        947      897      -50     
+ Partials      372      371       -1     
Impacted Files Coverage Δ
pkg/apis/sources/v1beta1/ping_conversion.go 95.12% <95.00%> (+8.63%) ⬆️
pkg/adapter/v2/main.go 60.86% <0.00%> (+2.73%) ⬆️
pkg/kncloudevents/utils.go 69.23% <0.00%> (+69.23%) ⬆️
pkg/kncloudevents/message_receiver.go 90.69% <0.00%> (+90.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3e856a...df8dfd8. Read the comment docs.

@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-reconciler-tests

1 similar comment
@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-reconciler-tests

Comment thread pkg/apis/sources/v1beta1/ping_conversion.go Outdated
@lberk
Copy link
Copy Markdown
Member

lberk commented Mar 29, 2021

it would be great to get this backported to v0.22 & v0.21 given #5137

- v1beta1 will not guaranteed to be roundtrip-able (in the case that jsonData cannot be marshalled into json, e.g. jsonData="hello"), but the cloudevent on the wire stays the same.
- duckv1.SourceSpec, TimeZone, Schedule will be populated when called by v1beta1 clients
- object with v1beta2-specific features (dataBase64, contentType beyond `application/json`) will not populate jsonData field when converted to v1beta1.
@eclipselu eclipselu changed the title fix(PingSource): populate duckv1.SourceSpec, schedule and timezone when converting from v1beta2 to v1beta1 fix(PingSource): remove annotation based conversion logic Mar 31, 2021
@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-reconciler-tests

Comment thread pkg/apis/sources/v1beta1/ping_conversion.go
@lionelvillard
Copy link
Copy Markdown
Contributor

BTW, since there is no need for the annotations anymore, what about removing them when running the post-install job? (See WIP: #5008)

@eclipselu
Copy link
Copy Markdown
Contributor Author

BTW, since there is no need for the annotations anymore, what about removing them when running the post-install job? (See WIP: #5008)

yes we can do it.

@lionelvillard
Copy link
Copy Markdown
Contributor

@eclipselu Is there anything else to do here?

@eclipselu
Copy link
Copy Markdown
Contributor Author

@eclipselu Is there anything else to do here?

The only question is that if we return an error like discussed, while it makes sense in some way, it still does not fix the original issue (duckv1.SourceSpec isn't populated for non-storage versions).

The most impacted is kn, which uses v1alpha2 source client, list/describe will both fail. Specifically for kn source ping list, when there're one v1beta1 PingSource and one v1beta2 PingSource, it will still fail.

@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-unit-tests

@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-reconciler-tests

@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/sources/v1beta1/ping_conversion.go 92.4% 95.8% 3.4

@lionelvillard
Copy link
Copy Markdown
Contributor

Much better! Thanks @eclipselu

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2021
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lionelvillard

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2021
@eclipselu
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-reconciler-tests

@eclipselu
Copy link
Copy Markdown
Contributor Author

Will be back-ported to 0.22 and 0.21.

@knative-prow-robot knative-prow-robot merged commit 515136c into knative:main Apr 12, 2021
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PingSource sink field is unpopulated on non-storage versions

5 participants