Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

GitlabSource webhook that runs alongside the controller #1120

Merged
merged 3 commits into from
Apr 17, 2020
Merged

GitlabSource webhook that runs alongside the controller #1120

merged 3 commits into from
Apr 17, 2020

Conversation

tzununbekov
Copy link
Member

Fixes #1119

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 8, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 8, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 8, 2020
@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 8, 2020
@knative-prow-robot knative-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 8, 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.

barring content of the Validate/SetDefaults, this generally looks good to me.

/assign @n3wscott

For Source-related defaulting guidance.

@@ -62,6 +62,8 @@ rules:
- get
- list
- watch
# Webhook controller needs it to update "sources-webhook-certs" contents
Copy link
Member

Choose a reason for hiding this comment

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

nit: we should have webhook-specific secrets to avoid things clobbering each other. This may need fixing elsewhere, but it's something I've started trying to do.

errs = errs.Also(fe)
} else if fe := gs.Sink.Validate(ctx); fe != nil {
errs = errs.Also(fe.ViaField("sink"))
}
Copy link
Member

Choose a reason for hiding this comment

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

cc @n3wscott for wisdom around Source validation and Defaulting.

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 helper for sink:

	// Validate sink
	errs = errs.Also(cs.Sink.Validate(ctx).ViaField("sink"))

Copy link
Contributor

Choose a reason for hiding this comment

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

also, spec.Sink is required, so it should not be a pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are using the helper 😆 sorry. But the question likely comes from the pointer type and having more logic here than needed. We can look into pushing some of the source spec validation into the ducktype too next release to help this.

@tzununbekov tzununbekov changed the title [WIP] GitlabSource webhook that runs alongside the controller GitlabSource webhook that runs alongside the controller Apr 10, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 10, 2020
@tzununbekov
Copy link
Member Author

@mattmoor @n3wscott thanks for review. Sorry if I missed something - are there any actions required from me to get lgmt'd? Should I make webhook secret name source-specific?

@mattmoor
Copy link
Member

Yeah ideally this would use it's own secret.

@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
gitlab/pkg/apis/sources/v1alpha1/gitlabsource_defaults.go Do not exist 100.0%
gitlab/pkg/apis/sources/v1alpha1/gitlabsource_validation.go Do not exist 75.0%

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tzununbekov

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 Apr 15, 2020
@tzununbekov
Copy link
Member Author

/retest

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.

/lgtm
/assign @n3wscott

I'd love to see a GitlabBinding next if you are up for it (in the style of #1113 and #1116)

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2020
@knative-prow-robot knative-prow-robot merged commit 4820545 into knative:master Apr 17, 2020
@tzununbekov
Copy link
Member Author

thanks!

I'd love to see a GitlabBinding next if you are up for it (in the style of #1113 and #1116)

yeah, sure

@tzununbekov tzununbekov deleted the gitlab-webhooks branch April 24, 2020 12:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

GitlabSource Webhook
6 participants