-
Notifications
You must be signed in to change notification settings - Fork 1
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
🌱 [WIP] Runtimesdk/validate handlers on discovery #28
🌱 [WIP] Runtimesdk/validate handlers on discovery #28
Conversation
* Implemnent extensions api types, manifests and webhook Signed-off-by: killianmuldoon <[email protected]> * cleanup and nits
Signed-off-by: killianmuldoon <[email protected]>
Signed-off-by: killianmuldoon <[email protected]>
Signed-off-by: Stefan Büringer [email protected]
Signed-off-by: Stefan Büringer [email protected]
* Add client discovery calls to extension controller Signed-off-by: killianmuldoon <[email protected]> * update discovery flow Signed-off-by: killianmuldoon <[email protected]>
Signed-off-by: killianmuldoon <[email protected]> Co-authored-by: killianmuldoon <[email protected]>
Signed-off-by: killianmuldoon <[email protected]>
@@ -197,14 +200,59 @@ func (r Reconciler) discoverExtension(ctx context.Context, extension *runtimev1. | |||
// if any of these checks fails the response is invalid and an error is returned. Extensions with previously valid | |||
// RuntimeExtension registrations are not removed from the registry or the object's status. | |||
func validateRuntimeExtensionDiscovery(ext *runtimev1.Extension) error { | |||
names := make(map[string]bool) | |||
var errs []error | |||
// TODO: Implement the same validation rules in the runtime SDK server side Discovery handler. | |||
for _, runtimeExtension := range ext.Status.RuntimeExtensions { |
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.
How about also adding a validation rule to make sure that the hook is valid?
} | ||
|
||
// Timeout should be a positive integer and should be under 600 seconds (10 minutes) | ||
if *runtimeExtension.TimeoutSeconds < 0 && *runtimeExtension.TimeoutSeconds > 600 { |
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.
10 minutes for maximum timeout seems too long. The admission webhooks in k8s allow a maximum timeout of 30s.
How about using the same for our maximum as well?
// FIXME: How should we handle timeout is nil or zero? | ||
// If TimeoutSeconds is not defined set to zero. | ||
if runtimeExtension.TimeoutSeconds == nil { | ||
runtimeExtension.TimeoutSeconds = pointer.Int32(0) |
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.
A 0s timeout means if the user does not set a timeout the network call will always timeout. The admission webhooks in k8s default to a timeout of 10s. We should also probably use the same timeout as default.
768739f
to
9209b50
Compare
Closing in favor of #kubernetes-sigs#6578 |
Signed-off-by: killianmuldoon [email protected]
Add first round of validation rules on discovery of extensions in the extension controller.