Skip to content

Commit

Permalink
addon consume rollout helpers
Browse files Browse the repository at this point in the history
Signed-off-by: haoqing0110 <[email protected]>
  • Loading branch information
haoqing0110 committed Aug 8, 2023
1 parent 3167826 commit 332756d
Show file tree
Hide file tree
Showing 23 changed files with 1,156 additions and 561 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module open-cluster-management.io/ocm

go 1.20

replace open-cluster-management.io/api => github.com/haoqing0110/api v0.0.0-20230808080354-ce04005499dc

require (
github.com/davecgh/go-spew v1.1.1
github.com/evanphx/json-patch v5.6.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/haoqing0110/api v0.0.0-20230808080354-ce04005499dc h1:YhuNlj9XKKXgPnOm21xerR5pBrWA1WOlXgTqpBIqW8c=
github.com/haoqing0110/api v0.0.0-20230808080354-ce04005499dc/go.mod h1:UQgibMAHcj0fVOcwznPqhwRBstGr3029Vg597pzpS68=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -1158,8 +1160,6 @@ k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 h1:xMMXJlJbsU8w3V5N2FLDQ8YgU8s1E
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/addon-framework v0.7.1-0.20230803002113-eea76f8f5ad7 h1:GozqvUtekO4Zg90wLih3CA/ZYKLJlGKX+vL990U8DoQ=
open-cluster-management.io/addon-framework v0.7.1-0.20230803002113-eea76f8f5ad7/go.mod h1:gLGpXkdwAzzV+JB5eQPNHbZFJwp7HsKSSwgqOxGNVCw=
open-cluster-management.io/api v0.11.1-0.20230801071340-86e3c7b4d5da h1:FYPgmKeQYhT77QGcml/rAzD1+Bi1crY/siQW1qhVzlg=
open-cluster-management.io/api v0.11.1-0.20230801071340-86e3c7b4d5da/go.mod h1:WgKUCJ7+Bf40DsOmH1Gdkpyj3joco+QLzrlM6Ak39zE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,108 +139,139 @@ spec:
type: string
rolloutStrategy:
default:
type: UpdateAll
type: All
description: The rollout strategy to apply addon configurations
change. The rollout strategy only watches the addon configurations
defined in ClusterManagementAddOn.
properties:
rollingUpdate:
description: Rolling update with placement config params.
Present only if the type is RollingUpdate.
all:
description: All define required fields for RolloutStrategy
type All
properties:
maxConcurrency:
anyOf:
- type: integer
- type: string
default: 25%
description: 'The maximum concurrently updating
number of clusters. Value can be an absolute number
(ex: 5) or a percentage of desired addons (ex:
10%). Absolute number is calculated from percentage
by rounding up. Defaults to 25%. Example: when
this is set to 30%, once the addon configs change,
the addon on 30% of the selected clusters will
adopt the new configs. When the addons with new
configs are healthy, the addon on the remaining
clusters will be further updated.'
x-kubernetes-int-or-string: true
timeout:
default: None
description: Timeout define how long workload applier
controller will wait till workload reach successful
state in the cluster. 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
pattern: ^(([0-9])+[h|m|s])|None$
type: string
type: object
rollingUpdateWithCanary:
description: Rolling update with placement config params.
Present only if the type is RollingUpdateWithCanary.
progressive:
description: Progressive define required fields for
RolloutStrategy type Progressive
properties:
mandatoryDecisionGroups:
description: List of the decision groups names or
indexes to apply the workload first and fail if
workload did not reach successful state. GroupName
or GroupIndex must match with the decisionGroups
defined in the placement's decisionStrategy
items:
description: MandatoryDecisionGroup set the decision
group name or group index. GroupName is considered
first to select the decisionGroups then GroupIndex.
properties:
groupIndex:
description: GroupIndex of the decision group
should match the placementDecisions label
value with label key cluster.open-cluster-management.io/decision-group-index
format: int32
type: integer
groupName:
description: GroupName of the decision group
should match the placementDecisions label
value with label key cluster.open-cluster-management.io/decision-group-name
type: string
type: object
type: array
maxConcurrency:
anyOf:
- type: integer
- type: string
default: 25%
description: 'The maximum concurrently updating
number of clusters. Value can be an absolute number
(ex: 5) or a percentage of desired addons (ex:
10%). Absolute number is calculated from percentage
by rounding up. Defaults to 25%. Example: when
this is set to 30%, once the addon configs change,
the addon on 30% of the selected clusters will
adopt the new configs. When the addons with new
configs are healthy, the addon on the remaining
clusters will be further updated.'
description: 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.
pattern: ^((100|[0-9]{1,2})%|[0-9]+)$
x-kubernetes-int-or-string: true
placement:
description: Canary placement reference.
properties:
name:
description: Name is the name of the placement
minLength: 1
type: string
namespace:
description: Namespace is the namespace of the
placement
minLength: 1
type: string
required:
- name
- namespace
type: object
required:
- placement
timeout:
default: None
description: Timeout define how long workload applier
controller will wait till workload reach successful
state in the cluster. 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
pattern: ^(([0-9])+[h|m|s])|None$
type: string
type: object
progressivePerGroup:
description: ProgressivePerGroup define required fields
for RolloutStrategy type ProgressivePerGroup
properties:
mandatoryDecisionGroups:
description: List of the decision groups names or
indexes to apply the workload first and fail if
workload did not reach successful state. GroupName
or GroupIndex must match with the decisionGroups
defined in the placement's decisionStrategy
items:
description: MandatoryDecisionGroup set the decision
group name or group index. GroupName is considered
first to select the decisionGroups then GroupIndex.
properties:
groupIndex:
description: GroupIndex of the decision group
should match the placementDecisions label
value with label key cluster.open-cluster-management.io/decision-group-index
format: int32
type: integer
groupName:
description: GroupName of the decision group
should match the placementDecisions label
value with label key cluster.open-cluster-management.io/decision-group-name
type: string
type: object
type: array
timeout:
default: None
description: Timeout define how long workload applier
controller will wait till workload reach successful
state in the cluster. 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
pattern: ^(([0-9])+[h|m|s])|None$
type: string
type: object
type:
default: UpdateAll
description: "Type is the type of the rollout strategy,
it supports UpdateAll, RollingUpdate and RollingUpdateWithCanary:
- UpdateAll: when configs change, apply the new configs
to all the selected clusters at once. This is the
default strategy. - RollingUpdate: when configs change,
apply the new configs to all the selected clusters
with the concurrence rate defined in MaxConcurrency.
- RollingUpdateWithCanary: when configs change, wait
and check if add-ons on the canary placement selected
clusters have applied the new configs and are healthy,
then apply the new configs to all the selected clusters
with the concurrence rate defined in MaxConcurrency.
\n The field lastKnownGoodConfig in the status record
the last successfully applied spec hash of canary
placement. If the config spec hash changes after the
canary is passed and before the rollout is done, the
current rollout will continue, then roll out to the
latest change. \n For example, the addon configs have
spec hash A. The canary is passed and the lastKnownGoodConfig
would be A, and all the selected clusters are rolling
out to A. Then the config spec hash changes to B.
At this time, the clusters will continue rolling out
to A. When the rollout is done and canary passed B,
the lastKnownGoodConfig would be B and all the clusters
will start rolling out to B. \n The canary placement
does not have to be a subset of the install placement,
and it is more like a reference for finding and checking
canary clusters before upgrading all. To trigger the
rollout on the canary clusters, you can define another
rollout strategy with the type RollingUpdate, or even
manually upgrade the addons on those clusters."
default: All
description: 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.
enum:
- UpdateAll
- RollingUpdate
- RollingUpdateWithCanary
- All
- Progressive
- ProgressivePerGroup
type: string
type: object
required:
Expand Down
Loading

0 comments on commit 332756d

Please sign in to comment.