Skip to content

Use knative/pkg/webhooks#352

Merged
knative-prow-robot merged 16 commits into
knative:masterfrom
n3wscott:move-to-webhookv2
Aug 15, 2018
Merged

Use knative/pkg/webhooks#352
knative-prow-robot merged 16 commits into
knative:masterfrom
n3wscott:move-to-webhookv2

Conversation

@n3wscott
Copy link
Copy Markdown
Contributor

@n3wscott n3wscott commented Aug 14, 2018

Moves to use the shared controller in /pkg.
Removes all eventing/pkg/webhook/ code because it is no longer needed 🎉

GenericCRD support (the interface) is needed for the pkg/webhook framework to operate on types generically. In testing this I found panics realated to types that lacked the method GetSpecJSON.

Found that spec.generation was missing and knative still uses that to track the generation until there is full support for /status updates for CRDs. Added generation to all specs

Release Note

Moving to use the common framework from knative/pkg/webhook to do type validation and defaulting.
action required: manually delete the pod that runs the current webhook with the following,
  $ kubectl delete deployment eventing-webhook -n knative-eventing
  $ kubectl delete service eventing-webhook -n knative-eventing

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 14, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

Grant for LGTM:
/cc @grantr

Evan for Approval:
/assign @evankanderson

@n3wscott
Copy link
Copy Markdown
Contributor Author

/cc @mattmoor

🍾 👍 💯 🦃

@n3wscott
Copy link
Copy Markdown
Contributor Author

/retest

@n3wscott
Copy link
Copy Markdown
Contributor Author

/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 Aug 14, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

depends on knative/pkg#44

@n3wscott
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 Aug 14, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

ISTIO!!!

/test pull-knative-eventing-integration-tests

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

Love that red ink! Thanks @n3wscott.

/lgtm

Comment thread cmd/webhook/main.go Outdated
"go.uber.org/zap"
v1alpha1channels "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
v1alpha1feeds "github.com/knative/eventing/pkg/apis/feeds/v1alpha1"
v1alpha1flows "github.com/knative/eventing/pkg/apis/flows/v1alpha1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why v1alpha1flows instead of flowsv1alpha1 as used in other controllers? I'm fine with this style, just curious if there's a reason.

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.

It was not intentional. I can change to the normal way. Just got it mixed up

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.

Were you going to change this?

var _ apis.Validatable = (*Feed)(nil)
var _ apis.Defaultable = (*Feed)(nil)
var _ apis.Immutable = (*Feed)(nil)
var _ webhook.GenericCRD = (*Feed)(nil)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No runtime.Object cast 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.

so.. some egg on my face... webhook.GenericCRD has all of these

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.

I could boil it down to just webhook.GenericCRD


// TODO(n3wscott): these tests will go away when we move to new type of webhooks.

func TestNewChannelNSBus(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did these tests (and the tests for the other types) all make it over to the apis packages?

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.

I did move them all as I was writing the other validation parts

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 can confirm. I may have pushed for some additional tests, and @n3wscott said he'd add them after this PR.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

/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 Aug 14, 2018
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2018
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.

Only a few minor comments, looking very good!

Comment thread cmd/webhook/main.go
Port: 443,
SecretName: "eventing-webhook-certs",
WebhookName: "webhook.eventing.knative.dev",
ServiceName: "webhook",
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.

Changing the name of the webhook service is likely to mean that anyone with the existing webhook installed is going to run with two webhooks until they delete the old one by hand.

Put this in "release notes" -- steal the format from knative/serving if we don't have it.

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, and made a PR to update our template: #357

role: webhook
name: webhook
namespace: knative-eventing
spec:
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 are the Service and the Deployment for the webhook in separate files?

Can we combine these at the 400 level?

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.

(But don't do this in this PR)

var _ apis.Validatable = (*Channel)(nil)
var _ apis.Defaultable = (*Channel)(nil)
var _ apis.Immutable = (*Channel)(nil)
var _ runtime.Object = (*Channel)(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.

It sounds like you don't need this anymore?

var _ apis.Validatable = (*Flow)(nil)
var _ apis.Defaultable = (*Flow)(nil)
var _ apis.Immutable = (*Flow)(nil)
var _ runtime.Object = (*Flow)(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.

Another runtime.Object that's unneeded.


// TODO(n3wscott): these tests will go away when we move to new type of webhooks.

func TestNewChannelNSBus(t *testing.T) {
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 can confirm. I may have pushed for some additional tests, and @n3wscott said he'd add them after this PR.

@n3wscott
Copy link
Copy Markdown
Contributor Author

this time for real, ISTIO!!!

/test pull-knative-eventing-integration-tests

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

Comment thread cmd/webhook/main.go Outdated
"go.uber.org/zap"
v1alpha1channels "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
v1alpha1feeds "github.com/knative/eventing/pkg/apis/feeds/v1alpha1"
v1alpha1flows "github.com/knative/eventing/pkg/apis/flows/v1alpha1"
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.

Were you going to change this?

role: webhook
name: webhook
namespace: knative-eventing
spec:
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.

(But don't do this in this PR)

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, grantr, n3wscott

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 Aug 14, 2018
@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@evankanderson
Copy link
Copy Markdown
Member

There's still the comment in cmd/webhook/main.go.

Also, can you update the PR description to cover the addition of Generation and the rationale for same?

@n3wscott
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 Aug 14, 2018
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-eventing-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/apis/feeds/v1alpha1/cluster_event_type_types.go Do not exist 0.0%
pkg/apis/feeds/v1alpha1/event_source_types.go Do not exist 0.0%
pkg/apis/flows/v1alpha1/flow_types.go 100.0% 98.4% -1.6

@n3wscott
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@evankanderson
Copy link
Copy Markdown
Member

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 15, 2018
@knative-prow-robot knative-prow-robot merged commit 4d4c03b into knative:master Aug 15, 2018
matzew added a commit to matzew/eventing that referenced this pull request Dec 9, 2019
cardil pushed a commit to cardil/knative-eventing that referenced this pull request Sep 28, 2023
…native#352)

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
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. 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.

5 participants