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

Bump knative.dev/pkg to 528ad1c 🔥 #1412

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ required = [

[[override]]
name = "knative.dev/pkg"
# HEAD as of 2019-07-23 💖
revision = "e4bc08cc8deda3eac40a8d53984d09c9d0e1ad48"
# HEAD as of 2019-09-09 💖
revision = "528ad1c1dd627059b95aef17ccf27f9ab0f46c10"

[[override]]
name = "knative.dev/eventing-contrib"
Expand Down
55 changes: 30 additions & 25 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,37 @@ func main() {
}

options := webhook.ControllerOptions{
ServiceName: "tekton-pipelines-webhook",
DeploymentName: "tekton-pipelines-webhook",
Namespace: system.GetNamespace(),
Port: 8443,
SecretName: "webhook-certs",
WebhookName: "webhook.tekton.dev",
ServiceName: "tekton-pipelines-webhook",
DeploymentName: "tekton-pipelines-webhook",
Namespace: system.GetNamespace(),
Port: 8443,
SecretName: "webhook-certs",
WebhookName: "webhook.tekton.dev",
ResourceAdmissionControllerPath: "/",
}
//TODO add validations here
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to lose this comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

So I removed it because we are already doing validation in the webhook, so I felt it wasn't necessary anymore.

controller := webhook.AdmissionController{
Client: kubeClient,
Options: options,
Handlers: map[schema.GroupVersionKind]webhook.GenericCRD{
v1alpha1.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha1.Pipeline{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha1.PipelineResource{},
v1alpha1.SchemeGroupVersion.WithKind("Task"): &v1alpha1.Task{},
v1alpha1.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha1.ClusterTask{},
v1alpha1.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha1.TaskRun{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{},
v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{},
},
Logger: logger,
DisallowUnknownFields: true,
// Decorate contexts with the current state of the config.
WithContext: func(ctx context.Context) context.Context {
return v1alpha1.WithDefaultConfigurationName(store.ToContext(ctx))
},
resourceHandlers := map[schema.GroupVersionKind]webhook.GenericCRD{
v1alpha1.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha1.Pipeline{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha1.PipelineResource{},
v1alpha1.SchemeGroupVersion.WithKind("Task"): &v1alpha1.Task{},
v1alpha1.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha1.ClusterTask{},
v1alpha1.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha1.TaskRun{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{},
v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{},
}

resourceAdmissionController := webhook.NewResourceAdmissionController(resourceHandlers, options, true)
Copy link
Member

Choose a reason for hiding this comment

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

NIT: The third parameter here is the "DisallowUnknownFields" - but to know that one has to lookup the NewResourceAdmissionController code, so I think we lose a bit in readability.

Copy link
Member Author

Choose a reason for hiding this comment

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

@afrittoli I agree 😅 We should either name that boolean or propose some changes upstream to make the New… more "functionnal".

admissionControllers := map[string]webhook.AdmissionController{
options.ResourceAdmissionControllerPath: resourceAdmissionController,
}

// Decorate contexts with the current state of the config.
ctxFunc := func(ctx context.Context) context.Context {
return v1alpha1.WithDefaultConfigurationName(store.ToContext(ctx))
}

controller, err := webhook.New(kubeClient, options, admissionControllers, logger, ctxFunc)
if err != nil {
logger.Fatal("Error creating admission controller", zap.Error(err))
}

if err := controller.Run(stopCh); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/injection/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/injection/client/fake/fake.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions pkg/client/injection/informers/factory/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading