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

init-webhook #21

Merged
merged 2 commits into from
Jul 23, 2019
Merged

init-webhook #21

merged 2 commits into from
Jul 23, 2019

Conversation

vincent-pli
Copy link
Member

Changes

  1. Implement webhook use knative/pkg and tektoncd/pipeline
  2. Add ko related configuration files

WIP:
types depends on #17
types must implement GenericCRD

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2019
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 10, 2019
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@bobcatfish
Copy link
Collaborator

Thanks for working on this @vincent-pli !!

@vdemeester was suggesting in #18 (comment) that we look into the injection based controllers, I assume we can use that for the webhook controller too

@vincent-pli
Copy link
Member Author

@bobcatfish
I checked the enjection-gen, seems it's used for simplify CRD controller implements by us.
but the webhook's controller is come from knative/pkg
need further confirmation...

@bobcatfish
Copy link
Collaborator

but the webhook's controller is come from knative/pkg

hm I thought you would be able to use the injection interface for webhooks too, but looking at pipelines we don't seem to be using it 🤔 https://github.com/tektoncd/pipeline/blob/196a945c2dd795b9ef5e516f365e69c69218754e/cmd/webhook/main.go#L42 (maybe @vdemeester just didn't have a chance to update it!)

@vdemeester do you know if it's possible to use the injection interface for webhook controllers too?

@vdemeester
Copy link
Member

@bobcatfish I am looking into that 😉 (both for here and pipelines 😉 )

@vincent-pli
Copy link
Member Author

@bobcatfish @vdemeester
I'm afraid the webhook can not leverage injection controller, see the issue:
knative/pkg#450

@vincent-pli
Copy link
Member Author

@iancoffey
Seems we upgrade k8s.io/api from version = "kubernetes-1.12.6"(pipeline used) to version = "kubernetes-1.15.0"

that's broken the webhook implements in knative/pkg
I get the exception:

vendor/github.com/knative/pkg/webhook/webhook.go:357:15: undefined: "github.com/tektoncd/triggers/vendor/k8s.io/api/admissionregistration/v1beta1".Webhook

since the new k8s.io/api discard the Webhook, use MutatingWebhook instead.

Could we rollback to kubernetes-1.12.6

@iancoffey
Copy link
Member

@vincent-pli Yes indeed, sounds like we may need to rollback to kubernetes-1.12.6 👍

Matching what Pipelines has defined sounds reasonable to me.

@vincent-pli
Copy link
Member Author

@iancoffey
Thanks

@vincent-pli
Copy link
Member Author

/retest

@vincent-pli vincent-pli changed the title [WIP] init-webhook init-webhook Jul 15, 2019
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2019
Copy link
Member

@ncskier ncskier left a comment

Choose a reason for hiding this comment

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

Hi @vincent-pli, thanks for working on the webhook controller! I just saw that this PR was ready for review, so sorry that it didn't get reviewed sooner. Overall it looks really good, I just have a handful of comments/questions. 🙂

config/webhook-service.yaml Outdated Show resolved Hide resolved
config/webhook.yaml Outdated Show resolved Hide resolved
config/webhook.yaml Outdated Show resolved Hide resolved
config/webhook.yaml Show resolved Hide resolved
cmd/webhook/main.go Outdated Show resolved Hide resolved
cmd/webhook/main.go Show resolved Hide resolved
v1alpha1.SchemeGroupVersion.WithKind("TriggerTemplate"): &v1alpha1.TriggerTemplate{},
},
Logger: logger,
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely sure what the WithContext: field does in the pipeline webhook, but is there a reason why we don't want to include it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The propose of this setting is try to put some default value in to context, I guess we still not ready for this part, anyway, I add one, just return the parameter itself.

WithContext: func(ctx context.Context) context.Context {
                        return ctx
                },

Copy link
Member

Choose a reason for hiding this comment

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

If it's not used, I think you can just skip this field altogether. It can be used to pass some value/key to tell the controller that it will need to update some version to set defaults, etc..

cmd/webhook/main.go Outdated Show resolved Hide resolved
@vincent-pli vincent-pli force-pushed the init-webhook branch 2 times, most recently from 752b9e5 to e4ce944 Compare July 19, 2019 08:11
Copy link
Member

@ncskier ncskier left a comment

Choose a reason for hiding this comment

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

Hi @vincent-pli, thank you for making the updates! I just have a few nits before I'm ready to approve your PR (the only one that's stopping me from approving the PR right now is the 200-clusterrole.yaml comment). 😄

config/200-clusterrole.yaml Outdated Show resolved Hide resolved
cmd/webhook/main.go Outdated Show resolved Hide resolved
cmd/webhook/main.go Outdated Show resolved Hide resolved
cmd/webhook/kodata/LICENSE Outdated Show resolved Hide resolved
@ncskier
Copy link
Member

ncskier commented Jul 23, 2019

Thanks for making those changes @vincent-pli, looks great!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2019
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncskier, vincent-pli

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2019
@tekton-robot tekton-robot merged commit d2457bb into tektoncd:master Jul 23, 2019
@bobcatfish
Copy link
Collaborator

I just noticed @vincent-pli - in future we want to make sure that commit messages follow our commit message guidelines - it can be a bit hard to do while responding to feedback on a PR tho 🙏 Sometimes amending one commit as you go can be a bit easier.

@ncskier
Copy link
Member

ncskier commented Jul 23, 2019

Sorry, I missed the commit messages when reviewing 😓

@bobcatfish
Copy link
Collaborator

No worries @ncskier I did too! Thanks for tolerating the nag 😜

@vincent-pli
Copy link
Member Author

@bobcatfish @ncskier
Thanks for your comments, I will strict follow the guideline in the next commit, thanks again, very helpful.

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.

7 participants