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

Migrate jobrunner to cloudevent v2 #2867

Merged
merged 7 commits into from
Apr 1, 2020

Conversation

lionelvillard
Copy link
Member

Proposed Changes

  • JobRunner now uses the CloudEvent V2 API
  • Reorganize a bit knCloudEvent

Release Note


Docs

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 30, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 30, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Comment on lines 26 to 27
const ()

Copy link
Member

Choose a reason for hiding this comment

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

Format Go code:

Suggested change
const ()

@knative-prow-robot
Copy link
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

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 Mar 30, 2020
pkg/adapter/v2/main.go Outdated Show resolved Hide resolved
@@ -63,14 +64,14 @@ var _ cloudevents.Client = (*client)(nil)
func (c *client) Send(ctx context.Context, out event.Event) error {
c.applyOverrides(ctx, &out)
err := c.ceClient.Send(ctx, out)
return c.reportCount(ctx, out, err)
return c.reporter.ReportCount(ctx, out, err)
}

// Request implements client.Request
func (c *client) Request(ctx context.Context, out event.Event) (*event.Event, error) {
c.applyOverrides(ctx, &out)
Copy link
Contributor

Choose a reason for hiding this comment

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

overrides are only for sources.

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure what to do here. Can you expand?

@n3wscott
Copy link
Contributor

/hold

The cloudevents client created in adapter/v2 is for Adapters only. Please do not move it out of that area.

@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 Mar 30, 2020
@lionelvillard
Copy link
Member Author

right. That make me think that the jobrunner should also move under adapter then.

@n3wscott
Copy link
Contributor

right. That make me think that the jobrunner should also move under adapter then.

jobrunner is a pretty bad name for this. It is not a generic component, it really only services pingsource so maybe you should call it mtpingsourceadapter or something

@lionelvillard
Copy link
Member Author

@n3wscott can the hold be removed?

@@ -71,10 +84,13 @@ func (c *TestCloudEventsClient) Sent() []cloudevents.Event {
return r
}

func NewTestClient() *TestCloudEventsClient {
func NewTestClient(reporter source.StatsReporter) *TestCloudEventsClient {
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 no reason to test that the test cloudevents client uses the test stats reporter.

reporter := &mockReporter{}
ce := kncetesting.NewTestClient()
reporter := &MockStatsReporter{}
ce := adaptertesting.NewTestClient(reporter)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is now the job of the adapter to test that metrics are collected or not, not the job runner.

@n3wscott
Copy link
Contributor

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 31, 2020
@slinkydeveloper
Copy link
Contributor

/assign

pkg/reconciler/pingsource/jobrunner/runner.go Outdated Show resolved Hide resolved
pkg/adapter/v2/metrics/metrics_test.go Outdated Show resolved Hide resolved
@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/v2/cloudevents.go 68.4% 85.0% 16.6
pkg/adapter/v2/metrics/metrics.go Do not exist 57.9%
pkg/reconciler/pingsource/jobrunner/runner.go 92.3% 90.9% -1.4

@slinkydeveloper
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2020
@knative-prow-robot knative-prow-robot merged commit 6386f24 into knative:master Apr 1, 2020
@lionelvillard lionelvillard deleted the mt-ping-cev2 branch August 28, 2020 15:43
@lionelvillard lionelvillard restored the mt-ping-cev2 branch September 3, 2020 15:43
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.

7 participants