Skip to content

Commit

Permalink
Merge pull request #40797 from apprenda/kubeadm_selfhosted_rollingupd…
Browse files Browse the repository at this point in the history
…ate_params

Automatic merge from submit-queue (batch tested with PRs 40801, 40797)

kubeadm: set maxUnavailable and maxSurge for self-hosted component deployments

**What this PR does / why we need it**: This PR explicitly specifies `kubeadm` self-hosted components deployment update strategy (`RollingUpdateDeploymentStrategyType`) and its parameters (`maxUnavailable` and `maxSurge`).

**Which issue this PR fixes**:
Refs #40075 (comment)
Refs kubernetes/kubeadm#127

**Special notes for your reviewer**: /cc @Kargakis @luxas 

**Release note**:
```release-note
NONE
```
  • Loading branch information
Kubernetes Submit Queue authored Feb 1, 2017
2 parents 3ed435b + ab1a5b5 commit fe36648
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/kubeadm/app/master/selfhosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/images"
Expand All @@ -32,6 +33,12 @@ import (
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
)

var (
// maximum unavailable and surge instances per self-hosted component deployment
maxUnavailable = intstr.FromInt(0)
maxSurge = intstr.FromInt(1)
)

func CreateSelfHostedControlPlane(cfg *kubeadmapi.MasterConfiguration, client *clientset.Clientset) error {
volumes := []v1.Volume{k8sVolume(cfg)}
volumeMounts := []v1.VolumeMount{k8sVolumeMount()}
Expand Down Expand Up @@ -234,6 +241,13 @@ func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes
},
Spec: ext.DeploymentSpec{
// TODO bootkube uses 2 replicas
Strategy: ext.DeploymentStrategy{
Type: ext.RollingUpdateDeploymentStrategyType,
RollingUpdate: &ext.RollingUpdateDeployment{
MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge,
},
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
Expand Down Expand Up @@ -281,6 +295,13 @@ func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration) ext.Deployment
},
Spec: ext.DeploymentSpec{
// TODO bootkube uses 2 replicas
Strategy: ext.DeploymentStrategy{
Type: ext.RollingUpdateDeploymentStrategyType,
RollingUpdate: &ext.RollingUpdateDeployment{
MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge,
},
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
Expand Down

0 comments on commit fe36648

Please sign in to comment.