mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
CRD v1: drop spec.scope default
This commit is contained in:
parent
27360db1da
commit
05d8b448d2
@ -40,9 +40,6 @@ func SetDefaults_CustomResourceDefinition(obj *CustomResourceDefinition) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetDefaults_CustomResourceDefinitionSpec(obj *CustomResourceDefinitionSpec) {
|
func SetDefaults_CustomResourceDefinitionSpec(obj *CustomResourceDefinitionSpec) {
|
||||||
if len(obj.Scope) == 0 {
|
|
||||||
obj.Scope = NamespaceScoped
|
|
||||||
}
|
|
||||||
if len(obj.Names.Singular) == 0 {
|
if len(obj.Names.Singular) == 0 {
|
||||||
obj.Names.Singular = strings.ToLower(obj.Names.Kind)
|
obj.Names.Singular = strings.ToLower(obj.Names.Kind)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ func TestDefaults(t *testing.T) {
|
|||||||
original: &CustomResourceDefinition{},
|
original: &CustomResourceDefinition{},
|
||||||
expected: &CustomResourceDefinition{
|
expected: &CustomResourceDefinition{
|
||||||
Spec: CustomResourceDefinitionSpec{
|
Spec: CustomResourceDefinitionSpec{
|
||||||
Scope: NamespaceScoped,
|
|
||||||
Conversion: &CustomResourceConversion{Strategy: NoneConverter},
|
Conversion: &CustomResourceConversion{Strategy: NoneConverter},
|
||||||
PreserveUnknownFields: utilpointer.BoolPtr(true),
|
PreserveUnknownFields: utilpointer.BoolPtr(true),
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,7 @@ type CustomResourceDefinitionSpec struct {
|
|||||||
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
|
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
|
||||||
// Names are the names used to describe this custom resource
|
// Names are the names used to describe this custom resource
|
||||||
Names CustomResourceDefinitionNames `json:"names" protobuf:"bytes,3,opt,name=names"`
|
Names CustomResourceDefinitionNames `json:"names" protobuf:"bytes,3,opt,name=names"`
|
||||||
// Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced
|
// Scope indicates whether this resource is cluster or namespace scoped.
|
||||||
Scope ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"`
|
Scope ResourceScope `json:"scope" protobuf:"bytes,4,opt,name=scope,casttype=ResourceScope"`
|
||||||
// Versions is the list of all supported versions for this resource.
|
// Versions is the list of all supported versions for this resource.
|
||||||
// Order: The version name will be used to compute the order.
|
// Order: The version name will be used to compute the order.
|
||||||
|
Loading…
Reference in New Issue
Block a user