Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Zhiying Lin <[email protected]>
  • Loading branch information
ryanzhang-oss and zhiying-lin authored Sep 10, 2024
1 parent eea1ae9 commit b4e840f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions apis/placement/v1alpha1/stagedupdate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type StageConfig struct {
// for this stage. There cannot be overlapping clusters between stages when the stagedUpdateRun is created.
// If the label selector is absent, the stage includes all the selected clusters.
// +kubebuilder:validation:Optional
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

// The label key used to sort the selected clusters.
// The clusters within the stage are updated sequentially following the rule below:
Expand Down Expand Up @@ -156,21 +156,21 @@ type StagedUpdateRunStatus struct {
// All clusters involved in the update run are selected from the list of clusters scheduled by the CRP according
// to the current policy.
// +kubebuilder:validation:Optional
PolicySnapShotIndexUsed string `json:"PolicySnapShotIndexUsed"`
PolicySnapshotIndexUsed string `json:"policySnapshotIndexUsed,omitempty"`

// ApplyStrategy is the apply strategy that the stagedUpdateRun is using.
// It is the same as the apply strategy in the CRP when we first start the staged update run.
// We will NOT update the apply strategy during the update run even if the apply strategy changes in the CRP.
// +kubebuilder:validation:Optional
ApplyStrategy v1beta1.ApplyStrategy `json:"appliedStrategy"`
ApplyStrategy v1beta1.ApplyStrategy `json:"appliedStrategy,omitempty"`

// StagedUpdateStrategySnapshot is the snapshot of the StagedUpdateStrategy that we are going to use for the update run.
// The snapshot is immutable during the update run.
// We will apply the strategy to the the list of clusters scheduled by the CRP according to the current policy.
// The update run will fail to initialize if the strategy fails to produce a valid list of stages in which each selected
// cluster is included in exactly one stage.
// +kubebuilder:validation:Optional
StagedUpdateStrategySnapshot StagedUpdateStrategySpec `json:"StagedUpdateStrategySnapshot"`
StagedUpdateStrategySnapshot StagedUpdateStrategySpec `json:"stagedUpdateStrategySnapshot,omitempty"`

// Stages list the current status of each stage.
// The list is empty if the update run is not started or failed to initialize.
Expand All @@ -197,7 +197,7 @@ type StagedUpdateRunStatus struct {
// Conditions is an array of current observed conditions for StagedUpdateRun.
// Known conditions are "Initialized", "Running", "WaitingBetweenStage", "Completed".
// +kubebuilder:validation:Optional
Conditions []metav1.Condition `json:"conditions"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// StageStatus defines the status of the update run in a stage.
Expand All @@ -217,7 +217,7 @@ type StageStatus struct {
// The status of the post update tasks that are associated with current stage.
// +kubebuilder:validation:MaxItems=2
// +kubebuilder:validation:Optional
AfterStageTaskStatus []AfterStageTaskStatus `json:"currentPostStageTaskStatus,omitempty"`
AfterStageTaskStatus []AfterStageTaskStatus `json:"afterStageTaskStatus ,omitempty"`
}

// ClusterUpdateStatus defines the status of the update run on a cluster.
Expand Down Expand Up @@ -315,7 +315,7 @@ type AfterStageTaskStatus struct {
// Conditions is an array of current observed conditions for the specific type of post update task.
// Known conditions are "ApprovalRequestCreated", "WaitTimeElapsed", and "ApprovalRequestApproved".
// +kubebuilder:validation:Optional
Conditions []metav1.Condition `json:"conditions"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// AfterStageTaskType identifies a specific type of the AfterStageTask.
Expand Down Expand Up @@ -419,7 +419,7 @@ type StageApprovalRequest struct {

// The desired state of StageApprovalRequest.
// +kubebuilder:validation:Optional
Status StageApprovalRequestStatus `json:"status"`
Status StageApprovalRequestStatus `json:"status,omitempty"`
}

// StageApprovalRequestSpec defines the desired the update approval request.
Expand All @@ -444,7 +444,7 @@ type StageApprovalRequestStatus struct {
// Conditions is an array of current observed conditions for the specific type of post update task.
// Known conditions are "Approved", and "ApprovalAccepted".
// +kubebuilder:validation:Optional
Conditions []metav1.Condition `json:"conditions"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// StageApprovalRequestConditionType identifies a specific condition of the StageApprovalRequest.
Expand Down

0 comments on commit b4e840f

Please sign in to comment.