Skip to content

Commit

Permalink
Added pods-per-core to kubelet. kubernetes#25762
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Rati committed May 27, 2016
1 parent 35922bd commit 2d487f7
Show file tree
Hide file tree
Showing 11 changed files with 599 additions and 531 deletions.
2 changes: 2 additions & 0 deletions cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
10*time.Second, /* OutOfDiskTransitionFrequency */
10*time.Second, /* EvictionPressureTransitionPeriod */
40, /* MaxPods */
0, /* PodsPerCore*/
cm, net.ParseIP("127.0.0.1"))

kubeletapp.RunKubelet(kcfg)
Expand Down Expand Up @@ -273,6 +274,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
10*time.Second, /* OutOfDiskTransitionFrequency */
10*time.Second, /* EvictionPressureTransitionPeriod */
40, /* MaxPods */
0, /* PodsPerCore*/
cm,
net.ParseIP("127.0.0.1"))

Expand Down
2 changes: 2 additions & 0 deletions cmd/kubelet/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func NewKubeletServer() *KubeletServer {
HairpinMode: componentconfig.PromiscuousBridge,
BabysitDaemons: false,
EvictionPressureTransitionPeriod: unversioned.Duration{Duration: 5 * time.Minute},
PodsPerCore: 0,
},
}
}
Expand Down Expand Up @@ -264,4 +265,5 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.EvictionSoftGracePeriod, "eviction-soft-grace-period", s.EvictionSoftGracePeriod, "A set of eviction grace periods (e.g. memory.available=1m30s) that correspond to how long a soft eviction threshold must hold before triggering a pod eviction.")
fs.DurationVar(&s.EvictionPressureTransitionPeriod.Duration, "eviction-pressure-transition-period", s.EvictionPressureTransitionPeriod.Duration, "Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.")
fs.Int32Var(&s.EvictionMaxPodGracePeriod, "eviction-max-pod-grace-period", s.EvictionMaxPodGracePeriod, "Maximum allowed grace period (in seconds) to use when terminating pods in response to a soft eviction threshold being met. If negative, defer to pod specified value.")
fs.Int32Var(&s.PodsPerCore, "pods-per-core", s.PodsPerCore, "Number of Pods per core that can run on this Kubelet. The total number of Pods on this Kubelet cannot exceed max-pods, so max-pods will be used if this caulcation results in a larger number of Pods allowed on the Kubelet. A value of 0 disables this limit.")
}
6 changes: 5 additions & 1 deletion cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
ExperimentalFlannelOverlay: s.ExperimentalFlannelOverlay,
NodeIP: net.ParseIP(s.NodeIP),
EvictionConfig: evictionConfig,
PodsPerCore: int(s.PodsPerCore),
}, nil
}

Expand Down Expand Up @@ -533,7 +534,7 @@ func SimpleKubelet(client *clientset.Clientset,
cloud cloudprovider.Interface,
osInterface kubecontainer.OSInterface,
fileCheckFrequency, httpCheckFrequency, minimumGCAge, nodeStatusUpdateFrequency, syncFrequency, outOfDiskTransitionFrequency, evictionPressureTransitionPeriod time.Duration,
maxPods int,
maxPods int, podsPerCore int,
containerManager cm.ContainerManager, clusterDNS net.IP) *KubeletConfig {
imageGCPolicy := kubelet.ImageGCPolicy{
HighThresholdPercent: 90,
Expand Down Expand Up @@ -604,6 +605,7 @@ func SimpleKubelet(client *clientset.Clientset,
Writer: &io.StdWriter{},
OutOfDiskTransitionFrequency: outOfDiskTransitionFrequency,
EvictionConfig: evictionConfig,
PodsPerCore: podsPerCore,
}
return &kcfg
}
Expand Down Expand Up @@ -814,6 +816,7 @@ type KubeletConfig struct {
OOMAdjuster *oom.OOMAdjuster
OSInterface kubecontainer.OSInterface
PodCIDR string
PodsPerCore int
ReconcileCIDR bool
PodConfig *config.PodConfig
PodInfraContainerImage string
Expand Down Expand Up @@ -923,6 +926,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
kc.PodCIDR,
kc.ReconcileCIDR,
kc.MaxPods,
kc.PodsPerCore,
kc.NvidiaGPUs,
kc.DockerExecHandler,
kc.ResolverConfig,
Expand Down
4 changes: 3 additions & 1 deletion cmd/kubemark/hollow-node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ type HollowNodeConfig struct {
}

const (
maxPods = 110
maxPods = 110
podsPerCore = 0
)

var knownMorphs = sets.NewString("kubelet", "proxy")
Expand Down Expand Up @@ -115,6 +116,7 @@ func main() {
config.KubeletReadOnlyPort,
containerManager,
maxPods,
podsPerCore,
)
hollowKubelet.Run()
}
Expand Down
1 change: 1 addition & 0 deletions docs/admin/kubelet.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ kubelet
--outofdisk-transition-frequency=5m0s: Duration for which the kubelet has to wait before transitioning out of out-of-disk node condition status. Default: 5m0s
--pod-cidr="": The CIDR to use for pod IP addresses, only used in standalone mode. In cluster mode, this is obtained from the master.
--pod-infra-container-image="gcr.io/google_containers/pause-amd64:3.0": The image whose network/ipc namespaces containers in each pod will use.
--pods-per-core=0: Number of Pods per core that can run on this Kubelet. The total number of Pods on this Kubelet cannot exceed max-pods, so max-pods will be used if this caulcation results in a larger number of Pods allowed on the Kubelet. A value of 0 disables this limit.
--port=10250: The port for the Kubelet to serve on.
--read-only-port=10255: The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)
--really-crash-for-testing[=false]: If true, when panics occur crash. Intended for testing.
Expand Down
1 change: 1 addition & 0 deletions hack/verify-flags/known-flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ pod-cidr
pod-eviction-timeout
pod-infra-container-image
pod-running
pods-per-core
policy-config-file
poll-interval
portal-net
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/componentconfig/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func DeepCopy_componentconfig_KubeletConfiguration(in KubeletConfiguration, out
return err
}
out.EvictionMaxPodGracePeriod = in.EvictionMaxPodGracePeriod
out.PodsPerCore = in.PodsPerCore
return nil
}

Expand Down
Loading

0 comments on commit 2d487f7

Please sign in to comment.