kubernetes/pkg/kubelet/cm
Michael Taufen 1085b6f730 Lift embedded structure out of eviction-related KubeletConfiguration fields
- Changes the following KubeletConfiguration fields from `string` to
`map[string]string`:
  - `EvictionHard`
  - `EvictionSoft`
  - `EvictionSoftGracePeriod`
  - `EvictionMinimumReclaim`
- Adds flag parsing shims to maintain Kubelet's public flags API, while
enabling structured input in the file API.
- Also removes `kubeletconfig.ConfigurationMap`, which was an ad-hoc flag
parsing shim living in the kubeletconfig API group, and replaces it
with the `MapStringString` shim introduced in this PR. Flag parsing
shims belong in a common place, not in the kubeletconfig API.
I manually audited these to ensure that this wouldn't cause errors
parsing the command line for syntax that would have previously been
error free (`kubeletconfig.ConfigurationMap` was unique in that it
allowed keys to be provided on the CLI without values. I believe this was
done in `flags.ConfigurationMap` to facilitate the `--node-labels` flag,
which rightfully accepts value-free keys, and that this shim was then
just copied to `kubeletconfig`). Fortunately, the affected fields
(`ExperimentalQOSReserved`, `SystemReserved`, and `KubeReserved`) expect
non-empty strings in the values of the map, and as a result passing the
empty string is already an error. Thus requiring keys shouldn't break
anyone's scripts.
- Updates code and tests accordingly.

Regarding eviction operators, directionality is already implicit in the
signal type (for a given signal, the decision to evict will be made when
crossing the threshold from either above or below, never both). There is
no need to expose an operator, such as `<`, in the API. By changing
`EvictionHard` and `EvictionSoft` to `map[string]string`, this PR
simplifies the experience of working with these fields via the
`KubeletConfiguration` type. Again, flags stay the same.

Other things:
- There is another flag parsing shim, `flags.ConfigurationMap`, from the
shared flag utility. The `NodeLabels` field still uses
`flags.ConfigurationMap`. This PR moves the allocation of the
`map[string]string` for the `NodeLabels` field from
`AddKubeletConfigFlags` to the defaulter for the external
`KubeletConfiguration` type. Flags are layered on top of an internal
object that has undergone conversion from a defaulted external object,
which means that previously the mere registration of flags would have
overwritten any previously-defined defaults for `NodeLabels` (fortunately
there were none).
2017-11-16 18:35:13 -08:00
..
cpumanager Merge pull request #54409 from intelsdi-x/cpu-enable-state-file 2017-11-15 22:16:05 -08:00
cpuset update BUILD files 2017-10-15 18:18:13 -07:00
deviceplugin Merge pull request #52149 from lichuqiang/combineListwatch 2017-11-15 16:56:51 -08:00
util update BUILD files 2017-10-15 18:18:13 -07:00
BUILD Lift embedded structure out of eviction-related KubeletConfiguration fields 2017-11-16 18:35:13 -08:00
cgroup_manager_linux_test.go stop double encoding systemd style cgroup names 2017-02-21 16:34:21 -05:00
cgroup_manager_linux.go update cadvisor, docker, and runc godeps 2017-09-05 12:38:57 -07:00
cgroup_manager_test.go Lift embedded structure out of eviction-related KubeletConfiguration fields 2017-11-16 18:35:13 -08:00
cgroup_manager_unsupported.go kubelet: enable qos-level memory request reservation 2017-03-02 15:04:13 -06:00
container_manager_linux_test.go use GetFileType per mount.Interface to check hostpath type 2017-09-26 09:57:06 +08:00
container_manager_linux.go Enable file state in static policy 2017-11-14 18:25:58 +01:00
container_manager_stub.go add admission handler for device resources allocation 2017-11-02 09:17:48 +08:00
container_manager_unsupported_test.go Container manager has a bad fake interface 2017-11-03 22:21:29 -04:00
container_manager_unsupported.go add admission handler for device resources allocation 2017-11-02 09:17:48 +08:00
container_manager_windows.go Fix Start signature in container_manager_windows. 2017-09-04 07:24:59 -07:00
container_manager.go Lift embedded structure out of eviction-related KubeletConfiguration fields 2017-11-16 18:35:13 -08:00
fake_internal_container_lifecycle.go Un-revert "CPU manager wiring and none policy" 2017-09-04 07:24:59 -07:00
helpers_linux_test.go update cadvisor, docker, and runc godeps 2017-09-05 12:38:57 -07:00
helpers_linux.go pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
helpers_unsupported.go run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
internal_container_lifecycle.go Fixed nil InternalContainerLifecycle in cm stubs. 2017-09-04 07:24:59 -07:00
node_container_manager_test.go Fix --kube-reserved storage key name and add test cases for node allocatable reservation 2017-09-26 09:32:21 +08:00
node_container_manager.go apimachinery: remove Scheme.DeepCopy 2017-10-06 14:59:17 +02:00
pod_container_manager_linux.go pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
pod_container_manager_stub.go run hack/update-all 2017-06-22 11:31:03 -07:00
pod_container_manager_unsupported.go run hack/update-all 2017-06-22 11:31:03 -07:00
qos_container_manager_linux.go pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
types.go update cadvisor, docker, and runc godeps 2017-09-05 12:38:57 -07:00