-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update api for future bluegreen #214
Conversation
0a5cc67
to
c1676b6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #214 +/- ##
==========================================
- Coverage 43.63% 43.41% -0.22%
==========================================
Files 52 52
Lines 5681 5721 +40
==========================================
+ Hits 2479 2484 +5
- Misses 2778 2813 +35
Partials 424 424
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
api/v1beta1/rollout_types.go
Outdated
CanaryReplicas int32 `json:"updatedReplicas"` | ||
// CanaryReadyReplicas the numbers of ready canary revision pods | ||
CanaryReadyReplicas int32 `json:"updatedReadyReplicas"` | ||
// FinalisingStep the step of finalising |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz also change the internal field name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
api/v1beta1/rollout_types.go
Outdated
@@ -231,10 +328,22 @@ const ( | |||
// Terminating Reason | |||
TerminatingReasonInTerminating = "InTerminating" | |||
TerminatingReasonCompleted = "Completed" | |||
|
|||
// Finalise Reason | |||
FinaliseReasonSuccess = "Success" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz comment each FinalizeReason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
api/v1beta1/rollout_types.go
Outdated
type FinalisingStepType string | ||
|
||
const ( | ||
FinalisingStepTypePreparing FinalisingStepType = "Preparing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz comment about each step and the common workflow that involves multiple steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, and workflow related comment will be referenced in the upcoming pull request (PR) and included in
a documentation as well.
pkg/util/rollout_utils.go
Outdated
} | ||
allSteps := int32(len(rollout.Spec.Strategy.GetSteps())) | ||
if CurrentStepIndex >= allSteps { | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz comment about the wrapping logic, why the next index of last step is 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we set the NextStepIndex of last step to -1, so as to avoid confusion
api/v1alpha1/conversion.go
Outdated
} | ||
dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(srcV1beta1.Spec.ReleasePlan.RollingStyle)) | ||
dst.Spec.ReleasePlan.RollingStyle = RollingStyleType(srcV1beta1.Spec.ReleasePlan.RollingStyle) | ||
// if srcV1beta1.Spec.ReleasePlan.EnableExtraWorkloadForCanary { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fc3e5e1
to
36d5d43
Compare
2d045c9
to
ba359f3
Compare
api/v1beta1/deployment_types.go
Outdated
// It is only used for BlueGreen Release | ||
// Similar to DeploymentStrategy, it is stored in workload annotation | ||
// However, unlike DeploymentStrategy, it is only used to storage and restore | ||
type OriginalSetting struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OriginalSetting -> DeploymentStrategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
api/v1beta1/deployment_types.go
Outdated
|
||
// OriginalSettingAnnotation is annotation for workload in BlueGreen Release, | ||
// it will storage the original setting of the workload, which will be used to restore the workload | ||
OriginalSettingAnnotation = "rollouts.kruise.io/original-setting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rollouts.kruise.io/original-setting -> rollouts.kruise.io/original-deployment-strategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
api/v1beta1/deployment_types.go
Outdated
@@ -52,13 +62,42 @@ type DeploymentStrategy struct { | |||
Partition intstr.IntOrString `json:"partition,omitempty"` | |||
} | |||
|
|||
// OriginalSetting storages part of the fileds of a workload, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// DeploymentStrategy stores deployment strategy related fields of a workload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
api/v1beta1/deployment_types.go
Outdated
@@ -37,6 +37,16 @@ const ( | |||
// AdvancedDeploymentControlLabel is label for deployment, | |||
// which labels whether the deployment is controlled by advanced-deployment-controller. | |||
AdvancedDeploymentControlLabel = "rollouts.kruise.io/controlled-by-advanced-deployment-controller" | |||
|
|||
// OriginalSettingAnnotation is annotation for workload in BlueGreen Release, | |||
// it will storage the original setting of the workload, which will be used to restore the workload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz replace all storage vb with store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
api/v1beta1/rollout_types.go
Outdated
// Get the rolling style based on the strategy | ||
func (r *RolloutStrategy) GetRollingStyle() RollingStyleType { | ||
if r.BlueGreen == nil && r.Canary == nil { | ||
return EmptyRollingStyle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should include a webhook to ensure that either bluegreen or canary field is set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
included
pkg/util/rollout_utils.go
Outdated
} | ||
allSteps := int32(len(rollout.Spec.Strategy.GetSteps())) | ||
if CurrentStepIndex >= allSteps { | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we set the NextStepIndex of last step to -1, so as to avoid confusion
api/v1beta1/rollout_types.go
Outdated
@@ -243,27 +348,123 @@ type CanaryStatus struct { | |||
RolloutHash string `json:"rolloutHash,omitempty"` | |||
// StableRevision indicates the revision of stable pods | |||
StableRevision string `json:"stableRevision,omitempty"` | |||
// pod template hash is used as service selector label | |||
PodTemplateHash string `json:"podTemplateHash"` | |||
// CurrentStepIndex defines the current step of the rollout is on. If the current step index is null, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current step index is int, it cannot be null, maybe you mean is zero here ?
return field.ErrorList{field.Invalid(fldPath.Index(i).Child("steps"), steps, `traffic must be percentage with "0%" <= traffic <= "100%" in blueGreen strategy`)} | ||
} | ||
default: | ||
// traffic "0%" is not allowed in canary strategy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to allow set 0% for canary strategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we didn't allow set 0% from the beginning. i indeed tried to allow this for canary strategy, however, we need consider much more scenarios about traffic, which make the code complex and hard to maintain
7de1c40
to
f3b29f3
Compare
return br | ||
}, | ||
}, | ||
} | ||
|
||
for _, cs := range cases { | ||
for i, cs := range cases { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only select one case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my miss, updated
// RollingStyle can be "Canary", "Partiton" or "BlueGreen" | ||
RollingStyle RollingStyleType `json:"rollingStyle,omitempty"` | ||
// When user verifies that the canary version is ready, we will remove the canary deployment and release the deployment workload-demo in full. | ||
// Current only support k8s native deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz comment the relationship with rollingStyle and enableExtraWorkloadForCanary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
plz squash commits into one |
Signed-off-by: yunbo <[email protected]> add status conversion Signed-off-by: yunbo <[email protected]> nextStepIndex default value from 0 to -1 Signed-off-by: yunbo <[email protected]> restore the enableExtra field in BR Signed-off-by: yunbo <[email protected]>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zmberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Ⅰ. Describe what this PR does
this PR does the following update/modification:
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Special notes for reviews