aws / aws-application-networking-k8s

A Kubernetes controller for Amazon VPC Lattice
https://www.gateway-api-controller.eks.aws.dev/
Apache License 2.0
175 stars 50 forks source link

Adding core webhook libraries sourced from aws lb controller #605

Closed erikfuller closed 8 months ago

erikfuller commented 9 months ago

What type of PR is this? feature

Which issue does this PR fix: https://github.com/aws/aws-application-networking-k8s/issues/596

What does this PR do / Why do we need it: This PR adds useful types for handling webhook invocation. They are sourced from the aws-load-balancer-controller, which I believe originally came from the aws-app-mesh-controller-for-k8s.

Changes from the original were minor, but I've added notes where appropriate

Testing done on this change: make presubmit

All unit tests pass.

Automation added to e2e: n/a

Will this PR introduce any new dependencies?: no

Will this break upgrades or downgrades. Has updating a running cluster been tested?: n/a

Does this PR introduce any user-facing change?: no

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

mikhail-aws commented 8 months ago

Curious what controller's runtime and kubebuilder does not provide, so we need to implement own mutators.

https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.2/pkg/webhook/admission https://github.com/kubernetes-sigs/controller-runtime/blob/main/examples/builtins/mutatingwebhook.go https://github.com/kubernetes-sigs/controller-runtime/blob/main/examples/builtins/validatingwebhook.go