Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reserve compute resources kubelet flags #2982

Merged
merged 3 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/cluster_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ spec:

Will result in the flag `--feature-gates=ExperimentalCriticalPodAnnotation=true,AllowExtTrafficLocalEndpoints=false`

#### Compute Resources Reservation

```yaml
spec:
kubelet:
kubeReserved:
cpu: "100m"
memory: "100Mi"
storage: "1Gi"
kubeReservedCgroup: "/kube-reserved"
systemReserved:
cpu: "100m"
memory: "100Mi"
storage: "1Gi"
systemReservedCgroup: "/system-reserved"
enforceNodeAllocatable: "pods,system-reserved,kube-reserved"
```

Will result in the flag `--kube-reserved=cpu=100m,memory=100Mi,storage=1Gi --kube-reserved-cgroup=/kube-reserved --system-reserved=cpu=100mi,memory=100Mi,storage=1Gi --system-reserved-cgroup=/system-reserved --enforce-node-allocatable=pods,system-reserved,kube-reserved`

Learn [more about reserving compute resources](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/).

### networkID

Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/kops/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ type KubeletConfigSpec struct {

// 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"`

// Resource reservation for kubernetes system daemons like the kubelet,
// container runtime, node problem detector, etc.
KubeReserved map[string]string `json:"kubeReserved,omitempty" flag:"kube-reserved"`
// Control group for kube daemons.
KubeReservedCgroup string `json:"kubeReservedCgroup,omitempty" flag:"kube-reserved-cgroup"`
// Capture resource reservation for OS system daemons like sshd, udev, etc.
SystemReserved map[string]string `json:"systemReserved,omitempty" flag:"system-reserved"`
// Parent control group for OS system daemons.
SystemReservedCgroup string `json:"systemReservedCgroup,omitempty" flag:"system-reserved-cgroup"`
// Enforce Allocatable across pods whenever the overall usage across all pods
// exceeds Allocatable.
EnforceNodeAllocatable string `json:"enforceNodeAllocatable,omitempty" flag:"enforce-node-allocatable"`
}

type KubeProxyConfig struct {
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/kops/v1alpha1/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,19 @@ type KubeletConfigSpec struct {

// 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"`

// Resource reservation for kubernetes system daemons like the kubelet,
// container runtime, node problem detector, etc.
KubeReserved map[string]string `json:"kubeReserved,omitempty" flag:"kube-reserved"`
// Control group for kube daemons.
KubeReservedCgroup string `json:"kubeReservedCgroup,omitempty" flag:"kube-reserved-cgroup"`
// Capture resource reservation for OS system daemons like sshd, udev, etc.
SystemReserved map[string]string `json:"systemReserved,omitempty" flag:"system-reserved"`
// Parent control group for OS system daemons.
SystemReservedCgroup string `json:"systemReservedCgroup,omitempty" flag:"system-reserved-cgroup"`
// Enforce Allocatable across pods whenever the overall usage across all pods
// exceeds Allocatable.
EnforceNodeAllocatable string `json:"enforceNodeAllocatable,omitempty" flag:"enforce-node-allocatable"`
}

type KubeProxyConfig struct {
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/kops/v1alpha1/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,11 @@ func autoConvert_v1alpha1_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele
out.VolumePluginDirectory = in.VolumePluginDirectory
out.Taints = in.Taints
out.FeatureGates = in.FeatureGates
out.KubeReserved = in.KubeReserved
out.KubeReservedCgroup = in.KubeReservedCgroup
out.SystemReserved = in.SystemReserved
out.SystemReservedCgroup = in.SystemReservedCgroup
out.EnforceNodeAllocatable = in.EnforceNodeAllocatable
return nil
}

Expand Down Expand Up @@ -1666,6 +1671,11 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha1_KubeletConfigSpec(in *kops.K
out.VolumePluginDirectory = in.VolumePluginDirectory
out.Taints = in.Taints
out.FeatureGates = in.FeatureGates
out.KubeReserved = in.KubeReserved
out.KubeReservedCgroup = in.KubeReservedCgroup
out.SystemReserved = in.SystemReserved
out.SystemReservedCgroup = in.SystemReservedCgroup
out.EnforceNodeAllocatable = in.EnforceNodeAllocatable
return nil
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/kops/v1alpha2/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ type KubeletConfigSpec struct {

// 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"`

// Resource reservation for kubernetes system daemons like the kubelet,
// container runtime, node problem detector, etc.
KubeReserved map[string]string `json:"kubeReserved,omitempty" flag:"kube-reserved"`
// Control group for kube daemons.
KubeReservedCgroup string `json:"kubeReservedCgroup,omitempty" flag:"kube-reserved-cgroup"`
// Capture resource reservation for OS system daemons like sshd, udev, etc.
SystemReserved map[string]string `json:"systemReserved,omitempty" flag:"system-reserved"`
// Parent control group for OS system daemons.
SystemReservedCgroup string `json:"systemReservedCgroup,omitempty" flag:"system-reserved-cgroup"`
// Enforce Allocatable across pods whenever the overall usage across all pods
// exceeds Allocatable.
EnforceNodeAllocatable string `json:"enforceNodeAllocatable,omitempty" flag:"enforce-node-allocatable"`
}

type KubeProxyConfig struct {
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,11 @@ func autoConvert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele
out.VolumePluginDirectory = in.VolumePluginDirectory
out.Taints = in.Taints
out.FeatureGates = in.FeatureGates
out.KubeReserved = in.KubeReserved
out.KubeReservedCgroup = in.KubeReservedCgroup
out.SystemReserved = in.SystemReserved
out.SystemReservedCgroup = in.SystemReservedCgroup
out.EnforceNodeAllocatable = in.EnforceNodeAllocatable
return nil
}

Expand Down Expand Up @@ -1774,6 +1779,11 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K
out.VolumePluginDirectory = in.VolumePluginDirectory
out.Taints = in.Taints
out.FeatureGates = in.FeatureGates
out.KubeReserved = in.KubeReserved
out.KubeReservedCgroup = in.KubeReservedCgroup
out.SystemReserved = in.SystemReserved
out.SystemReservedCgroup = in.SystemReservedCgroup
out.EnforceNodeAllocatable = in.EnforceNodeAllocatable
return nil
}

Expand Down