Skip to content
Closed
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
26 changes: 26 additions & 0 deletions apis/placement/v1beta1/clusterresourceplacement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ type PlacementSpec struct {
// +kubebuilder:validation:Optional
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

// ResourceSnapshotCreationPolicy controls when resource snapshots are created.
// +kubebuilder:validation:Enum=Automatic;OnDemand
// +kubebuilder:default=Automatic
// +kubebuilder:validation:Optional
ResourceSnapshotCreationPolicy ResourceSnapshotCreationPolicyType `json:"resourceSnapshotCreationPolicy,omitempty"`

// StatusReportingScope controls where ClusterResourcePlacement status information is made available.
// When set to "ClusterScopeOnly", status is accessible only through the cluster-scoped ClusterResourcePlacement object.
// When set to "NamespaceAccessible", a ClusterResourcePlacementStatus object is created in the target namespace,
Expand All @@ -164,6 +170,16 @@ type PlacementSpec struct {
StatusReportingScope StatusReportingScope `json:"statusReportingScope,omitempty"`
}

type ResourceSnapshotCreationPolicyType string

const (
// AutomaticSnapshotCreation creates snapshots automatically when resources change.
AutomaticSnapshotCreation ResourceSnapshotCreationPolicyType = "Automatic"

// OnDemandSnapshotCreation creates snapshots on both resource changes and on demand requests.
OnDemandSnapshotCreation ResourceSnapshotCreationPolicyType = "OnDemand"
)

// Tolerations returns tolerations for PlacementSpec to handle nil policy case.
func (p *PlacementSpec) Tolerations() []Toleration {
if p.Policy != nil {
Expand Down Expand Up @@ -529,6 +545,16 @@ type RolloutStrategy struct {
// +kubebuilder:validation:Enum=RollingUpdate;External
Type RolloutStrategyType `json:"type,omitempty"`

// ResourceSnapshotIndex indicates the specific resource snapshot index to be rolled out to the target clusters.
// If not specified, the latest resource snapshot will be used.
// When the specified index does not exist, the behavior depends on the ResourceSnapshotCreationPolicy:
// - For the "Automatic" policy, the rollout will fail with reason ResourceSnapshotNotFound.
// - For the "OnDemand" policy, a new resource snapshot will be created using the current index if
// it is greater than the latest resourceSnapshot index.
// This field is only valid when RolloutStrategyType = RollingUpdate.
// +kubebuilder:validation:Optional
ResourceSnapshotIndex *string `json:"resourceSnapshotIndex,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the ResourceSnapshotCreationPolicyType is ondemand? How would a user trigger a snapshot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when cx wants to cut the release, they update this field to trigger the snapshot creation.


// Rolling update config params. Present only if RolloutStrategyType = RollingUpdate.
// +kubebuilder:validation:Optional
RollingUpdate *RollingUpdateConfig `json:"rollingUpdate,omitempty"`
Expand Down
Loading