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
26 changes: 2 additions & 24 deletions apis/v1/clusterresourceplacement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
// Note that you can't select the following resources:
// - reserved namespaces including: default, kube-* (reserved for Kubernetes system namespaces), fleet-* (reserved for fleet system namespaces).
// - reserved fleet resource types including: MemberCluster, InternalMemberCluster, ClusterResourcePlacement, MultiClusterService, ServiceImport, etc.
// The `ClusterResourceBinding` will be created and it represents a scheduling decision that binds a group of resources
// to a cluster.
type ClusterResourcePlacement struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down Expand Up @@ -109,11 +111,6 @@ type PlacementPolicy struct {
// +optional
NumberOfClusters *int32 `json:"numberOfClusters,omitempty"`

// The rollout strategy to use to replace existing applications with new ones.
// +optional
// +patchStrategy=retainKeys
Strategy *RolloutStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" patchMergeKey:"type"`

// Affinity contains cluster affinity scheduling rules. Defines which member clusters to place the selected resources.
// +optional
Affinity *Affinity `json:"affinity,omitempty"`
Expand Down Expand Up @@ -322,25 +319,6 @@ const (
PickNPlacementType PlacementType = "PickN"
)

// RolloutStrategy describes how to replace existing application with new ones.
type RolloutStrategy struct {
// Type of rollout strategy. Can be "Recreate" or "OnDelete". Default is "Recreate".
// +optional
Type RolloutStrategyType `json:"type,omitempty"`
}

// RolloutStrategyType identifies the type of strategy we use to roll out new resources.
// +enum
type RolloutStrategyType string

const (
// RecreateRolloutStrategyType removes all existing resources from the clusters before creating new ones.
RecreateRolloutStrategyType RolloutStrategyType = "Recreate"

// OnDeleteRolloutStrategy schedules a new resource binding only after an old binding is deleted.
OnDeleteRolloutStrategy RolloutStrategyType = "OnDelete"
)

// ClusterResourcePlacementList contains a list of ClusterResourcePlacement.
// +kubebuilder:resource:scope="Cluster"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
36 changes: 18 additions & 18 deletions apis/v1/policysnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ type ClusterPolicySnapshot struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// The desired state of PolicySnapShot.
// The desired state of PolicySnapshot.
// +required
Spec PolicySnapShotSpec `json:"spec"`
Spec PolicySnapshotSpec `json:"spec"`

// The observed status of PolicySnapShot.
// The observed status of PolicySnapshot.
// +optional
Status PolicySnapShotStatus `json:"status,omitempty"`
Status PolicySnapshotStatus `json:"status,omitempty"`
}

// PolicySnapShotSpec defines the desired state of PolicySnapShot.
type PolicySnapShotSpec struct {
// PolicySnapshotSpec defines the desired state of PolicySnapshot.
type PolicySnapshotSpec struct {
// Policy defines how to select member clusters to place the selected resources.
// If unspecified, all the joined member clusters are selected.
// +optional
Expand All @@ -60,14 +60,14 @@ type PolicySnapShotSpec struct {
PolicyHash []byte `json:"policyHash"`
}

// PolicySnapShotStatus defines the observed state of PolicySnapShot.
type PolicySnapShotStatus struct {
// PolicySnapshotStatus defines the observed state of PolicySnapshot.
type PolicySnapshotStatus struct {
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type

// Conditions is an array of current observed conditions for PolicySnapShot.
// Conditions is an array of current observed conditions for PolicySnapshot.
// +optional
Conditions []metav1.Condition `json:"conditions"`

Expand All @@ -79,16 +79,16 @@ type PolicySnapShotStatus struct {
ClusterDecisions []ClusterDecision `json:"targetClusters,omitempty"`
}

// PolicySnapShotConditionType identifies a specific condition of the PolicySnapShot.
type PolicySnapShotConditionType string
// PolicySnapshotConditionType identifies a specific condition of the PolicySnapshot.
type PolicySnapshotConditionType string

const (
// Scheduled indicates the scheduled condition of the given policySnapShot.
// Scheduled indicates the scheduled condition of the given policySnapshot.
// Its condition status can be one of the following:
// - "True" means the corresponding policySnapShot is fully scheduled.
// - "False" means the corresponding policySnapShot is not scheduled yet.
// - "True" means the corresponding policySnapshot is fully scheduled.
// - "False" means the corresponding policySnapshot is not scheduled yet.
// - "Unknown" means this policy does not have a full schedule yet.
PolicySnapshotScheduled PolicySnapShotConditionType = "Scheduled"
PolicySnapshotScheduled PolicySnapshotConditionType = "Scheduled"
)

// ClusterDecision represents a decision from a placement
Expand Down Expand Up @@ -128,10 +128,10 @@ type ClusterScore struct {
TopologySpreadScore *int32 `json:"priorityScore,omitempty"`
}

// ClusterPolicySnapShotList contains a list of ClusterPolicySnapShot.
// ClusterPolicySnapshotList contains a list of ClusterPolicySnapshot.
// +kubebuilder:resource:scope="Cluster"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterPolicySnapShotList struct {
type ClusterPolicySnapshotList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterPolicySnapshot `json:"items"`
Expand All @@ -150,5 +150,5 @@ func (m *ClusterPolicySnapshot) GetCondition(conditionType string) *metav1.Condi
}

func init() {
SchemeBuilder.Register(&ClusterPolicySnapshot{}, &ClusterPolicySnapShotList{})
SchemeBuilder.Register(&ClusterPolicySnapshot{}, &ClusterPolicySnapshotList{})
}
27 changes: 14 additions & 13 deletions apis/v1/resourcesnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,24 @@ type ClusterResourceSnapshot struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// The desired state of ResourceSnapShot.
// The desired state of ResourceSnapshot.
// +required
Spec ResourceSnapShotSpec `json:"spec"`
Spec ResourceSnapshotSpec `json:"spec"`

// The observed status of ResourceSnapShot.
// The observed status of ResourceSnapshot.
// +optional
Status ResourceSnapShotStatus `json:"status,omitempty"`
Status ResourceSnapshotStatus `json:"status,omitempty"`
}

// ResourceSnapShotSpec defines the desired state of ResourceSnapShot.
type ResourceSnapShotSpec struct {
// ResourceSnapshotSpec defines the desired state of ResourceSnapshot.
type ResourceSnapshotSpec struct {
// SelectedResources contains a list of resources selected by ResourceSelectors.
// +required
SelectedResources []ResourceContent `json:"selectedResources"`

// PolicySnapShotName is the name of the policy snapshot that this resource snapshot is pointing to.
PolicySnapShotName string `json:"policySnapShotName"`
// PolicySnapshotName is the name of the policy snapshot that this resource snapshot is pointing to.
// +required
PolicySnapshotName string `json:"policySnapshotName"`
}

// ResourceContent contains the content of a resource
Expand All @@ -78,21 +79,21 @@ type ResourceContent struct {
runtime.RawExtension `json:"-,inline"`
}

type ResourceSnapShotStatus struct {
type ResourceSnapshotStatus struct {
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type

// Conditions is an array of current observed conditions for ResourceSnapShot.
// Conditions is an array of current observed conditions for ResourceSnapshot.
// +optional
Conditions []metav1.Condition `json:"conditions"`
}

// ClusterResourceSnapShotList contains a list of ClusterResourceSnapshot.
// ClusterResourceSnapshotList contains a list of ClusterResourceSnapshot.
// +kubebuilder:resource:scope="Cluster"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterResourceSnapShotList struct {
type ClusterResourceSnapshotList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterResourceSnapshot `json:"items"`
Expand All @@ -111,5 +112,5 @@ func (m *ClusterResourceSnapshot) GetCondition(conditionType string) *metav1.Con
}

func init() {
SchemeBuilder.Register(&ClusterResourceSnapshot{}, &ClusterResourceSnapShotList{})
SchemeBuilder.Register(&ClusterResourceSnapshot{}, &ClusterResourceSnapshotList{})
}
Loading