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
Validation for CRD custom resources: feature gate promotion alpha->beta #54647
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ type CustomResourceDefinitionSpec struct { | |
// Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced | ||
Scope ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"` | ||
// Validation describes the validation methods for CustomResources | ||
// This field is alpha-level and should only be sent to servers that enable the CustomResourceValidation feature. | ||
// +optional | ||
Validation *CustomResourceValidation `json:"validation,omitempty" protobuf:"bytes,5,opt,name=validation"` | ||
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. Was this cleared before storage if the flag was off? If not, you have a bunch of clusters out there with time-bombs. 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. To check my understanding, this is a time-bomb if someone has submitted resources with validation enabled, but without having the feature actually enabled? Hence if we activate it by default in 1.8, they could have custom resources in the API that do not actually validate? If that understanding is not correct then I'm not sure I'm groking the problem. I can investigate whether or not the field was being cleared. If it weren't being cleared, what are our options for moving forward and/or minimizing breakage short of changing the field name? 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.
Yes, it was cleared if the feature was disabled. https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresourcedefinition/strategy.go#L57 |
||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -29,6 +29,7 @@ const ( | |||||||||||||||
|
||||||||||||||||
// owner: @sttts, @nikhita | ||||||||||||||||
// alpha: v1.8 | ||||||||||||||||
// beta: v1.9 | ||||||||||||||||
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. not sure of the expected/desired syntax here; let me know what's appropriate. 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. seems right as per: kubernetes/staging/src/k8s.io/apiserver/pkg/features/kube_features.go Lines 59 to 65 in 7914aed
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. 👍 |
||||||||||||||||
// | ||||||||||||||||
// CustomResourceValidation is a list of validation methods for CustomResources | ||||||||||||||||
CustomResourceValidation utilfeature.Feature = "CustomResourceValidation" | ||||||||||||||||
|
@@ -42,5 +43,5 @@ func init() { | |||||||||||||||
// To add a new feature, define a key for it above and add it here. The features will be | ||||||||||||||||
// available throughout Kubernetes binaries. | ||||||||||||||||
var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureSpec{ | ||||||||||||||||
CustomResourceValidation: {Default: false, PreRelease: utilfeature.Alpha}, | ||||||||||||||||
CustomResourceValidation: {Default: true, PreRelease: utilfeature.Beta}, | ||||||||||||||||
} |
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.
This needs update in the generated proto file too:
kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/generated.proto
Lines 107 to 111 in 4eadfbb
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