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

added ceOverrides Extensions support for ApiSeverSource #4476

Closed
wants to merge 3 commits into from

Conversation

capri-xiyue
Copy link
Contributor

Fixes #4475

Proposed Changes

  • 🐛added ceOverrides Extensions support for ApiSeverSource

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 6, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 6, 2020
@capri-xiyue
Copy link
Contributor Author

/assign @nachocano

@capri-xiyue
Copy link
Contributor Author

/retest

@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Merging #4476 into master will decrease coverage by 0.02%.
The diff coverage is 86.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4476      +/-   ##
==========================================
- Coverage   81.27%   81.25%   -0.03%     
==========================================
  Files         282      282              
  Lines        8004     8011       +7     
==========================================
+ Hits         6505     6509       +4     
- Misses       1112     1114       +2     
- Partials      387      388       +1     
Impacted Files Coverage Δ
pkg/adapter/apiserver/adapter_injection.go 65.38% <72.72%> (-6.05%) ⬇️
pkg/adapter/apiserver/adapter.go 63.46% <100.00%> (+0.71%) ⬆️
pkg/adapter/apiserver/delegate.go 77.77% <100.00%> (ø)
pkg/adapter/apiserver/events/events.go 93.93% <100.00%> (+0.09%) ⬆️

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 a6fc540...a8b85f7. Read the comment docs.

@nachocano
Copy link
Contributor

Thanks @capri-xiyue !
I think we have to cherry-pick this into 0.17 and 0.18 branches.

fyi @lionelvillard @n3wscott

@nachocano
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 6, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: capri-xiyue, nachocano

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2020
@nachocano
Copy link
Contributor

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 6, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 6, 2020
@nachocano
Copy link
Contributor

/hold cancel
/lgtm

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Nov 6, 2020
@knative-metrics-robot
Copy link

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/adapter/apiserver/adapter_injection.go 76.9% 70.6% -6.3
pkg/adapter/apiserver/events/events.go 96.2% 96.4% 0.1

Copy link
Contributor

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

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

/hold

ceOverrides come from the v2/adapter client. You should not need to do any of this.

pkg/adapter/apiserver/adapter.go Show resolved Hide resolved
ceOverridesExtensions := make(map[string]string)
if len(env.CEOverrides) > 0 {
if err := json.Unmarshal([]byte(env.CEOverrides), &ceOverridesExtensions); err != nil {
panic("failed to create ceOverridesExtensions from json")
Copy link
Contributor

Choose a reason for hiding this comment

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

Likely don't want to panic.

@@ -65,14 +65,20 @@ func NewAdapter(ctx context.Context, processed adapter.EnvConfigAccessor, ceClie
if err := json.Unmarshal([]byte(env.ConfigJson), &config); err != nil {
panic("failed to create config from json")
}

ceOverridesExtensions := make(map[string]string)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a real stuct that should be used for the ceOverrides, it is part of the source duck type

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 6, 2020
@nachocano
Copy link
Contributor

/hold

ceOverrides come from the v2/adapter client. You should not need to do any of this.

Nobody is setting the overrides when creating the outbound event. Is this using v2/adapter? There might be a bug then.

@capri-xiyue
Copy link
Contributor Author

I checked the pingsource, looks like pingsource is also set the setting the overrides by itself

if source.Spec.CloudEventOverrides != nil && source.Spec.CloudEventOverrides.Extensions != nil {

@capri-xiyue
Copy link
Contributor Author

capri-xiyue commented Nov 6, 2020

I think I found the root cause.
Both ApiServerSource and PingSource uses v2/adapter client.
However, in ApiServerSource, it marshalls ceOverrides.Extensions instead of ceOverrides and in unmarshall, it tries to unmarshall ceOverrides.

And in PingSource, looks like it doesn't marshall ceOverrides at all. And pingsource relies on setting the ceOverrides.Extensions in adapter by itself (#3331)

@capri-xiyue
Copy link
Contributor Author

Closed this PR and will fix the issue in this #4477

@capri-xiyue capri-xiyue closed this Nov 6, 2020
@n3wscott
Copy link
Contributor

n3wscott commented Nov 6, 2020

Great work!!

@capri-xiyue
Copy link
Contributor Author

I will create another issue for PingSource so that PingSource doesn't need to set extensions in its own adapter.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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.

ApiServerSource does not set Ce Overrides Extensions
5 participants