mirror of https://github.com/kubernetes/kops.git
Default maxSurge to 1 on AWS
This commit is contained in:
parent
a5dabf58dc
commit
e104cdb982
|
|
@ -2947,10 +2947,10 @@ spec:
|
|||
example 10%). The absolute number is calculated from a percentage
|
||||
by rounding up. A value of 0 for both this and MaxUnavailable
|
||||
disables rolling updates. Has no effect on instance groups with
|
||||
role "Master". Defaults to 0. Example: when this is set to 30%,
|
||||
the InstanceGroup can be scaled up immediately when the rolling
|
||||
update starts, such that the total number of old and new nodes
|
||||
do not exceed 130% of desired nodes.'
|
||||
role "Master". Defaults to 1 on AWS, 0 otherwise. Example: when
|
||||
this is set to 30%, the InstanceGroup can be scaled up immediately
|
||||
when the rolling update starts, such that the total number of
|
||||
old and new nodes do not exceed 130% of desired nodes.'
|
||||
maxUnavailable:
|
||||
anyOf:
|
||||
- type: string
|
||||
|
|
|
|||
|
|
@ -640,10 +640,10 @@ spec:
|
|||
example 10%). The absolute number is calculated from a percentage
|
||||
by rounding up. A value of 0 for both this and MaxUnavailable
|
||||
disables rolling updates. Has no effect on instance groups with
|
||||
role "Master". Defaults to 0. Example: when this is set to 30%,
|
||||
the InstanceGroup can be scaled up immediately when the rolling
|
||||
update starts, such that the total number of old and new nodes
|
||||
do not exceed 130% of desired nodes.'
|
||||
role "Master". Defaults to 1 on AWS, 0 otherwise. Example: when
|
||||
this is set to 30%, the InstanceGroup can be scaled up immediately
|
||||
when the rolling update starts, such that the total number of
|
||||
old and new nodes do not exceed 130% of desired nodes.'
|
||||
maxUnavailable:
|
||||
anyOf:
|
||||
- type: string
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ type RollingUpdate struct {
|
|||
// The absolute number is calculated from a percentage by rounding up.
|
||||
// A value of 0 for both this and MaxUnavailable disables rolling updates.
|
||||
// Has no effect on instance groups with role "Master".
|
||||
// Defaults to 0.
|
||||
// Defaults to 1 on AWS, 0 otherwise.
|
||||
// Example: when this is set to 30%, the InstanceGroup can be scaled
|
||||
// up immediately when the rolling update starts, such that the total
|
||||
// number of old and new nodes do not exceed 130% of desired
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ type RollingUpdate struct {
|
|||
// The absolute number is calculated from a percentage by rounding up.
|
||||
// A value of 0 for both this and MaxUnavailable disables rolling updates.
|
||||
// Has no effect on instance groups with role "Master".
|
||||
// Defaults to 0.
|
||||
// Defaults to 1 on AWS, 0 otherwise.
|
||||
// Example: when this is set to 30%, the InstanceGroup can be scaled
|
||||
// up immediately when the rolling update starts, such that the total
|
||||
// number of old and new nodes do not exceed 130% of desired
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ type RollingUpdate struct {
|
|||
// The absolute number is calculated from a percentage by rounding up.
|
||||
// A value of 0 for both this and MaxUnavailable disables rolling updates.
|
||||
// Has no effect on instance groups with role "Master".
|
||||
// Defaults to 0.
|
||||
// Defaults to 1 on AWS, 0 otherwise.
|
||||
// Example: when this is set to 30%, the InstanceGroup can be scaled
|
||||
// up immediately when the rolling update starts, such that the total
|
||||
// number of old and new nodes do not exceed 130% of desired
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ go_library(
|
|||
"//pkg/client/simple:go_default_library",
|
||||
"//pkg/cloudinstances:go_default_library",
|
||||
"//pkg/drain:go_default_library",
|
||||
"//pkg/featureflag:go_default_library",
|
||||
"//pkg/validation:go_default_library",
|
||||
"//upup/pkg/fi:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package instancegroups
|
|||
import (
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/featureflag"
|
||||
)
|
||||
|
||||
func resolveSettings(cluster *kops.Cluster, group *kops.InstanceGroup, numInstances int) kops.RollingUpdate {
|
||||
|
|
@ -37,8 +38,11 @@ func resolveSettings(cluster *kops.Cluster, group *kops.InstanceGroup, numInstan
|
|||
}
|
||||
|
||||
if rollingUpdate.MaxSurge == nil {
|
||||
zero := intstr.FromInt(0)
|
||||
rollingUpdate.MaxSurge = &zero
|
||||
val := intstr.FromInt(0)
|
||||
if kops.CloudProviderID(cluster.Spec.CloudProvider) == kops.CloudProviderAWS && !featureflag.Spotinst.Enabled() {
|
||||
val = intstr.FromInt(1)
|
||||
}
|
||||
rollingUpdate.MaxSurge = &val
|
||||
}
|
||||
|
||||
if rollingUpdate.MaxSurge.Type == intstr.String {
|
||||
|
|
|
|||
|
|
@ -204,3 +204,15 @@ func TestMaxSurge(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAWSDefault(t *testing.T) {
|
||||
resolved := resolveSettings(&kops.Cluster{
|
||||
Spec: kops.ClusterSpec{
|
||||
CloudProvider: "aws",
|
||||
},
|
||||
}, &kops.InstanceGroup{}, 1000)
|
||||
assert.Equal(t, intstr.Int, resolved.MaxSurge.Type)
|
||||
assert.Equal(t, int32(1), resolved.MaxSurge.IntVal)
|
||||
assert.Equal(t, intstr.Int, resolved.MaxUnavailable.Type)
|
||||
assert.Equal(t, int32(0), resolved.MaxUnavailable.IntVal)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue