-
Notifications
You must be signed in to change notification settings - Fork 277
templates: MutatingWebhookConfig filter to CREATE POD events only #1904
templates: MutatingWebhookConfig filter to CREATE POD events only #1904
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1904 +/- ##
==========================================
- Coverage 58.57% 58.40% -0.17%
==========================================
Files 130 130
Lines 5265 5256 -9
==========================================
- Hits 3084 3070 -14
- Misses 2178 2183 +5
Partials 3 3
Continue to review full report at Codecov.
|
|
||
// updateMutatingWebhookCABundle updates the existing MutatingWebhookConfiguration with the CA this OSM instance runs with. | ||
// It is necessary to perform this patch because the original MutatingWebhookConfig YAML does not contain the root certificate. | ||
func updateMutatingWebhookCABundle(cert certificate.Certificater, webhookName string, clientSet kubernetes.Interface) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I missed this in the code somewhere but do we watch for changes in this mwhc resource to reconcile/ensure the CA cert in this mwhc is using the most recent CA cert from the secret? I can open an issue if that helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ritazh very good point - this does not exist yet!
An issue would be great!
425146a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR:
rules
to the MutatingWebhookConfiguration YAML template - observe onlypods/create
eventsRules
from theMutatingWebhookConfiguration
struct created bypatchMutatingWebhookConfiguration
in webhook.goContext
The template for the
MutatingWebhookConfiguration
is a bit misleading since it seems like it observes all events. In reality the final version of theMutatingWebhookConfiguration
is augmented by the OSM Controller with a) rules and b) CA Bundle and looks like this:The addition of
rules
andcaBundle
is done inwebhook.go
via thepatchMutatingWebhookConfiguration()
function: https://github.com/openservicemesh/osm/blob/release-v0.4/pkg/injector/webhook.go#L332-L336Even though adding this section to the YAML file is technically a noop - it would lead to fewer confusions when folks are browsing the source code to understand how this mutating webhook works.
Affected area:
Please answer the following questions with yes/no.