Skip to content

Cleanup receive adapter main code.#2016

Merged
knative-prow-robot merged 3 commits into
knative:masterfrom
lionelvillard:cleanup_adapters
Oct 10, 2019
Merged

Cleanup receive adapter main code.#2016
knative-prow-robot merged 3 commits into
knative:masterfrom
lionelvillard:cleanup_adapters

Conversation

@lionelvillard
Copy link
Copy Markdown
Contributor

Helps with #1989

Proposed Changes

  • Make CronJob and APIServer source main more similar
  • Start factoring out common code, starting with minimal shared environment

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 9, 2019
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 9, 2019
@lionelvillard lionelvillard changed the title Cleanup receice adapter main code. Cleanup receive adapter main code. Oct 9, 2019
@lionelvillard
Copy link
Copy Markdown
Contributor Author

/assign @evankanderson

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm
/hold

A few comments, mostly around the removal of TODOs that I'm not sure if we want to clean up.

Feel free to remove the hold and let this submit if the TODOs are obsolete and you don't feel the need to make other fixes.

LoggingConfigJson string `envconfig:"K_LOGGING_CONFIG" required:"true"`
}

// TODO: the controller should take the list of GVR
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like we lost this TODO; it looks like there's a dynamic list in the current code. I'm not sure what the original intent of this TODO was, though. Maybe it's obsolete?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@n3wscott , who left this comment in #1175

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is being tracked here #1660 instead of the TODO. Is that alright?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that an issue is IMO better instead of a TODO, @lionelvillard

Comment thread cmd/cronjob_receive_adapter/main.go Outdated

var env envConfig
err := envconfig.Process("", &env)
if err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Convert this to the 3-line version?

if err := envconfig.Process("", &env); err != nil {
  log.Fatalf(...)
}

(I also don't think panic's stack trace will help here.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done!

Comment thread pkg/adapter/config.go Outdated
package adapter

// EnvConfig is the minimal set of configuration parameters
// source adapters must support
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this a "must support" or "a common set of useful environment variables"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The controllers provide these variables and the adapters should support them. Changed

"knative.dev/pkg/source"
)

// TODO: this should be a k8s cron.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why remove this TODO?

Copy link
Copy Markdown
Contributor Author

@lionelvillard lionelvillard Oct 10, 2019

Choose a reason for hiding this comment

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

opened a bug tracking this: #2025

)

// Initialize cloudevent client
func (a *Adapter) initClient() error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 to removing init methods where possible.

(no action needed)

@knative-prow-robot knative-prow-robot added 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. labels Oct 9, 2019
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, 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 Oct 9, 2019
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 10, 2019
@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/adapter/cronjobevents/adapter.go 91.4% 96.3% 4.9

@lionelvillard
Copy link
Copy Markdown
Contributor Author

/hold cancel

@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 Oct 10, 2019
@matzew
Copy link
Copy Markdown
Member

matzew commented Oct 10, 2019

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 10, 2019
@knative-prow-robot knative-prow-robot merged commit 773131f into knative:master Oct 10, 2019
@lionelvillard lionelvillard deleted the cleanup_adapters branch January 20, 2020 14:59
@lionelvillard lionelvillard restored the cleanup_adapters 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.

6 participants