Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1/clusterobjectdeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ type ClusterObjectDeployment struct {
metav1.TypeMeta `json:",inline"`

// metadata is the standard object's metadata. Names are valid COS groups of at
// most 52 characters; generated child names also include an int64 revision suffix.
// most 52 characters; child names also include a hyphen and up to ten revision digits.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

Expand Down
14 changes: 12 additions & 2 deletions api/v1/clusterobjectset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import (
const (
ClusterObjectSetKind = "ClusterObjectSet"

// ClusterObjectSetMaxRevision is the largest revision whose canonical name fits
// in a 63-character label value with a 52-character group and a separating hyphen.
// Keep the revision validation maximum below in sync with this value.
ClusterObjectSetMaxRevision int64 = 9999999999

// Condition Types
ClusterObjectSetTypeReady = "Ready"

Expand Down Expand Up @@ -75,11 +80,12 @@ type ClusterObjectSetSpec struct {
// revision is a required, immutable sequence number identifying a specific
// ClusterObjectSet within a sequence of related revisions.
//
// The revision field must be a positive integer.
// Each ClusterObjectSet in the same revision sequence must have a unique revision number.
// The revision field must be an integer from 1 to 9999999999, inclusive.
// Each ClusterObjectSet in the same group must have a unique revision number.
//
// +required
// +kubebuilder:validation:Minimum:=1
// +kubebuilder:validation:Maximum:=9999999999
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="revision is immutable"
Revision int64 `json:"revision"`

Expand Down Expand Up @@ -627,6 +633,7 @@ type ObjectCounts struct {
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:subresource:status
// +kubebuilder:validation:XValidation:rule="self.metadata.name == '%s-%d'.format([self.spec.group, self.spec.revision])",message="metadata.name must be <spec.group>-<spec.revision>"
// +kubebuilder:selectablefield:JSONPath=`.spec.group`
// +kubebuilder:printcolumn:name="Group",type=string,JSONPath=`.spec.group`
// +kubebuilder:printcolumn:name="Revision",type=integer,JSONPath=`.spec.revision`
Expand All @@ -644,6 +651,9 @@ type ObjectCounts struct {
// single revision at a time. Ownership of objects is transitioned from one revision
// to the next as new revisions are rolled out. Once the latest revision has rolled
// out successfully, previous active revisions are archived for posterity.
// Set metadata.name explicitly to <spec.group>-<spec.revision>, using decimal
// notation without leading zeros. This ensures revision uniqueness within a group.
// Name generation through metadata.generateName is not supported.
type ClusterObjectSet struct {
metav1.TypeMeta `json:",inline"`

Expand Down
Loading
Loading