-
Notifications
You must be signed in to change notification settings - Fork 462
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
Split webhook validation #10284
Split webhook validation #10284
Conversation
Issues linked to changelog: |
Visit the preview URL for this PR (updated for commit 9c28910): https://gloo-edge--pr10284-sheidkamp-split-vali-f1w7xqqf.web.app (expires Wed, 20 Nov 2024 00:09:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 77c2b86e287749579b7ff9cadb81e099042ef677 |
…/solo-io/gloo into sheidkamp/split-validating-webhook
install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml
Outdated
Show resolved
Hide resolved
install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml
Outdated
Show resolved
Hide resolved
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.
I think that it could be valuable to capture the background for the split configs in https://github.com/solo-io/gloo/tree/main/projects/gateway/pkg/services/k8sadmission. That way we have a public source of truth for that decision.
The changes look good overall. I'd like to see unit tests for the new field, and i imagine we want to rely on the default value (fail open) for our e2e tests (so no changes would be needed)
install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml
Outdated
Show resolved
Hide resolved
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.
These changes LGTM!
I know there are some small documentation changes that we intend to make, I just wanted to 👍 the general direction.
7c91dac
to
1e0dc8c
Compare
…/solo-io/gloo into sheidkamp/split-validating-webhook
install/helm/gloo/generate/values.go
Outdated
FailurePolicy *string `json:"failurePolicy,omitempty" desc:"failurePolicy defines how unrecognized errors for Gloo resources from the Gateway validation endpoint are handled - allowed values are 'Ignore' or 'Fail'. Defaults to Ignore "` | ||
KubeCoreFailurePolicy *string `json:"kubeCoreFailurePolicy,omitempty" desc:"kubeCoreFailurePolicy defines how unrecognized errors for core resources from the Gateway validation endpoint are handled - allowed values are 'Ignore' or 'Fail'. If this is set to 'Fail' modifications to core resources such as secrets and namespace that are defined in the validating webhook will be blocked if the Gloo Service is not available. Defaults to Ignore "` |
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.
nit: we don't need to mention the default values in the description since the docs will extract that from values-template.yaml
// var _ e2e.NewSuiteFunc = NewKubeFailTestingSuite | ||
// var _ e2e.NewSuiteFunc = NewGlooFailTestingSuite |
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.
remove?
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.
yup
func (s *testingSuite) TearDownSuite() { | ||
// nothing at the moment | ||
} | ||
func (s *testingSuite) SetupDownSuite() { |
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.
typo?
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.
yup
manifest := manifests[testName] | ||
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifest.filename, "-n", s.testInstallation.Metadata.InstallNamespace) | ||
// May have already been deleted | ||
if err == nil { |
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.
what about the case where err != nil
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.
updated to track successful deletion and only cleanup if neccessary.
install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml
Outdated
Show resolved
Hide resolved
install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml
Outdated
Show resolved
Hide resolved
structuredDeployment, ok := webhookObject.(*admissionregistrationv1.ValidatingWebhookConfiguration) | ||
ExpectWithOffset(1, ok).To(BeTrue(), fmt.Sprintf("Webhook %+v should be able to cast to a structured deployment", webhook)) | ||
|
||
//ExpectWithOffset(1, structuredDeployment.Spec.Template.ObjectMeta.Annotations).To(BeEmpty(), fmt.Sprintf("No annotations should be present on deployment %+v", structuredDeployment)) |
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.
still need this line?
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.
nope, deleted
Co-authored-by: Jenny Shu <[email protected]>
Description
Split the ValidatingWebhookConfiguration into 2 webhooks to allow different FailurePolicies for gloo and non-gloo resources.
Code changes
None - changes are Helm, tests, and docs
CI changes
Added
ValidationSplitWebhook
tests toTestValidationStrict
testsDocs changes
Context
Having changes to kubernetes core objects such as secrets and namespaces go through the Gloo Service's validating webhook can prevent changes unrelated to any gloo configuration from being applied if the FailurePolicy is
Fail
. By splitting the webhooks and allowing different FailurePolicies to be set, this can be avoided.Testing steps
Fail
and kubes FailurePolicy ofIgnore
Ignore
and the kube webhook failurePolicy toFail
Checklist: