Skip to content

Commit 8ce6de4

Browse files
author
OpenShift Bot
authored
Merge pull request #11090 from kargakis/remove-updatePercent
Merged by openshift-bot
2 parents 2b259f7 + 0601a7d commit 8ce6de4

15 files changed

+175
-254
lines changed

UPGRADE.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ when that change will happen.
2525
Origin 1.y / OSE 3.y, support for `/ns/namespace-name/subjectaccessreview` will be removed.
2626
At that time, the openshift docker registry image must be upgraded in order to continue functioning.
2727

28-
1. The `deploymentConfig.rollingParams.updatePercent` field is deprecated in
29-
favor of `deploymentConfig.rollingParams.maxUnavailable` and
30-
`deploymentConfig.rollingParams.maxSurge`. The `updatePercent` field will be
31-
removed in Origin 1.1 (OSE 3.1).
28+
1. The `deploymentConfig.spec.strategy.rollingParams.updatePercent` field is deprecated in
29+
favor of `deploymentConfig.spec.strategy.rollingParams.maxUnavailable` and
30+
`deploymentConfig.spec.strategy.rollingParams.maxSurge`. The `updatePercent` field is
31+
removed in Origin 1.4 (OSE 3.4).
3232

3333
1. The `volume.metadata` field is deprecated as of Origin 1.0.6 in favor of `volume.downwardAPI`.
3434

@@ -95,4 +95,11 @@ references:
9595
## Origin 1.3.x / OSE 3.3.x
9696

9797
1. `oc tag -d` now matches `oc delete imagestreamtag` behavior instead of removing the spec tag and leaving the status tag.
98-
The old behavior can be achieved using `oc edit` or if you just want to disabling scheduled imports, `oc tag --scheduled=false`
98+
The old behavior can be achieved using `oc edit` or if you just want to disabling scheduled imports, `oc tag --scheduled=false`
99+
100+
101+
## Origin 1.4.x / OSE 3.4.x
102+
103+
1. The `deploymentConfig.spec.strategy.rollingParams.updatePercent` field is removed in
104+
favor of `deploymentConfig.spec.strategy.rollingParams.maxUnavailable` and
105+
`deploymentConfig.spec.strategy.rollingParams.maxSurge`.

api/swagger-spec/oapi-v1.json

-5
Original file line numberDiff line numberDiff line change
@@ -22936,11 +22936,6 @@
2293622936
"type": "string",
2293722937
"description": "MaxSurge is the maximum number of pods that can be scheduled above the original number of pods. Value can be an absolute number (ex: 5) or a percentage of total pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up.\n\nThis cannot be 0 if MaxUnavailable is 0. By default, 25% is used.\n\nExample: when this is set to 30%, the new RC can be scaled up by 30% immediately when the rolling update starts. Once old pods have been killed, new RC can be scaled up further, ensuring that total number of pods running at any time during the update is atmost 130% of original pods."
2293822938
},
22939-
"updatePercent": {
22940-
"type": "integer",
22941-
"format": "int32",
22942-
"description": "UpdatePercent is the percentage of replicas to scale up or down each interval. If nil, one replica will be scaled up and down each interval. If negative, the scale order will be down/up instead of up/down. DEPRECATED: Use MaxUnavailable/MaxSurge instead."
22943-
},
2294422939
"pre": {
2294522940
"$ref": "v1.LifecycleHook",
2294622941
"description": "Pre is a lifecycle hook which is executed before the deployment process begins. All LifecycleHookFailurePolicy values are supported."

pkg/cmd/admin/router/router.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out io.Writer, cfg *
724724
},
725725
)
726726
}
727-
updatePercent := int32(-25)
728727
objects = append(objects, &deployapi.DeploymentConfig{
729728
ObjectMeta: kapi.ObjectMeta{
730729
Name: name,
@@ -733,7 +732,7 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out io.Writer, cfg *
733732
Spec: deployapi.DeploymentConfigSpec{
734733
Strategy: deployapi.DeploymentStrategy{
735734
Type: deployapi.DeploymentStrategyTypeRolling,
736-
RollingParams: &deployapi.RollingDeploymentStrategyParams{UpdatePercent: &updatePercent},
735+
RollingParams: &deployapi.RollingDeploymentStrategyParams{MaxUnavailable: intstr.FromString("25%")},
737736
},
738737
Replicas: cfg.Replicas,
739738
Selector: label,

pkg/deploy/api/types.go

-5
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ type RollingDeploymentStrategyParams struct {
168168
// new RC can be scaled up further, ensuring that total number of pods running
169169
// at any time during the update is atmost 130% of original pods.
170170
MaxSurge intstr.IntOrString
171-
// UpdatePercent is the percentage of replicas to scale up or down each
172-
// interval. If nil, one replica will be scaled up and down each interval.
173-
// If negative, the scale order will be down/up instead of up/down.
174-
// DEPRECATED: Use MaxUnavailable/MaxSurge instead.
175-
UpdatePercent *int32
176171
// Pre is a lifecycle hook which is executed before the deployment process
177172
// begins. All LifecycleHookFailurePolicy values are supported.
178173
Pre *LifecycleHook

pkg/deploy/api/v1/conversion.go

+8-27
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package v1
22

33
import (
4-
"fmt"
5-
"math"
64
"reflect"
75
"strings"
86

@@ -60,7 +58,6 @@ func Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategy
6058
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
6159
out.IntervalSeconds = in.IntervalSeconds
6260
out.TimeoutSeconds = in.TimeoutSeconds
63-
out.UpdatePercent = in.UpdatePercent
6461

6562
if in.Pre != nil {
6663
if err := s.Convert(&in.Pre, &out.Pre, 0); err != nil {
@@ -72,18 +69,12 @@ func Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategy
7269
return err
7370
}
7471
}
75-
76-
if in.UpdatePercent != nil {
77-
pct := intstr.FromString(fmt.Sprintf("%d%%", int(math.Abs(float64(*in.UpdatePercent)))))
78-
if *in.UpdatePercent > 0 {
79-
out.MaxSurge = pct
80-
} else {
81-
out.MaxUnavailable = pct
82-
}
83-
} else {
72+
if in.MaxUnavailable != nil {
8473
if err := s.Convert(in.MaxUnavailable, &out.MaxUnavailable, 0); err != nil {
8574
return err
8675
}
76+
}
77+
if in.MaxSurge != nil {
8778
if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil {
8879
return err
8980
}
@@ -95,7 +86,6 @@ func Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategy
9586
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
9687
out.IntervalSeconds = in.IntervalSeconds
9788
out.TimeoutSeconds = in.TimeoutSeconds
98-
out.UpdatePercent = in.UpdatePercent
9989

10090
if in.Pre != nil {
10191
if err := s.Convert(&in.Pre, &out.Pre, 0); err != nil {
@@ -114,20 +104,11 @@ func Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategy
114104
if out.MaxSurge == nil {
115105
out.MaxSurge = &intstr.IntOrString{}
116106
}
117-
if in.UpdatePercent != nil {
118-
pct := intstr.FromString(fmt.Sprintf("%d%%", int(math.Abs(float64(*in.UpdatePercent)))))
119-
if *in.UpdatePercent > 0 {
120-
out.MaxSurge = &pct
121-
} else {
122-
out.MaxUnavailable = &pct
123-
}
124-
} else {
125-
if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil {
126-
return err
127-
}
128-
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
129-
return err
130-
}
107+
if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil {
108+
return err
109+
}
110+
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
111+
return err
131112
}
132113
return nil
133114
}

pkg/deploy/api/v1/conversion_test.go

+18-9
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStr
6565
UpdatePeriodSeconds: newInt64(5),
6666
IntervalSeconds: newInt64(6),
6767
TimeoutSeconds: newInt64(7),
68-
UpdatePercent: newInt32(-25),
68+
MaxUnavailable: newIntOrString(intstr.FromString("25%")),
6969
Pre: &LifecycleHook{
7070
FailurePolicy: LifecycleHookFailurePolicyIgnore,
7171
},
@@ -77,7 +77,6 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStr
7777
UpdatePeriodSeconds: newInt64(5),
7878
IntervalSeconds: newInt64(6),
7979
TimeoutSeconds: newInt64(7),
80-
UpdatePercent: newInt32(-25),
8180
MaxSurge: intstr.FromInt(0),
8281
MaxUnavailable: intstr.FromString("25%"),
8382
Pre: &newer.LifecycleHook{
@@ -93,13 +92,12 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStr
9392
UpdatePeriodSeconds: newInt64(5),
9493
IntervalSeconds: newInt64(6),
9594
TimeoutSeconds: newInt64(7),
96-
UpdatePercent: newInt32(25),
95+
MaxSurge: newIntOrString(intstr.FromString("25%")),
9796
},
9897
out: &newer.RollingDeploymentStrategyParams{
9998
UpdatePeriodSeconds: newInt64(5),
10099
IntervalSeconds: newInt64(6),
101100
TimeoutSeconds: newInt64(7),
102-
UpdatePercent: newInt32(25),
103101
MaxSurge: intstr.FromString("25%"),
104102
MaxUnavailable: intstr.FromInt(0),
105103
},
@@ -120,9 +118,24 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStr
120118
MaxUnavailable: intstr.FromInt(20),
121119
},
122120
},
121+
{
122+
in: &RollingDeploymentStrategyParams{
123+
UpdatePeriodSeconds: newInt64(5),
124+
IntervalSeconds: newInt64(6),
125+
TimeoutSeconds: newInt64(7),
126+
},
127+
out: &newer.RollingDeploymentStrategyParams{
128+
UpdatePeriodSeconds: newInt64(5),
129+
IntervalSeconds: newInt64(6),
130+
TimeoutSeconds: newInt64(7),
131+
MaxSurge: intstr.FromString("25%"),
132+
MaxUnavailable: intstr.FromString("25%"),
133+
},
134+
},
123135
}
124136

125-
for _, test := range tests {
137+
for i, test := range tests {
138+
t.Logf("running test case #%d", i)
126139
out := &newer.RollingDeploymentStrategyParams{}
127140
if err := kapi.Scheme.Convert(test.in, out, nil); err != nil {
128141
t.Errorf("unexpected error: %v", err)
@@ -143,15 +156,13 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
143156
UpdatePeriodSeconds: newInt64(5),
144157
IntervalSeconds: newInt64(6),
145158
TimeoutSeconds: newInt64(7),
146-
UpdatePercent: newInt32(-25),
147159
MaxSurge: intstr.FromInt(0),
148160
MaxUnavailable: intstr.FromString("25%"),
149161
},
150162
out: &RollingDeploymentStrategyParams{
151163
UpdatePeriodSeconds: newInt64(5),
152164
IntervalSeconds: newInt64(6),
153165
TimeoutSeconds: newInt64(7),
154-
UpdatePercent: newInt32(-25),
155166
MaxSurge: newIntOrString(intstr.FromInt(0)),
156167
MaxUnavailable: newIntOrString(intstr.FromString("25%")),
157168
},
@@ -161,15 +172,13 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
161172
UpdatePeriodSeconds: newInt64(5),
162173
IntervalSeconds: newInt64(6),
163174
TimeoutSeconds: newInt64(7),
164-
UpdatePercent: newInt32(25),
165175
MaxSurge: intstr.FromString("25%"),
166176
MaxUnavailable: intstr.FromInt(0),
167177
},
168178
out: &RollingDeploymentStrategyParams{
169179
UpdatePeriodSeconds: newInt64(5),
170180
IntervalSeconds: newInt64(6),
171181
TimeoutSeconds: newInt64(7),
172-
UpdatePercent: newInt32(25),
173182
MaxSurge: newIntOrString(intstr.FromString("25%")),
174183
MaxUnavailable: newIntOrString(intstr.FromInt(0)),
175184
},

pkg/deploy/api/v1/defaults.go

+6-10
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,12 @@ func SetDefaults_RollingDeploymentStrategyParams(obj *RollingDeploymentStrategyP
8484
obj.TimeoutSeconds = mkintp(deployapi.DefaultRollingTimeoutSeconds)
8585
}
8686

87-
if obj.UpdatePercent == nil {
88-
// Apply defaults.
89-
if obj.MaxUnavailable == nil {
90-
maxUnavailable := intstr.FromString("25%")
91-
obj.MaxUnavailable = &maxUnavailable
92-
}
93-
if obj.MaxSurge == nil {
94-
maxSurge := intstr.FromString("25%")
95-
obj.MaxSurge = &maxSurge
96-
}
87+
if obj.MaxUnavailable == nil && obj.MaxSurge == nil {
88+
maxUnavailable := intstr.FromString("25%")
89+
obj.MaxUnavailable = &maxUnavailable
90+
91+
maxSurge := intstr.FromString("25%")
92+
obj.MaxSurge = &maxSurge
9793
}
9894
}
9995

pkg/deploy/api/v1/defaults_test.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func TestDefaults(t *testing.T) {
163163
UpdatePeriodSeconds: newInt64(5),
164164
IntervalSeconds: newInt64(6),
165165
TimeoutSeconds: newInt64(7),
166-
UpdatePercent: newInt32(50),
166+
MaxSurge: newIntOrString(intstr.FromString("50%")),
167167
},
168168
},
169169
Triggers: []deployv1.DeploymentTriggerPolicy{
@@ -181,7 +181,6 @@ func TestDefaults(t *testing.T) {
181181
UpdatePeriodSeconds: newInt64(5),
182182
IntervalSeconds: newInt64(6),
183183
TimeoutSeconds: newInt64(7),
184-
UpdatePercent: newInt32(50),
185184
MaxSurge: newIntOrString(intstr.FromString("50%")),
186185
MaxUnavailable: newIntOrString(intstr.FromInt(0)),
187186
},
@@ -203,7 +202,7 @@ func TestDefaults(t *testing.T) {
203202
UpdatePeriodSeconds: newInt64(5),
204203
IntervalSeconds: newInt64(6),
205204
TimeoutSeconds: newInt64(7),
206-
UpdatePercent: newInt32(-25),
205+
MaxUnavailable: newIntOrString(intstr.FromString("25%")),
207206
},
208207
},
209208
Triggers: []deployv1.DeploymentTriggerPolicy{
@@ -221,7 +220,6 @@ func TestDefaults(t *testing.T) {
221220
UpdatePeriodSeconds: newInt64(5),
222221
IntervalSeconds: newInt64(6),
223222
TimeoutSeconds: newInt64(7),
224-
UpdatePercent: newInt32(-25),
225223
MaxSurge: newIntOrString(intstr.FromInt(0)),
226224
MaxUnavailable: newIntOrString(intstr.FromString("25%")),
227225
},
@@ -311,6 +309,10 @@ func TestDeepDefaults(t *testing.T) {
311309
if *obj.Spec.Strategy.RollingParams.TimeoutSeconds != deployapi.DefaultRollingTimeoutSeconds {
312310
return false
313311
}
312+
if obj.Spec.Strategy.RollingParams.MaxSurge.String() != "25%" ||
313+
obj.Spec.Strategy.RollingParams.MaxUnavailable.String() != "25%" {
314+
return false
315+
}
314316
return true
315317
},
316318
},

0 commit comments

Comments
 (0)