Skip to content

Commit

Permalink
fix: follow gometalinter. issue TencentBlueKing#144
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanhe-bupt committed Dec 3, 2020
1 parent 976f33e commit 78418a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,18 @@ func (ssc *defaultGameStatefulSetControl) updateGameStatefulSet(
}
}

return ssc.handleUpdateStrategy(set, status, revisions, updateRevision, replicas, monotonic)
}

func (ssc *defaultGameStatefulSetControl) handleUpdateStrategy(
set *gstsv1alpha1.GameStatefulSet,
status *gstsv1alpha1.GameStatefulSetStatus,
revisions []*apps.ControllerRevision,
updateRevision *apps.ControllerRevision,
replicas []*v1.Pod,
monotonic bool,
) (*gstsv1alpha1.GameStatefulSetStatus, error) {

// for the OnDelete strategy we short circuit. Pods will be updated when they are manually deleted.
if set.Spec.UpdateStrategy.Type == gstsv1alpha1.OnDeleteGameStatefulSetStrategyType {
return status, nil
Expand All @@ -682,12 +694,8 @@ func (ssc *defaultGameStatefulSetControl) updateGameStatefulSet(
updateMin := 0
currentPartition := canaryutil.GetCurrentPartition(set)
updateMin = int(currentPartition)
//if set.Spec.UpdateStrategy.RollingUpdate != nil {
// updateMin = int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)
//}

switch set.Spec.UpdateStrategy.Type {
//(DeveloperJim): InplaceUpdate handle here
case gstsv1alpha1.InplaceUpdateGameStatefulSetStrategyType:
for target := len(replicas) - 1; target >= updateMin; target-- {
if getPodRevision(replicas[target]) != updateRevision.Name && !isTerminating(replicas[target]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cd /data/bcs/bcs-gamestatefulset-operator
chmod +x bcs-gamestatefulset-operator
#start operator
./bcs-gamestatefulset-operator --min-resync-period=60s --v=5
./bcs-gamestatefulset-operator --v=5

#Usage of ./bcs-gamestatefulset-operator:
# -add_dir_header
Expand Down

0 comments on commit 78418a3

Please sign in to comment.