Merge pull request #7346 from ripta/max-pd-vols

Add maxPersistentVolumes to support the KUBE_MAX_PD_VOLS scheduler setting
This commit is contained in:
Kubernetes Prow Robot 2019-08-15 22:54:32 -07:00 committed by GitHub
commit 2d1b010071
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 0 deletions

View File

@ -18,6 +18,7 @@ package model
import (
"fmt"
"strconv"
"k8s.io/kops/pkg/flagbuilder"
"k8s.io/kops/pkg/k8scodecs"
@ -164,6 +165,14 @@ func (b *KubeSchedulerBuilder) buildPod() (*v1.Pod, error) {
"/var/log/kube-scheduler.log")
}
if c.MaxPersistentVolumes != nil {
maxPDV := v1.EnvVar{
Name: "KUBE_MAX_PD_VOLS", // https://kubernetes.io/docs/concepts/storage/storage-limits/
Value: strconv.Itoa(int(*c.MaxPersistentVolumes)),
}
container.Env = append(container.Env, maxPDV)
}
pod.Spec.Containers = append(pod.Spec.Containers, *container)
kubemanifest.MarkPodAsCritical(pod)

View File

@ -559,6 +559,11 @@ type KubeSchedulerConfig struct {
UsePolicyConfigMap *bool `json:"usePolicyConfigMap,omitempty"`
// FeatureGates is set of key=value pairs that describe feature gates for alpha/experimental features.
FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"`
// MaxPersistentVolumes changes the maximum number of persistent volumes the scheduler will scheduler onto the same
// node. Only takes into affect if value is positive. This corresponds to the KUBE_MAX_PD_VOLS environment variable,
// which has been supported as far back as Kubernetes 1.7. The default depends on the version and the cloud provider
// as outlined: https://kubernetes.io/docs/concepts/storage/storage-limits/
MaxPersistentVolumes *int32 `json:"maxPersistentVolumes,omitempty"`
}
// LeaderElectionConfiguration defines the configuration of leader election

View File

@ -559,6 +559,11 @@ type KubeSchedulerConfig struct {
UsePolicyConfigMap *bool `json:"usePolicyConfigMap,omitempty"`
// FeatureGates is set of key=value pairs that describe feature gates for alpha/experimental features.
FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"`
// MaxPersistentVolumes changes the maximum number of persistent volumes the scheduler will scheduler onto the same
// node. Only takes into affect if value is positive. This corresponds to the KUBE_MAX_PD_VOLS environment variable,
// which has been supported as far back as Kubernetes 1.7. The default depends on the version and the cloud provider
// as outlined: https://kubernetes.io/docs/concepts/storage/storage-limits/
MaxPersistentVolumes *int32 `json:"maxPersistentVolumes,omitempty"`
}
// LeaderElectionConfiguration defines the configuration of leader election

View File

@ -3351,6 +3351,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfig_To_kops_KubeSchedulerConfig(in *Ku
}
out.UsePolicyConfigMap = in.UsePolicyConfigMap
out.FeatureGates = in.FeatureGates
out.MaxPersistentVolumes = in.MaxPersistentVolumes
return nil
}
@ -3374,6 +3375,7 @@ func autoConvert_kops_KubeSchedulerConfig_To_v1alpha1_KubeSchedulerConfig(in *ko
}
out.UsePolicyConfigMap = in.UsePolicyConfigMap
out.FeatureGates = in.FeatureGates
out.MaxPersistentVolumes = in.MaxPersistentVolumes
return nil
}

View File

@ -2167,6 +2167,11 @@ func (in *KubeSchedulerConfig) DeepCopyInto(out *KubeSchedulerConfig) {
(*out)[key] = val
}
}
if in.MaxPersistentVolumes != nil {
in, out := &in.MaxPersistentVolumes, &out.MaxPersistentVolumes
*out = new(int32)
**out = **in
}
return
}

View File

@ -559,6 +559,11 @@ type KubeSchedulerConfig struct {
UsePolicyConfigMap *bool `json:"usePolicyConfigMap,omitempty"`
// FeatureGates is set of key=value pairs that describe feature gates for alpha/experimental features.
FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"`
// MaxPersistentVolumes changes the maximum number of persistent volumes the scheduler will scheduler onto the same
// node. Only takes into affect if value is positive. This corresponds to the KUBE_MAX_PD_VOLS environment variable,
// which has been supported as far back as Kubernetes 1.7. The default depends on the version and the cloud provider
// as outlined: https://kubernetes.io/docs/concepts/storage/storage-limits/
MaxPersistentVolumes *int32 `json:"maxPersistentVolumes,omitempty"`
}
// LeaderElectionConfiguration defines the configuration of leader election

View File

@ -3621,6 +3621,7 @@ func autoConvert_v1alpha2_KubeSchedulerConfig_To_kops_KubeSchedulerConfig(in *Ku
}
out.UsePolicyConfigMap = in.UsePolicyConfigMap
out.FeatureGates = in.FeatureGates
out.MaxPersistentVolumes = in.MaxPersistentVolumes
return nil
}
@ -3644,6 +3645,7 @@ func autoConvert_kops_KubeSchedulerConfig_To_v1alpha2_KubeSchedulerConfig(in *ko
}
out.UsePolicyConfigMap = in.UsePolicyConfigMap
out.FeatureGates = in.FeatureGates
out.MaxPersistentVolumes = in.MaxPersistentVolumes
return nil
}

View File

@ -2238,6 +2238,11 @@ func (in *KubeSchedulerConfig) DeepCopyInto(out *KubeSchedulerConfig) {
(*out)[key] = val
}
}
if in.MaxPersistentVolumes != nil {
in, out := &in.MaxPersistentVolumes, &out.MaxPersistentVolumes
*out = new(int32)
**out = **in
}
return
}

View File

@ -2420,6 +2420,11 @@ func (in *KubeSchedulerConfig) DeepCopyInto(out *KubeSchedulerConfig) {
(*out)[key] = val
}
}
if in.MaxPersistentVolumes != nil {
in, out := &in.MaxPersistentVolumes, &out.MaxPersistentVolumes
*out = new(int32)
**out = **in
}
return
}