-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: melserngawy <melserng@redhat.com>
- Loading branch information
Showing
2 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package v1alpha1 | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +k8s:deepcopy-gen=true | ||
|
||
// RolloutStrategy API used by consumer workload applier APIs such as ManifestWorkReplicaSet, Policy, ManagedClusterAddon ...etc | ||
// to define how the workload will be applied to the selected clusters. For more information check the placementStrategy | ||
// proposal at https://github.com/open-cluster-management-io/enhancements/tree/main/enhancements/sig-architecture/64-placementStrategy | ||
|
||
// Rollout strategy to be used by workload applier controller. | ||
type RolloutStrategy struct { | ||
// Rollout strategy Types are All, Progressive and ProgressivePerGroup | ||
// 1) All means apply the workload to all clusters in the decision groups at once. | ||
// 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach the successful state or timeout. | ||
// 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload will not be applied to the next decisionGroup unless all clusters in the current group reach the successful state or timeout. | ||
// +kubebuilder:default:=All | ||
// +optional | ||
Type RolloutStrategyType `json:"type,omitempty"` | ||
|
||
// All RolloutStrategyType | ||
// +optional | ||
All *RolloutAll `json:"all,omitempty"` | ||
|
||
// Progressive RolloutStrategyType | ||
// +optional | ||
Progressive *RolloutProgressive `json:"progressive,omitempty"` | ||
|
||
// ProgressivePerGroup RolloutStrategyType | ||
// +optional | ||
ProgressivePerGroup *RolloutProgressivePerGroup `json:"progressivePerGroup,omitempty"` | ||
} | ||
|
||
// RolloutStrategy Types | ||
type RolloutStrategyType string | ||
|
||
const ( | ||
//All means apply the workload to all clusters in the decision groups at once. | ||
All RolloutStrategyType = "All" | ||
//Progressive means apply the workload to the selected clusters progressively per cluster. | ||
Progressive RolloutStrategyType = "Progressive" | ||
//ProgressivePerGroup means apply the workload to the selected clusters progressively per group. | ||
ProgressivePerGroup RolloutStrategyType = "ProgressivePerGroup" | ||
) | ||
|
||
// RolloutAll is RolloutStrategyType | ||
type RolloutAll struct { | ||
// Timeout define how long workload applier controller will wait till workload reach successful state in the cluster. Only considered for Rollout Type Progressive and ProgressivePerGroup. | ||
// Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. | ||
// Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s | ||
// +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" | ||
// +kubebuilder:default:=None | ||
// +optional | ||
Timeout string `json:"timeout,omitempty"` | ||
} | ||
|
||
// RolloutProgressivePerGroup is RolloutStrategyType | ||
type RolloutProgressivePerGroup struct { | ||
// List of the decision groups names or indexes to apply the workload first and fail if workload did not reach successful ((not proceed to apply workload to other decision groups/clusters). | ||
// +optional | ||
MandatoryDecisionGroups []MandatoryDecisionGroup `json:"mandatoryDecisionGroups,omitempty"` | ||
|
||
// Timeout define how long workload applier controller will wait till workload reach successful state in the cluster. Only considered for Rollout Type Progressive and ProgressivePerGroup. | ||
// Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. | ||
// Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s | ||
// +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" | ||
// +kubebuilder:default:=None | ||
// +optional | ||
Timeout string `json:"timeout,omitempty"` | ||
} | ||
|
||
// RolloutProgressive is RolloutStrategyType | ||
type RolloutProgressive struct { | ||
// List of the decision groups names or indexes to apply the workload first and fail if workload did not reach successful ((not proceed to apply workload to other decision groups/clusters). | ||
// +optional | ||
MandatoryDecisionGroups []MandatoryDecisionGroup `json:"mandatoryDecisionGroups,omitempty"` | ||
|
||
// Timeout define how long workload applier controller will wait till workload reach successful state in the cluster. Only considered for Rollout Type Progressive and ProgressivePerGroup. | ||
// Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. | ||
// Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s | ||
// +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" | ||
// +kubebuilder:default:=None | ||
// +optional | ||
Timeout string `json:"timeout,omitempty"` | ||
|
||
// MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the placement->DecisionStrategy. | ||
// +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" | ||
// +optional | ||
MaxConcurrency string `json:"maxConcurrency,omitempty"` | ||
} | ||
|
||
// MandatoryDecisionGroup set the decision group name and group index. | ||
type MandatoryDecisionGroup struct { | ||
// GroupName of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-name | ||
// +optional | ||
GroupName string `json:"groupName,omitempty"` | ||
|
||
// GroupIndex of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-index | ||
// +optional | ||
GroupIndex int32 `json:"groupIndex,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.