-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add RuntimeClassName feature flag #9072
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,13 @@ func withPodSpecTolerationsEnabled() configOption { | |
| } | ||
| } | ||
|
|
||
| func withPodSpecRuntimeClassNameEnabled() configOption { | ||
| return func(cfg *config.Config) *config.Config { | ||
| cfg.Features.PodSpecRuntimeClassName = config.Enabled | ||
| return cfg | ||
| } | ||
| } | ||
|
|
||
| func withPodSpecSecurityContextEnabled() configOption { | ||
| return func(cfg *config.Config) *config.Config { | ||
| cfg.Features.PodSpecSecurityContext = config.Enabled | ||
|
|
@@ -543,6 +550,8 @@ func TestPodSpecMultiContainerValidation(t *testing.T) { | |
| } | ||
|
|
||
| func TestPodSpecFeatureValidation(t *testing.T) { | ||
| runtimeClassName := "test" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume there is no good way to validate the values passed (besides podspec dry run?), since it varies so much vendor to vendor...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose the controller could validate that the RuntimeClass with that name exists and add to the knative service's status and emit an event if it doesn't. Currently the controller will fail to create pods and users will see that the service didn't create and see the detailed reason in events already so I'm not sure it would be a much better UX. |
||
|
|
||
| featureData := []struct { | ||
| name string | ||
| featureSpec corev1.PodSpec | ||
|
|
@@ -597,6 +606,16 @@ func TestPodSpecFeatureValidation(t *testing.T) { | |
| Paths: []string{"tolerations"}, | ||
| }, | ||
| cfgOpts: []configOption{withPodSpecTolerationsEnabled()}, | ||
| }, { | ||
| name: "RuntimeClassName", | ||
| featureSpec: corev1.PodSpec{ | ||
| RuntimeClassName: &runtimeClassName, | ||
| }, | ||
| err: &apis.FieldError{ | ||
| Message: "must not set the field(s)", | ||
| Paths: []string{"runtimeClassName"}, | ||
| }, | ||
| cfgOpts: []configOption{withPodSpecRuntimeClassNameEnabled()}, | ||
| }, { | ||
| name: "PodSpecSecurityContext", | ||
| featureSpec: corev1.PodSpec{ | ||
|
|
||
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.
worth adding a test for this, along same lines as the one for PodSpecTolerations?
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.
Done