Skip to content

Commit

Permalink
kubeadm: set maxUnavailable and maxSurge for self-hosted component de…
Browse files Browse the repository at this point in the history
…ployments.

Refs kubernetes/kubeadm#127
  • Loading branch information
pires committed Feb 1, 2017
1 parent 96cfe7b commit ab1a5b5
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 ab1a5b5

Please sign in to comment.