@@ -25,7 +25,11 @@ type CustomResourceDefinitionSpec struct {
2525 // Group is the group this resource belongs in
2626 Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
2727 // Version is the version this resource belongs in
28- Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
28+ // Should be always first item in Versions field if provided.
29+ // Optional, but at least one of Version or Versions must be set.
30+ // Deprecated: Please use `Versions`.
31+ // +optional
32+ Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"`
2933 // Names are the names used to describe this custom resource
3034 Names CustomResourceDefinitionNames `json:"names" protobuf:"bytes,3,opt,name=names"`
3135 // Scope indicates whether this resource is cluster or namespace scoped. Default is namespaced
@@ -36,6 +40,27 @@ type CustomResourceDefinitionSpec struct {
3640 // Subresources describes the subresources for CustomResources
3741 // +optional
3842 Subresources * CustomResourceSubresources `json:"subresources,omitempty" protobuf:"bytes,6,opt,name=subresources"`
43+ // Versions is the list of all supported versions for this resource.
44+ // If Version field is provided, this field is optional.
45+ // Validation: All versions must use the same validation schema for now. i.e., top
46+ // level Validation field is applied to all of these versions.
47+ // Order: The version name will be used to compute the order.
48+ // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered
49+ // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version),
50+ // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first
51+ // by GA > beta > alpha, and then by comparing major version, then minor version. An example sorted list of
52+ // versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.
53+ Versions []CustomResourceDefinitionVersion `json:"versions,omitempty" protobuf:"bytes,7,rep,name=versions"`
54+ }
55+
56+ type CustomResourceDefinitionVersion struct {
57+ // Name is the version name, e.g. “v1”, “v2beta1”, etc.
58+ Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
59+ // Served is a flag enabling/disabling this version from being served via REST APIs
60+ Served bool `json:"served" protobuf:"varint,2,opt,name=served"`
61+ // Storage flags the version as storage version. There must be exactly one
62+ // flagged as storage version.
63+ Storage bool `json:"storage" protobuf:"varint,3,opt,name=storage"`
3964}
4065
4166// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
@@ -117,6 +142,14 @@ type CustomResourceDefinitionStatus struct {
117142 // AcceptedNames are the names that are actually being used to serve discovery
118143 // They may be different than the names in spec.
119144 AcceptedNames CustomResourceDefinitionNames `json:"acceptedNames" protobuf:"bytes,2,opt,name=acceptedNames"`
145+
146+ // StoredVersions are all versions of CustomResources that were ever persisted. Tracking these
147+ // versions allows a migration path for stored versions in etcd. The field is mutable
148+ // so the migration controller can first finish a migration to another version (i.e.
149+ // that no old objects are left in the storage), and then remove the rest of the
150+ // versions from this list.
151+ // None of the versions in this list can be removed from the spec.Versions field.
152+ StoredVersions []string `protobuf:"bytes,3,rep,name=storedVersions"`
120153}
121154
122155// CustomResourceCleanupFinalizer is the name of the finalizer which will delete instances of
0 commit comments