Commit Graph

2432 Commits

Author SHA1 Message Date
Travis Rhoden
a30ba6197d
Internalize mount.Interface.IsMountPointMatch
IsMountPointMatch() had no callers outside of the mount package, and has
internal implementation details. This patch makes it no longer be
public.
2019-08-26 09:47:07 -06:00
Kubernetes Prow Robot
7ebbe34d9c
Merge pull request #81794 from codenrhoden/split-host-utils2
Split HostUtil functionality into its own files
2019-08-24 22:28:21 -07:00
Mike Spreitzer
3bb3db1d36 Bumped the number of times a node tries to lookup itself
Increased the number of tries in pkg/util/node/node.go::GetNodeIP by
1, because the kube-proxy was giving up too early.

This is meant to address #81879
2019-08-23 22:04:41 -04:00
Kubernetes Prow Robot
f1453953b7
Merge pull request #81745 from codenrhoden/mv-hasmountrefs
mv HasMountRefs from mount pkg to vol/util
2019-08-23 00:52:13 -07:00
Kubernetes Prow Robot
37651f1cef
Merge pull request #80368 from danwinship/iptables-checks
iptables feature detection improvements
2019-08-22 13:31:20 -07:00
Travis Rhoden
b94ee6bcb1
Split HostUtil functionality into its own files
This patch takes all the HostUtil functionality currently found in
mount*.go files and copies it into hostutil*.go files. Care was taken to
preserve git history to the fullest extent.

As part of doing this, some common functionality was moved into
mount_helper files in preperation for HostUtils to stay in k/k and Mount
to move out. THe tests for each relevant function were moved to test
files to match the appropriate location.
2019-08-22 11:19:52 -06:00
Travis Rhoden
e0050ebc94
move testfiles back 2019-08-22 10:42:34 -06:00
Travis Rhoden
c55b19bc0a
copy testfiles to hostutil dir 2019-08-22 10:42:02 -06:00
Travis Rhoden
8bac909287
move files back to mount 2019-08-22 10:39:18 -06:00
Travis Rhoden
6a21076039
copy mount files to hostutils 2019-08-22 10:37:37 -06:00
Travis Rhoden
a7830a2c6e
mv HasMountRefs from mount pkg to vol/util
HasMountRefs is only used internal to K8s and should not be moved out
with the mount package. move it to pkg/volume/util instead.
2019-08-21 14:53:34 -06:00
Yassine TIJANI
4d9e4f0b45 move ShuffleStrings to pkg/proxy
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-08-21 20:03:53 +01:00
Kubernetes Prow Robot
76e19a1619
Merge pull request #81204 from codenrhoden/rename-hu-pathexists
Rename HostUtils.ExistsPath to PathExists
2019-08-12 20:12:12 -07:00
Kubernetes Prow Robot
1d812991b6
Merge pull request #81230 from codenrhoden/rename-GetFSGroup
Rename HostUtils.GetFSGroup to HostUtils.GetOwner
2019-08-09 23:57:26 -07:00
Kubernetes Prow Robot
d816998bd8
Merge pull request #81187 from codenrhoden/rename-newosexec
Rename mount.NewOsExec to mount.NewOSExec
2019-08-09 22:17:13 -07:00
Kubernetes Prow Robot
c8c9d2e21c
Merge pull request #77167 from paulsubrata55/spaul-kube-proxy-fix
Fix for kube-proxy to wait for some duration for the node to be defined.
2019-08-09 19:47:14 -07:00
Travis Rhoden
0e73131ca6
Rename HostUtils.GetFSGroup to HostUtils.GetOwner
This patch renames GetFSGroup (a process property) to GetOwner (a file
property), returning both the uid and gid of the given pathname. This
method is only used in one place in the k/k codebase, but having
"GetOwner" instead of "GetGroup" seems to have more utility.
2019-08-09 13:20:35 -06:00
Travis Rhoden
14e25b7c04
Rename HostUtils.ExistsPath to PathExists 2019-08-09 12:40:19 -06:00
Travis Rhoden
4574473753
Rename mount.NewOsExec to mount.NewOSExec 2019-08-09 12:30:56 -06:00
Travis Rhoden
b47184e954
Fix most linting issues in pkg/util/mount
This patch adds comments to exported items that were missing them in
order to make the linter happy. Only code changes that were limited to
the scope of this package were made. There are other linting issues that
will effect callers, and that will be done a seperate patch.
2019-08-08 12:42:21 -06:00
Kubernetes Prow Robot
46e6fd12bf
Merge pull request #80526 from rosti/remove-normalizer
Remove unused package //pkg/util/normalizer
2019-08-08 10:03:58 -07:00
Kubernetes Prow Robot
19e85a9092
Merge pull request #80502 from xigang/master
Update CleanupAndExit and OnServiceSynced field comment and bugfix panic params in the construct method
2019-08-07 20:10:06 -07:00
Dan Winship
81cd27a51e iptables: simplify version handling 2019-08-01 12:05:31 -04:00
Dan Winship
8bced9b130 iptables: don't do feature detection on the iptables-restore binary
The iptables code was doing version detection on the iptables binary
but feature detection on the iptables-restore binary, to try to
support the version of iptables in RHEL 7, which claims to be 1.4.21
but has certain features from iptables 1.6.

The problem is that this particular set of versions and checks
resulted in the code passing "-w" ("wait forever for the lock") to
iptables, but "-w 5" ("wait at most 5 seconds for the lock") to
iptables-restore. On systems with very very many iptables rules, this
could result in the kubelet periodic resyncs (which use "iptables")
blocking kube-proxy (which uses "iptables-restore") and causing it to
time out.

We already have code to grab the lock file by hand when using a
version of iptables-restore that doesn't support "-w", and it works
fine. So just use that instead, and only pass "-w 5" to
iptables-restore when iptables reports a version that actually
supports it.
2019-08-01 11:49:50 -04:00
Emrecan BATI
90ce2d50d3 Add GetKernelVersion to ipvs.KernelHandler interface
ipvs `getProxyMode` test fails on mac as `utilipvs.GetRequiredIPVSMods`
try to reach `/proc/sys/kernel/osrelease` to find version of the running
linux kernel. Linux kernel version is used to determine the list of required
kernel modules for ipvs.

Logic to determine kernel version is moved to GetKernelVersion
method in LinuxKernelHandler which implements ipvs.KernelHandler.
Mock KernelHandler is used in the test cases.

Read and parse file is converted to go function instead of execing cut.
2019-07-31 22:10:44 +03:00
Rostislav M. Georgiev
8157c4c4a8 Remove unused package //pkg/util/normalizer
Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-07-25 15:36:00 +03:00
xigang
76aceca22f bugfix: panic log params in the construct method when maxInterval is less than minInterval 2019-07-24 09:42:13 +08:00
Kubernetes Prow Robot
5993ec5a5a
Merge pull request #80478 from silenceshell/patch-1
fix grammar error
2019-07-23 17:14:54 -07:00
Kubernetes Prow Robot
eb6bcfb345
Merge pull request #80096 from ZP-AlwaysWin/dev05
Fix golint failure in pkg/util/netsh/testing/
2019-07-23 17:14:41 -07:00
silenceshell
c9275c97aa
fix grammar err
"be of interest to you"
2019-07-23 19:18:29 +08:00
Kubernetes Prow Robot
f101466d2e
Merge pull request #77553 from s-urbaniak/fix-76956
pkg/util/workqueue/prometheus: fix double registration
2019-07-22 19:10:53 -07:00
ZP-AlwaysWin
a988719722 Fix golint failure in pkg/util/netsh/testing/ 2019-07-19 16:03:44 +08:00
Andrew Sy Kim
3629ed10fa add myself and lbernail as IPVS approvers
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-07-11 19:06:59 -04:00
Brian Goff
7077bbd783 Use O_CLOEXEC in util packages
This prevents fd's from leaking to subprocesses.
2019-07-09 10:04:00 -07:00
Kubernetes Prow Robot
c8cee54240
Merge pull request #79391 from danwinship/nodeaddresses-update-fix
Don't use strategic merge patch on Node.Status.Addresses
2019-07-02 21:08:29 -07:00
Dan Winship
05a9634fb3 Hack PatchNodeStatus() to override the patch type on Status.Addresses 2019-07-02 19:16:30 -04:00
Khaled Henidak(Kal)
dba434c4ba kubenet for ipv6 dualstack 2019-07-02 22:26:25 +00:00
Khaled Henidak(Kal)
584d7103e2 node ipam controller for ipv6 dualstack 2019-07-02 15:39:06 +00:00
Kubernetes Prow Robot
ca6113fb8b
Merge pull request #78495 from odinuge/cgroups-hugetlb
Fix cgroup hugetlb size prefix for kB
2019-06-28 16:09:29 -07:00
Kubernetes Prow Robot
2501a9083d
Merge pull request #68513 from codenrhoden/mount-refactor
Refactor util/mount interface in prep for moving out of k/k
2019-06-28 13:57:28 -07:00
Odin Ugedal
2bcdb944f0
Update dependency opencontainer/runc 2019-06-28 21:23:05 +02:00
Kubernetes Prow Robot
eee3e976d8
Merge pull request #78294 from vllry/kp-remove-resource-container
Remove deprecated flag --resource-container from kube-proxy
2019-06-22 00:38:12 -07:00
Kubernetes Prow Robot
efa043151c
Merge pull request #79094 from gaorong/fix-IsLikelyNotMountPoint
fix kubelet can not delete orphaned pod directory when "/var/lib/kubelet/pods" directory symbolically links to another device's directory
2019-06-18 19:02:31 -07:00
Kubernetes Prow Robot
d3bbe03b08
Merge pull request #79032 from yastij/move-initsystem
move initsystem to kubeadm
2019-06-17 09:42:15 -07:00
Kubernetes Prow Robot
3ee8ae2721
Merge pull request #78888 from tedyu/mount-ref
Return early when mount ref is determined
2019-06-17 04:36:50 -07:00
Yassine TIJANI
c3904bbce6 move initsystem to kubeadm
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-06-17 12:21:01 +02:00
Rong Gao
595fcf68d1 fix kubelet can not delete orphaned pod directory when the kubelet's root directory symbolically links to another device's directory 2019-06-17 15:39:25 +08:00
Vallery Lancey
dc0f14312e Removed deprecated --resource-container flag from kube-proxy. 2019-06-16 08:36:42 -07:00
Travis Rhoden
be7da5052f Refactor pkg/util/mount to be more reusable
This patch refactors pkg/util/mount to be more usable outside of
Kubernetes. This is done by refactoring mount.Interface to only contain
methods that are not K8s specific. Methods that are not relevant to
basic mount activities but still have OS-specific implementations are
now found in a mount.HostUtils interface.
2019-06-14 09:35:18 -06:00
Kubernetes Prow Robot
d30fbab4b8
Merge pull request #77915 from SataQiu/fix-golint-util-20190515
Fix golint failures of pkg/util/parsers pkg/util/sysctl pkg/util/system
2019-06-14 00:29:00 -07:00
Ted Yu
320dc6c54c Return early when mount ref is determined 2019-06-10 20:40:40 -07:00
Kubernetes Prow Robot
9b14c22375
Merge pull request #78428 from luksa/iptables-save-panic
Fix panic in kube-proxy when iptables-save prints to stderr
2019-05-31 23:23:00 -07:00
Kubernetes Prow Robot
5d1409a4bf
Merge pull request #78189 from ksubrmnn/initsystem
Use Service Control Manager as the Windows Initsystem
2019-05-31 22:02:34 -07:00
Kubernetes Prow Robot
bdf3d248eb
Merge pull request #77523 from andrewsykim/fix-xlb-from-local
iptables proxier: route local traffic to LB IPs to service chain
2019-05-31 12:22:53 -07:00
Kubernetes Prow Robot
46a3d82240
Merge pull request #78464 from andrewsykim/ipvs-reviewer
add myself and Laurent as ipvs proxy reviewers
2019-05-30 04:54:35 -07:00
ksubrmnn
4d7ee1cd5a Use system calls to manage Windows services 2019-05-29 17:33:47 -07:00
Kubernetes Prow Robot
e4c3540621
Merge pull request #78269 from jpbetz/reinvoke-intree
Reinvocation testing of in-tree admission plugins and fix podpreset to be idempotent
2019-05-29 03:11:03 -07:00
Kubernetes Prow Robot
1eba04822e
Merge pull request #78251 from byteor/master
[pkg/util/coverage]: group imports for readability
2019-05-29 03:10:38 -07:00
Andrew Sy Kim
f6d9a45643 add myself and Laurent as ipvs proxy reviewers
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-05-29 01:43:50 -04:00
Joe Betz
a6e1db97f0 Merge tolerations in a consistent order 2019-05-28 15:10:16 -07:00
Marko Lukša
93a549679f Capture stderr output and write it to buffer on error 2019-05-28 17:09:29 +02:00
Kubernetes Prow Robot
a57fbaf635
Merge pull request #78088 from andrewsykim/ipvs-unit-test-graceful-termination
ipvs: add graceful termination unit tests
2019-05-28 07:18:11 -07:00
Marko Lukša
00e7505618 Discard stderr output when calling iptables-save 2019-05-28 14:43:28 +02:00
Marko Lukša
df23697ae7 Better error message if panic occurs during iptables-save output parsing 2019-05-28 11:38:27 +02:00
Subrata Paul
2862f3ec94 Updated node.go using update-gofmt.sh 2019-05-25 00:46:50 +05:30
Zhou Peng
31daeed3b2 [pkg/util/coverage]: group imports for readability
Signed-off-by: Zhou Peng <p@ctriple.cn>
2019-05-23 21:38:12 +08:00
Kubernetes Prow Robot
d8c3348520
Merge pull request #74880 from smileusd/fix-IsLikelyNotMountPoint-function
distinguish between mountpoints and symbolic link in IsNotMountPoint
2019-05-22 04:00:12 -07:00
Kalya Subramanian
e0fec1dc28 Include golang.org/x/sys/windows/svc/mgr to manage Windows services 2019-05-20 23:28:56 +00:00
Kubernetes Prow Robot
e476a60ccb
Merge pull request #73241 from vikaschoudhary16/selinux-label
Add correct selinux label at plugin socket directory
2019-05-20 11:07:17 -07:00
smileusd
a81f770472 add annotation about IsLikelyNotMountPoint can't to distinguish mounts and symbolic link 2019-05-20 11:35:24 +08:00
Andrew Sy Kim
15682dfc2a export serviceKey and realServerKey in fake ipvs for easier test fixtures
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-05-19 23:09:42 +02:00
vikaschoudhary16
58d1b4d564 Add correct selinux label at plugin socket directory 2019-05-18 12:35:17 +05:30
Kubernetes Prow Robot
37281a400d
Merge pull request #76442 from viegasdom/fix-golint-utils-bandwith
Fix golint failures of util/bandwith/*.go
2019-05-15 22:56:08 -07:00
SataQiu
b36d8d431f fix golint failures of pkg/util/parsers pkg/util/sysctl pkg/util/system 2019-05-15 23:19:47 +08:00
Sergiusz Urbaniak
4532cfd85c
pkg/util/workqueue: delete deprecated metrics
This deletes deprecated metrics and simplifies registration.
2019-05-15 12:27:34 +02:00
Kubernetes Prow Robot
aa84b99fa0
Merge pull request #73101 from oz123/kubeadm_openrc_support
Add initial support for OpenRC
2019-05-10 10:37:59 -07:00
Sergiusz Urbaniak
0e291d1f1b
pkg/util/workqueue/prometheus: fix double registration
Currently, if workqueue metrics are registered twice, these metrics will be ignored. This fixes it.
2019-05-09 13:41:09 +02:00
Andrew Sy Kim
8dfd4def99 add unit tests for -src-type=LOCAL from LB chain
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-05-07 15:22:46 -04:00
Kubernetes Prow Robot
5b47a92ad8
Merge pull request #76359 from monstercy/fixtypo-20190320
correcting some spelling errors
2019-05-03 04:08:31 -07:00
Kubernetes Prow Robot
b5c34d0c43
Merge pull request #74734 from codenrhoden/move-mountspath
Move MountsInGlobalPDPath from mount pkg to volume
2019-05-01 17:28:18 -07:00
Dan Winship
4d77d3e75f Update iptables.IsNotFoundError for iptables-nft error messages 2019-05-01 10:42:30 -04:00
Travis Rhoden
12b7f1450c Move MountsInGlobalPDPath from mount pkg to volume
Since pkg/util/mount is going to move out of k/k, this exported constant
that is Kubernetes specific needed to move somewhere else. Made sense to
move it to pkg/volume/util.

Update GetDeviceNameFromMount in the mount interface to now take a
pluginMountDir argument, which is volume plugin dir with the global
mount path appended to it already.
2019-04-29 09:56:00 -06:00
Subrata Paul
7e04eeab50 Updated pkg node BUILD for new lib inclusion 2019-04-29 19:07:02 +05:30
Subrata Paul
dd9402f451 Fix for kube-proxy to wait for some duration for the node to be defined
Kube-proxy must atleast wait for some duration for the node to defined so that it can fetch the node IP. This node IP is currently used in ipvs proxier for the node-port services.
2019-04-28 00:25:18 +05:30
JieJhih Jhang
098a7c5972 fix golint 2019-04-26 15:37:38 +08:00
Kubernetes Prow Robot
9d617776a3
Merge pull request #76801 from logicalhan/metrics-owners
add owners file to util/metrics and auto-labeling
2019-04-19 20:30:14 -07:00
Davanum Srinivas
7b8c9acc09
remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d
2019-04-19 08:36:31 -04:00
Han Kang
d278d59328 add owners file to util/metrics and auto-labeling 2019-04-18 17:01:13 -07:00
Kubernetes Prow Robot
e8e1e9b667
Merge pull request #75119 from sungjunyoung/fix-typo
Fix typo, old link for contributors
2019-04-18 11:28:03 -07:00
Kubernetes Prow Robot
32a49828fe
Merge pull request #76456 from codenrhoden/mv-exec-mounter
Move ExecMount to pkg/volume/util/exec
2019-04-17 12:16:20 -07:00
Zihong Zheng
8ac6119bec Add OWNERS file for sig-network utils 2019-04-11 13:49:03 -07:00
Travis Rhoden
f38d4938be Move ExecMount to pkg/volume/util/exec
This patch moves the ExecMounter found in pkg/util/mount to
pkg/volume/util/exec. This is done in preparation for pkg/util/mount to
move out of tree. This specific implemention of mount.Interface is only
used internally to K8s and does not need to move out of tree.
2019-04-11 12:19:55 -06:00
viegasdom
80578d5bf1 Changes code that still used BandWidthShaper instead of Shaper 2019-04-11 18:50:32 +01:00
viegasdom
1c468bf2e2 Fix golint failures of util/bandwith/*.go 2019-04-11 15:07:41 +01:00
Kubernetes Prow Robot
c62cd6e3a4
Merge pull request #76047 from codenrhoden/mv-nsenter-mount
Move nsenter mounter to pkg/volume/util/nsenter
2019-04-09 09:55:59 -07:00
Oz N Tiram
2a40ef473f Add initial support for OpenRC
* Gentoo has init scripts for kubelet
 * Added a new method of the InitSystem Interface
   This helps issuing nicer messages when not on systemd.
 * OpenRCInitSystem.ServiceExists uses CombinedOutput because
   the behaviour of OpenRC is different from systemd.

This is a partial fix for

 https://github.com/kubernetes/kubeadm/issues/1295
2019-04-08 22:27:35 +02:00
Travis Rhoden
1c045a09db Move nsenter mounter to pkg/volume/util/nsenter
As part of moving pkg/util/mount out of tree, the NSEnter implementation
of mount.Interface needs to be relocated out of pkg/util/mount, as it is
K8s specific. This patch relocates that mounter implementation to
pkg/volume/util/nsenter.

Since the NSEnter mounter shares a lot of its logic with the Linux
mounter implementation, many of the previously private methods of the
Linux mounter are now made public to maintain that shared code.

Additionaly, it was observed that *all* mount.Interface implemenations
were using the same common method for IsNotMountPoint, so this patch
removes that method from the mount.Interface definition and just exports
the common implementation instead.
2019-04-08 09:53:46 -06:00
Travis Rhoden
6e5bf40dd2 Remove apimachinery dep from mount library
As part of wanting to move the mount library into staging and then
k8s.io/utils, there can be no dependencies on k/k code, and that
includes k/apimachinery.

This patch makes a small implementation change to no longer need
k8s.io/apimachinery/pkg/util/sets
2019-04-02 13:49:46 -06:00
Kubernetes Prow Robot
7d15d41eb8
Merge pull request #74159 from dlipovetsky/issue-73249-revise-parsetaint
Update v1.Taint parser to accept the form `key:effect` and `key=:effect-`
2019-04-02 01:36:35 -07:00
Han Kang
8f63657e26 log out metric registration errors instead of silently ignoring them 2019-03-26 11:29:27 -07:00
Kubernetes Prow Robot
7dfcacd1cf
Merge pull request #75700 from logicalhan/reflector-cleanup
cleanup of reflector metric code (finish removing unused code)
2019-03-25 23:13:31 -07:00
Han Kang
f7c23b1c1d cleanup of reflector metric code (finish removing unused code) 2019-03-25 15:12:09 -07:00
Kubernetes Prow Robot
f3efd1d0b7
Merge pull request #75036 from bart0sh/PR0065-kubeadm-replace-RequiredIPVSKernelModulesAvailable-check
kubeadm: reimplement IPVS check
2019-03-25 13:24:38 -07:00
Yu Cao
88204f6664 correcting some spelling errors 2019-03-20 19:33:35 +08:00
andyzhangx
4b4b6cdcab fix race condition issue for smb mount on windows
change var name
2019-03-14 15:02:15 +00:00
Ed Bartosh
2914171ed4 kubeadm: reimplement IPVS check
Used existing IPVS Proxier API CanUseIPVSProxier instead
of custom implementation.

Fixes kubernetes/kubeadm#975
2019-03-14 16:52:21 +02:00
Daniel Lipovetsky
653c710b0d Update v1.Taint parser to accept key:effect, key=:effect-, key, and key- forms
Also add missing tests for `key=:value` form.
2019-03-11 14:20:59 -07:00
andyzhangx
720a5e20d8 fix smb unmount issue on Windows
fix log warning

use IsCorruptedMnt in GetMountRefs on Windows

use errorno in IsCorruptedMnt check

fix comments: add more error code

add more error no checking

change year

fix comments
2019-03-10 02:13:16 +00:00
Junyoung, Sung
f76de72816 Fix typo in IsLikelyNotMountPoint function comment: --bin -> --bind 2019-03-08 00:58:44 +09:00
Kubernetes Prow Robot
59ee7353e8
Merge pull request #74625 from davidz627/fix/xfsUnmount
GetMountRefs fixed to handle corrupted mounts by treating it like an unmounted volume
2019-03-06 20:35:26 -08:00
David Zhu
5bf970f848 GetMountRefs fixed to handle corrupted mounts by treating it like an
unmounted volume
2019-03-06 14:34:16 -08:00
Kubernetes Prow Robot
43616fc920
Merge pull request #74033 from bart0sh/PR0060-kubeadm-975-RequiredIPVSKernelModulesAvailable-warning-seems-confusing
kubeadm: fix RequiredIPVSKernelModulesAvailable warning message
2019-03-05 02:04:03 -08:00
Kubernetes Prow Robot
9b8c58644a
Merge pull request #74418 from danielqsj/duration
convert latency/latencies in metrics name to duration
2019-03-01 17:58:12 -08:00
Kubernetes Prow Robot
84dce4d119
Merge pull request #74393 from codenrhoden/refactor-subpath
Refactor subpath out of pkg/util/mount
2019-02-27 15:54:36 -08:00
Han Kang
ca096f8069 Remove reflector metrics as they currently cause a memory leak 2019-02-26 20:11:22 -08:00
Travis Rhoden
2c4d748bed Refactor subpath out of pkg/util/mount
This patch moves subpath functionality out of pkg/util/mount and into a
new package pkg/volume/util/subpath. NSEnter funtionality is maintained.
2019-02-26 19:59:53 -07:00
Travis Rhoden
766cf26897 Move original mount files back
Move original mount files back into pkg/util/mount. This move is done to
preserve git history.
2019-02-26 12:18:25 -07:00
Travis Rhoden
f2438cacf5 Copy mount files to pkg/volume/util/subpath
Files in pkg/util/mount that contain significant code implementation for
subpaths are moved to a new package at pkg/volume/util/subpath. This
move is done in order to preserve git history.
2019-02-26 12:14:55 -07:00
Clayton Coleman
7f01e23380
Ignore the sticky gid mode bit when a test is running on memory EmptyDir
While running unit tests for perf on a Kube cluster with a memory backed
emptydir as TMPDIR, TestSafeMakeDir failed with:

```
--- FAIL: TestSafeMakeDir (0.01s)
	mount_linux_test.go:661: test "directory-exists": expected permissions 20000000750, got 20020000750
```

(TMPDIR set to /tmp/volume, /tmp/volume is EmptyDir with type Memory)

The test doesn't actually care about `os.ModeSetgid`, so specifically mask it out when testing this way.
2019-02-24 17:30:37 -08:00
danielqsj
f7b437cae0 convert latency in mertics name to duration 2019-02-22 21:40:13 +08:00
danielqsj
0e78dd2d17 fix shellcheck in pkg/util/verify-util-pkg.sh 2019-02-22 15:10:16 +08:00
Kubernetes Prow Robot
9027738dd5
Merge pull request #73661 from andyzhangx/smb-mount-windows
fix smb remount issue on Windows
2019-02-15 14:04:59 -08:00
andyzhangx
660813c2d1 fix smb remount issue on Windows
add comments for doSMBMount func

fix comments about smb mount
2019-02-14 14:19:24 +00:00
Ed Bartosh
09a2e49a94 kubeadm: fix RequiredIPVSKernelModulesAvailable warning message
RequiredIPVSKernelModulesAvailable warning confuses users suggesting
that the IPVS proxier will not be used, which is not always the case.

Made the warning message less confusing:

        [WARNING RequiredIPVSKernelModulesAvailable]:
The IPVS proxier may not be used because the following required kernel
modules are not loaded: [ip_vs_rr ip_vs_wrr ip_vs_sh]
or no builtin kernel ipvs support was found: map[ip_vs_wrr:{}
ip_vs_sh:{} nf_conntrack_ipv4:{} ip_vs:{} ip_vs_rr:{}].
However, these modules may be loaded automatically by kube-proxy for you
if they are available on your system.

To verify IPVS support:

   Run "lsmod | grep 'ip_vs\|nf_conntrack'" and verify each of the above
modules are listed.

If they are not listed, you can use the following methods to load them:

1. For each missing module run 'modprobe $modulename' (e.g., 'modprobe
ip_vs', 'modprobe ip_vs_rr', ...)
2. If 'modprobe $modulename' returns an error, you will need to install
the missing module support for your kernel.

Fixes: kubernetes/kubeadm#975
2019-02-13 22:54:34 +02:00
Kubernetes Prow Robot
5b7a790d35
Merge pull request #72185 from dcbw/owners-label-sig-network
OWNERS: add label:sig/network to a bunch of places
2019-02-08 10:36:16 -08:00
Kubernetes Prow Robot
b50c643be0
Merge pull request #73540 from rlenferink/patch-5
Updated OWNERS files to include link to docs
2019-02-08 09:05:56 -08:00
Davanum Srinivas
b975573385
move pkg/kubelet/apis/well_known_labels.go to staging/src/k8s.io/api/core/v1/
Co-Authored-By: Weibin Lin <linweibin1@huawei.com>

Change-Id: I163b2f2833e6b8767f72e2c815dcacd0f4e504ea
2019-02-05 13:39:07 -05:00
Roy Lenferink
b43c04452f Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
Ashish Ranjan
7be223e798 Refactor to use k8s.io/utils/net/ package instead of kubernetes/pkg/util/net/sets
Signed-off-by: Ashish Ranjan <ashishranjan738@gmail.com>
2019-02-04 10:34:53 +05:30
Kubernetes Prow Robot
4331660fcd
Merge pull request #73445 from danielqsj/fix-exec
migrate the rest reference of pkg/util/exec to k8s.io/utils/exec
2019-02-01 17:14:15 -08:00
Daniel (Shijun) Qian
e72b32558c
Merge branch 'master' into keymutex 2019-01-31 20:50:57 +08:00
Kubernetes Prow Robot
1f7e9fd9a2
Merge pull request #73488 from andrewsykim/replace-utils-file
Replace pkg/util/file with k8s.io/utils/path
2019-01-30 17:50:16 -08:00
Kubernetes Prow Robot
fcbe7f50f2
Merge pull request #71767 from roycaihw/crd-metrics-rename
Log prometheus metric registration error and fix CRD metric names
2019-01-30 16:38:51 -08:00
danielqsj
6535689680 clean pkg/util/strings 2019-01-30 10:24:00 +08:00
danielqsj
df7e4f3d49 clean pkg/util/keymutex 2019-01-30 10:23:59 +08:00
Andrew Kim
84191eb99b replace pkg/util/file with k8s.io/utils/path 2019-01-29 15:20:13 -05:00
Yi Tao
d1f85ffa71 fix TestEntry 2019-01-29 20:57:26 +08:00
danielqsj
c7a012f033 migrate the rest reference of pkg/util/exec to k8s.io/utils/exec 2019-01-29 10:55:10 +08:00
Andrew Kim
93b086f6ea replace k8s.io/apiserver/pkg/util/trace with k8s.io/utils/trace 2019-01-24 15:34:21 -05:00
Andrew Kim
2ea82cea20 replace pkg/util/nsenter with k8s.io/utils/nsenter 2019-01-24 13:49:04 -05:00
Andrew Kim
123590d911 replace pkg/util/io with k8s.io/utils/io 2019-01-24 13:49:04 -05:00
Kubernetes Prow Robot
3ebbbda3b7
Merge pull request #72679 from danielqsj/wqn
Mark deprecated in related workqueue metrics
2019-01-19 06:52:04 -08:00
Kubernetes Prow Robot
5b4b40cfe0
Merge pull request #72391 from cofyc/fix72387
Deprecate mount.IsNotMountPoint in favor of mounter.IsNotMountPoint
2019-01-18 19:13:49 -08:00
Kubernetes Prow Robot
cc67ccfd7f
Merge pull request #71731 from cheftako/leaseMetric
Add gauge metric for master of leader election.
2019-01-08 08:57:53 -08:00
danielqsj
9325c75f55 Mark deprecated in related workqueue metrics 2019-01-08 18:08:09 +08:00
Yecheng Fu
037ab98521 Deprecate mount.IsNotMountPoint 2019-01-06 20:25:31 +08:00
Kubernetes Prow Robot
39529006f0
Merge pull request #68128 from dixudx/util_nsenter_owner
add myself to util/nsneter owners
2019-01-05 01:35:24 -08:00
Michelle Au
7a4f906f25 Rename UnmountMountPoint to CleanupMountPoint 2019-01-03 16:35:54 -08:00
Michelle Au
1dacde1210 Move linux test utils to os-independent test file 2019-01-03 16:35:54 -08:00
Michelle Au
f33d5d3b05 Add comments around use of PathExists 2019-01-03 16:34:53 -08:00
Michelle Au
57c7a200f0 Add unit test for UnmountMountPoint 2019-01-03 16:34:53 -08:00
Michelle Au
15d44a64e9 Update doCleanSubpaths to use UnmountMountPoint 2019-01-03 16:34:53 -08:00
Michelle Au
002a4e33d8 Move unmount volume util from pkg/volume/util to pkg/util/mount 2019-01-03 16:34:53 -08:00
Kubernetes Prow Robot
7284660483
Merge pull request #71300 from danielqsj/71165
Use prometheus conventions for workqueue metrics
2018-12-31 21:18:45 -08:00
Walter Fender
f192657380 Add gauge metric for master of leader election.
Fixes #71730
0 indicates standby, 1 indicates master, label indicates which lease.
Tweaked name and documentation
Factored in Mike Danese feedback.
Removed dependency on prometheus from client-go using adapter.
Centralized adapter import.
Fixed godeps
Fixed boilerplate.
Put in fixes for caesarxuchao
2018-12-27 09:40:33 -08:00
Laurent Bernaille
1412d53b62 [kube-proxy/ipvs] Protect Netlink calls with a mutex 2018-12-27 10:53:27 +01:00
Kubernetes Prow Robot
68451f301b
Merge pull request #72291 from msau42/fix-subpath-orphan
Fix subpath issues with orphaned pod cleanup
2018-12-26 19:48:27 -08:00
Michelle Au
3ebbbbd5d8 Leave refactoring TODO 2018-12-26 10:49:28 -08:00
Jonathan Basseri
ec247ca0be Add godoc to pkg/util/configz.
Document the intended use of this package. In particular, document the
fact that it is intended for ComponentConfig.
2018-12-19 17:38:30 -08:00
Dan Williams
2e339188ed OWNERS: add label:sig/network to a bunch of places 2018-12-19 00:00:02 -06:00
Walter Fender
d92ee41e44 Fix issue where missing external IP address breaks SSH Tunnel.
Added unit test to cover missing external IP case.
Justin's feedback.
Lint fix.
Lavalmap's feedback.
2018-12-12 10:59:32 -08:00
danielqsj
42214c5ac4 Using histogram metrics instead of summary 2018-12-12 17:53:24 +08:00
danielqsj
b828bc1a50 Use prometheus conventions for workqueue metrics 2018-12-12 16:55:13 +08:00
Kubernetes Prow Robot
f0bae6e9c5
Merge pull request #71573 from JacobTanenbaum/UDP_conntrack
Correctly Clear conntrack entry on endpoint changes when using nodeport
2018-12-07 15:01:43 -08:00
Haowei Cai
b109fda56d generated 2018-12-06 16:36:14 -08:00
Haowei Cai
c449c2735f Log metric registration error 2018-12-05 19:05:30 -08:00
Jacob Tanenbaum
144280e7a7 Correctly Clear conntrack entrty on endpoint changes when using nodeport
When using NodePort to connect to an endpoint using UDP, if the endpoint is deleted on
restoration of the endpoint traffic does not flow. This happens because conntrack holds
the state of the connection and the proxy does not correctly clear the conntrack entry
for the stale endpoint.

Introduced a new function to conntrack ClearEntriesForPortNAT that uses the endpointIP
and NodePort to remove the stale conntrack entry and allow traffic to resume when
the endpoint is restored.

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
2018-12-03 15:02:48 -05:00
Jan Safranek
cfbf6aa925 Fix unit test to run with random UID
User that runs the tests desn't need to be in /etc/passwd and thus
user.Current() can fail. Assume the user is not root in this case.
2018-11-19 13:08:54 +01:00
k8s-ci-robot
bc6aee19b0
Merge pull request #70884 from lavalamp/workqueue
add a metric that can be used to notice stuck worker threads
2018-11-13 14:59:27 -08:00
Daniel Smith
980242c209 fixup! add longest_running_processor_microseconds metric 2018-11-12 21:57:57 -08:00
Daniel Smith
fd77aa5a41 add longest_running_processor_microseconds metric 2018-11-12 10:52:18 -08:00
Daniel Smith
578962d934 fixup! Test workqueue metrics
change units to seconds
2018-11-10 18:46:43 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Daniel Smith
6195d1005d add a metric that can be used to notice stuck worker threads 2018-11-09 10:50:11 -08:00
Weibin Lin
7a591ed361 update bazel 2018-11-05 10:33:31 +08:00
Weibin Lin
4b90559369 use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19 2018-11-05 10:33:31 +08:00
k8s-ci-robot
5fdad5c19f
Merge pull request #68771 from liyongxin/master
typo fix from utilites to utilities
2018-11-03 16:50:28 -07:00
k8s-ci-robot
0be22d8ace
Merge pull request #70230 from qingsenLi/git181025
fix golint for /pkg/util/ipconfig and /pkg/util/resourcecontainer
2018-10-31 11:50:23 -07:00
k8s-ci-robot
4c874dbefe
Merge pull request #66367 from cpuguy83/speedup_pidof
getPids - don't recursively traverse every dir in /proc
2018-10-29 15:53:41 -07:00
qingsenLi
ca74d32e4c fix golint for /pkg/util/ipconfig and /pkg/util/resourcecontainer-2 2018-10-26 23:58:30 +08:00
tanshanshan
0ecff590bb fix golint for some of pkg/util 2018-10-17 10:11:49 +08:00
WanLinghao
fe3131ba87 clean all unused packages under pkg/util 2018-10-15 09:54:08 +08:00
k8s-ci-robot
3dbb1481f2
Merge pull request #69491 from chrischdi/lint-pkg-util-strings
fix golint errors in pkg/util/strings
2018-10-11 18:26:43 -07:00
k8s-ci-robot
cda667e217
Merge pull request #69515 from WanLinghao/clean_term
clean unused package: pkg/util/term
2018-10-11 13:45:32 -07:00
k8s-ci-robot
820c9eef3f
Merge pull request #69512 from islinwb/reuse_GetNodeIP
Reuse func getNodeIP
2018-10-11 13:45:22 -07:00
Jan Safranek
0b8c472578 Fixed subpath in containerized kubelet.
IsNotMountPoint should return no error when the checked directory does not
exists - missing directory can't be mounted. Therefore containerized
kubelet should check if the target exists first before resolving symlinks.
EvalHostSymlinks() returns indistinguishible error in case the path does
not exist.
2018-10-09 13:11:23 +02:00
Weibin Lin
2d2ecb15d2 update bazel 2018-10-09 10:27:27 +08:00
Weibin Lin
0d57ec2938 reuse func getNodeIP 2018-10-09 10:27:27 +08:00
WanLinghao
26837d4858 clean unused package: pkg/util/term 2018-10-08 18:19:20 +08:00
Christian Schlotter
398039b36e fix golint errors in pkg/util/strings
Signed-off-by: Christian Schlotter <christi.schlotter@gmail.com>
2018-10-06 13:35:19 +02:00
k8s-ci-robot
ecfd1a3e56
Merge pull request #68945 from gnufied/fix-mount-options
Make sure we pass mount options while creating bind mounts
2018-10-01 09:27:54 -07:00
k8s-ci-robot
577e06e0b8
Merge pull request #69222 from SataQiu/fix-2018092805
fix typo
2018-10-01 04:40:34 -07:00
liangwei
456c351e31 fix bugs introduced by ipvs graceful termination 2018-09-30 16:40:13 +08:00
SataQiu
94a653f100 fix typo 2018-09-28 23:41:24 +08:00
liangwei
9e4f84f42e ipvs connection based graceful termination 2018-09-27 15:16:48 +08:00
liangwei
80ff8b359c ipvs support graceful termination 2018-09-27 15:14:51 +08:00
k8s-ci-robot
3fe21e5433
Merge pull request #68922 from BenTheElder/version-staging
move pkg/util/version to staging
2018-09-26 22:59:42 -07:00
k8s-ci-robot
29cff0d518
Merge pull request #68741 from jsafrane/fix-var-symlink
Fixed subpath cleanup when /var/lib/kubelet is a symlink.
2018-09-26 14:42:44 -07:00
Hemant Kumar
6eda6d1a06 Make sure we pass mount options while creating bind mounts
This fixes an inconsitency that exists in mounter
2018-09-26 15:12:05 -04:00
k8s-ci-robot
c7a67b3e1b
Merge pull request #68626 from gnufied/fix-netdev-mount-opt
Apply _netdev mount option in bind mount if available
2018-09-25 17:00:36 -07:00
k8s-ci-robot
450fdc9c09
Merge pull request #68608 from andyzhangx/UnmountDevice-windows
fix UnmountDevice failure on Windows
2018-09-25 17:00:17 -07:00
k8s-ci-robot
30bf07a8bc
Merge pull request #68344 from Nordix/nordix-dev
Include all used hash types in compare when creating ipsets
2018-09-25 14:40:51 -07:00
k8s-ci-robot
cdfd62ffb9
Merge pull request #68263 from islinwb/patch-1
add a missing "%s"
2018-09-25 06:13:53 -07:00
Benjamin Elder
8b56eb8588 hack/update-gofmt.sh 2018-09-24 12:21:29 -07:00
Benjamin Elder
f828c6f662 hack/update-bazel.sh 2018-09-24 12:03:24 -07:00
Benjamin Elder
088cf3c37b find & replace version import 2018-09-24 12:03:24 -07:00
Benjamin Elder
e01cb6fe80 hack/update-bazel.sh 2018-09-24 12:00:00 -07:00
Benjamin Elder
b22d036cf8 move pkg/util/version into staging 2018-09-24 12:00:00 -07:00
andyzhangx
74f010260f fix UnmountDevice failure on Windows
add comments

fix test failure
2018-09-19 01:44:01 +00:00
David Zhu
704573d304 GetMountRefs shouldn't error when file doesn'g exist in Windows and nsenter. Add unit test 2018-09-18 10:45:02 -07:00
Yongxin Li
6a98ce78e4 typo fix from utilites to utilities
Signed-off-by: Yongxin Li <yxli@alauda.io>
2018-09-18 13:52:04 +08:00
David Zhu
9d207b3e3c GetMountRefs should not fail if the path supplied does not exist anymore. It has no mount references 2018-09-17 17:35:12 -07:00
Jan Safranek
9e24ccbda0 Fixed subpath cleanup when /var/lib/kubelet is a symlink. 2018-09-17 15:52:25 +02:00
Hemant Kumar
e881a29107 Apply _netdev mount option in bind mount if available
_netdev mount option is a userspace mount option and
isn't copied over when bind mount is created and remount
also does not copies it over and hence must be explicitly
used with bind mount
2018-09-13 13:47:34 -04:00
Lars Ekman
e818b8ffc5 Fix issue #68338
The ipset KUBE-LOAD-BALANCER-SOURCE-CIDR is not recogized as
a hash set
2018-09-06 11:00:14 +02:00
Kubernetes Submit Queue
c3062bae21
Merge pull request #68233 from luxas/ccm_cleanup
Automatic merge from submit-queue (batch tested with PRs 68171, 67945, 68233). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Move the CloudControllerManagerConfiguration to an API group in `cmd/`

**What this PR does / why we need it**:
This PR is the last piece of https://github.com/kubernetes/kubernetes/issues/67233.
It moves the `CloudControllerManagerConfiguration` to its own `cloudcontrollermanager.config.k8s.io` config API group, but unlike the other components this API group is "private" (only available in `k8s.io/kubernetes`, which limits consumer base), as it's located entirely in `cmd/` vs a staging repo.
This decision was made for now as we're not sure what the story for the ccm loading ComponentConfig files is, and probably a "real" file-loading ccm will never exist in core, only helper libraries. Eventually the ccm will only be a library in any case, and implementors will/can use the base types the ccm library API group provides. It's probably good to note that there is no practical implication of this change as the ccm **cannot** read ComponentConfig files. Hencec the code move isn't user-facing.

With this change, we're able to remove `pkg/apis/componentconfig`, as this was the last consumer. That is hence done in this PR as well (so the move is easily visible in git, vs first one "big add" then a "big remove"). The only piece of code that was used was the flag helper structs, so I moved them to `pkg/util/flag` that I think makes sense for now.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
ref: kubernetes/community#2354

**Special notes for your reviewer**:

This PR builds on top of (first two commits, marked as `Co-authored by: @stewart-yu`) https://github.com/kubernetes/kubernetes/pull/67689

**Release note**:

```release-note
NONE
```
/assign @liggitt @sttts @thockin @stewart-yu
2018-09-05 21:36:41 -07:00
Lucas Käldström
3ff1e53111
Move the flag registration code from pkg/apis/componentconfig to pkg/util/flag 2018-09-05 14:03:05 +03:00
Weibin Lin
a1a8f36a69
add a missing "%s" 2018-09-05 10:45:03 +08:00
NickrenREN
8d3fdc5a32 fix UT errors and add new UTs 2018-09-03 13:35:17 +08:00
NickrenREN
7157d4582b make pathWithinBase public 2018-09-03 13:34:56 +08:00
Katharine Berry
9390847bd5 Change owners. 2018-08-31 18:01:02 -07:00
Katharine Berry
c3e08bec7a Add owners. 2018-08-31 17:51:42 -07:00
Katharine Berry
13d1961d2b Improve error behaviour of package coverage. 2018-08-31 17:06:20 -07:00
Katharine Berry
2d36e9e874 Add KUBE_COVERAGE_FLUSH_INTERVAL to set flush interval. 2018-08-31 15:52:48 -07:00
Katharine Berry
0fb4b920b5 Address review comments. 2018-08-31 10:49:36 -07:00
Di Xu
7162953a5f add myself to util/nsneter owners 2018-08-31 19:21:48 +08:00
Katharine Berry
6afc130340 Add autogenerated BUILD files. 2018-08-29 14:48:24 -07:00
Katharine Berry
da4bbd421c Add runtime coverage support. 2018-08-29 14:48:24 -07:00
Laszlo Janosi
cbe94df8c6 gofmt update 2018-08-27 05:59:50 +00:00
Laszlo Janosi
a6da2b1472 K8s SCTP support implementation for the first pull request
The requested Service Protocol is checked against the supported protocols of GCE Internal LB. The supported protocols are TCP and UDP.

SCTP is not supported by OpenStack LBaaS. If SCTP is requested in a Service with type=LoadBalancer, the request is rejected. Comment style is also corrected.

SCTP is not allowed for LoadBalancer Service and for HostPort. Kube-proxy can be configured not to start listening on the host port for SCTP: see the new SCTPUserSpaceNode parameter

changed the vendor github.com/nokia/sctp to github.com/ishidawataru/sctp. I.e. from now on we use the upstream version.

netexec.go compilation fixed. Various test cases fixed

SCTP related conformance tests removed. Netexec's pod definition and Dockerfile are updated to expose the new SCTP port(8082)

SCTP related e2e test cases are removed as the e2e test systems do not support SCTP

sctp related firewall config is removed from cluster/gce/util.sh. Variable name sctp_addr is corrected to sctpAddr in pkg/proxy/ipvs/proxier.go

cluster/gce/util.sh is copied from master
2018-08-27 05:56:27 +00:00
Kubernetes Submit Queue
b883c5905a
Merge pull request #67328 from cofyc/fix65113-2
Automatic merge from submit-queue (batch tested with PRs 66916, 67252, 67794, 67619, 67328). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Using a fixed set of locks, then we don't need to free unused locks anymore.

**What this PR does / why we need it**:

Using a fixed set of locks, then we don't need to free unused locks anymore.
See kubernetes/kubernetes/pull/66442 for discussions.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65113

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @msau42 
/assign @thockin
2018-08-24 15:25:17 -07:00
Yecheng Fu
798838a6a0 Using a fixed set of locks, then we don't need to free unused locks
anymore.
See kubernetes/kubernetes/pull/66442 for discussions.
2018-08-24 12:24:09 +08:00
Kubernetes Submit Queue
39e341c11f
Merge pull request #66639 from hanxiaoshuai/fix07251
Automatic merge from submit-queue (batch tested with PRs 66592, 66639). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

refactor some hard code in pkg/util/ipset/ipset.go

**What this PR does / why we need it**:
refactor some hard code in pkg/util/ipset/ipset.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-08-19 22:40:00 -07:00
Kubernetes Submit Queue
4c08bd9abc
Merge pull request #66592 from hanxiaoshuai/addut0723
Automatic merge from submit-queue (batch tested with PRs 66592, 66639). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add unit test for func EntryString in util/ipset

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
add unit test for func EntryString in util/ipset
**Release note**:

```release-note
NONE
```
2018-08-19 22:39:57 -07:00
Kubernetes Submit Queue
40af953850
Merge pull request #67068 from sttts/sttts-non-fatal-ratelimitermetircs-reuse
Automatic merge from submit-queue (batch tested with PRs 66793, 67405, 67068, 67501, 67484). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

pkg/util/metrics: make re-registration of RateLimiterMetric non-fatal

In integration tests we might register these metrics multiple times in parallel. Instead of unregistering and making somehow sure those tests can run in parallel, we just make the registration idem-potent.

Prerequisite for controller manager integration tests https://github.com/kubernetes/kubernetes/pull/64149.
2018-08-17 05:05:17 -07:00
Dr. Stefan Schimanski
e8300dea52 pkg/util/metrics: idem-potent registration of RateLimiterMetric and never cleanup 2018-08-17 09:15:33 +02:00
fisherxu
5a9bea0353 update bazel 2018-08-16 09:59:33 +08:00
x00416946 fisherxu
79e17e6cd7 use versioned api in kube-proxy 2018-08-16 09:59:33 +08:00
Kubernetes Submit Queue
cb1ef9f7e8
Merge pull request #64815 from dixudx/hostname_empty
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

error out empty hostname

**What this PR does / why we need it**:
For linux, the hostname is read from file `/proc/sys/kernel/hostname` directly, which can be overwritten with whitespaces.

Should error out such invalid hostnames.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes/kubeadm#835

**Special notes for your reviewer**:
/cc luxas timothysc 

**Release note**:

```release-note
nodes: improve handling of erroneous host names
```
2018-08-03 17:13:32 -07:00
Kubernetes Submit Queue
82c8e063b8
Merge pull request #66850 from linyouchong/pr-0801-issue66809
Automatic merge from submit-queue (batch tested with PRs 66850, 66902, 66779, 66864, 66912). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix unit test failure: TestNsenterExistsFile

**What this PR does / why we need it**:
Fix unit test failure: TestNsenterExistsFile

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66809 

**Special notes for your reviewer**:
NONE

**Release note**:
```release-note
NONE
```
2018-08-02 10:03:09 -07:00
linyouchong
708cff1a43 Fix unit test failure: TestNsenterExistsFile 2018-08-02 00:01:53 +08:00
Di Xu
b3dfe0c652 nodes: improve handling of erroneous host names 2018-08-01 14:57:25 +08:00
hangaoshuai
f189015c03 add unit test for func EntryString in util/ipset 2018-07-28 17:47:14 +08:00
stewart-yu
f1343af5d7 auto-generated file 2018-07-28 07:54:17 +08:00
stewart-yu
0edd8313b6 update godep for for move util/pointer to k8s.io/utils 2018-07-28 07:54:17 +08:00
hangaoshuai
5dfb0a2d60 add unit tests for checkIPandProtocol and setIPSetDefaults 2018-07-26 10:56:22 +08:00
hangaoshuai
7e66101218 refactor some hard code in pkg/util/ipset/ipset.go 2018-07-26 10:53:55 +08:00
hangaoshuai
18873a8d52 when hashsize is Invalid, add an error log 2018-07-25 12:01:34 +08:00
Brian Goff
01034af976 getPids - don't recursively traverse every dir
`filepath.Walk` recursively traverses every dir, which is not what is
needed for getPids.
Instead only read the list of dirs in the top level of `/proc`.

```
benchmark              old ns/op     new ns/op     delta
BenchmarkGetPids-4     868684        195522        -77.49%
```
2018-07-19 09:42:52 -07:00
Kubernetes Submit Queue
337dfe0a9c
Merge pull request #65594 from liggitt/node-csr-addresses-2
Automatic merge from submit-queue (batch tested with PRs 65052, 65594). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Derive kubelet serving certificate CSR template from node status addresses

xref https://github.com/kubernetes/features/issues/267
fixes #55633

Builds on https://github.com/kubernetes/kubernetes/pull/65587

* Makes the cloud provider authoritative when recording node status addresses
* Makes the node status addresses authoritative for the kube-apiserver determining how to speak to a kubelet (stops paying attention to the hostname label when determining how to reach a kubelet, which was only done to support kubelets < 1.5)
* Updates kubelet certificate rotation to be driven from node status
  * Avoids needing to compute node addresses a second time, and differently, in order to request serving certificates.
  * Allows the kubelet to react to changes in its status addresses by updating its serving certificate
  * Allows the kubelet to be driven by external cloud providers recording node addresses on the node status

test procedure:
```sh
# setup
export FEATURE_GATES=RotateKubeletServerCertificate=true
export KUBELET_FLAGS="--rotate-server-certificates=true --cloud-provider=external"

# cleanup from previous runs
sudo rm -fr /var/lib/kubelet/pki/

# startup
hack/local-up-cluster.sh

# wait for a node to register, verify it didn't set addresses
kubectl get nodes 
kubectl get node/127.0.0.1 -o jsonpath={.status.addresses}

# verify the kubelet server isn't available, and that it didn't populate a serving certificate
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
ls -la /var/lib/kubelet/pki

# set an address on the node
curl -X PATCH http://localhost:8080/api/v1/nodes/127.0.0.1/status \
  -H "Content-Type: application/merge-patch+json" \
  --data '{"status":{"addresses":[{"type":"Hostname","address":"localhost"}]}}'

# verify a csr was submitted with the right SAN, and approve it
kubectl describe csr
kubectl certificate approve csr-...

# verify the kubelet connection uses a cert that is properly signed and valid for the specified hostname, but NOT the IP
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
curl --cacert _output/certs/server-ca.crt -v https://127.0.0.1:10250/pods
ls -la /var/lib/kubelet/pki

# set an hostname and IP address on the node
curl -X PATCH http://localhost:8080/api/v1/nodes/127.0.0.1/status \
  -H "Content-Type: application/merge-patch+json" \
  --data '{"status":{"addresses":[{"type":"Hostname","address":"localhost"},{"type":"InternalIP","address":"127.0.0.1"}]}}'

# verify a csr was submitted with the right SAN, and approve it
kubectl describe csr
kubectl certificate approve csr-...

# verify the kubelet connection uses a cert that is properly signed and valid for the specified hostname AND IP
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
curl --cacert _output/certs/server-ca.crt -v https://127.0.0.1:10250/pods
ls -la /var/lib/kubelet/pki
```

```release-note
* kubelets that specify `--cloud-provider` now only report addresses in Node status as determined by the cloud provider
* kubelet serving certificate rotation now reacts to changes in reported node addresses, and will request certificates for addresses set by an external cloud provider
```
2018-07-11 22:25:07 -07:00
Kubernetes Submit Queue
0972ce1acc
Merge pull request #65649 from rsc/fix-printf
Automatic merge from submit-queue (batch tested with PRs 66076, 65792, 65649). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubernetes: fix printf format errors

These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

```release-note
NONE
```
2018-07-11 14:09:08 -07:00
Russ Cox
2bd91dda64 kubernetes: fix printf format errors
These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

Lubomir I. Ivanov <neolit123@gmail.com>
applied ammend for:
  pkg/cloudprovider/provivers/vsphere/nodemanager.go
2018-07-11 00:10:15 +03:00
Kubernetes Submit Queue
421789328f
Merge pull request #65997 from tallclair/writer
Automatic merge from submit-queue (batch tested with PRs 66030, 65997). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove unused io util writer & volume host GetWriter()

Cleanup unused code.
Fixes https://github.com/kubernetes/kubernetes/issues/16971

**Release note**:
```release-note
NONE
```

/kind cleanup
/sig storage
2018-07-10 12:46:09 -07:00
Jordan Liggitt
7af8c6acc4
Make node status addresses authoritative for kube-apiserver -> kubelet connections 2018-07-10 14:33:49 -04:00
Kubernetes Submit Queue
13f9c26fd7
Merge pull request #65902 from wojtek-t/kube_proxy_less_allocations_2
Automatic merge from submit-queue (batch tested with PRs 65902, 65781). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Avoid unnecessary allocations in kube-proxy
2018-07-09 23:07:01 -07:00
Tim Allclair
b1012b2543
Remove unused io util writer & volume host GetWriter() 2018-07-09 14:09:48 -07:00
Kubernetes Submit Queue
3155ea2a18
Merge pull request #65549 from gnufied/fix-flexvolume-containers
Automatic merge from submit-queue (batch tested with PRs 65456, 65549). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix flexvolume in containerized kubelets

Fixes flex volumes in containerized kubelets.

cc @jsafrane @chakri-nelluri @verult 

Note to reviewers : e2e tests pass in local containarized cluster. 

```release-note
Fix flexvolume in containarized kubelets
```
2018-07-09 06:24:06 -07:00
wojtekt
6e50f39dbd Avoid allocations when parsing iptables 2018-07-08 10:55:19 +02:00
Kubernetes Submit Queue
5114d4e0b0
Merge pull request #65815 from wojtek-t/kube_proxy_less_allocations
Automatic merge from submit-queue (batch tested with PRs 65897, 65909, 65856, 65815). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Reduce number of memory allocations when parsing iptables
2018-07-06 12:25:13 -07:00
wojtekt
d073b2097f Optimize iptables 2018-07-06 14:25:56 +02:00
Hemant Kumar
8db5328c4c Implement fixes for flexvolume when kubelet is contanerized
Fix bug with nsenter root path
2018-07-03 14:04:52 -04:00
andyzhangx
27bc865cc1 fix smb mount security issue 2018-07-03 08:03:31 +00:00
Hong Zhiguo
9d0b4853cc fix ipset creation fails on centos. issue 65461 2018-06-27 21:45:33 +08:00
Kubernetes Submit Queue
24ab69d358
Merge pull request #65447 from wongma7/mapvolume-symlink
Automatic merge from submit-queue (batch tested with PRs 65492, 65516, 65447). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Resolve potential devicePath symlink when MapVolume in containerized kubelet

**What this PR does / why we need it**: Ensures local block volumes will work in case kubelet is running in a container

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65445

**Special notes for your reviewer**: Code is mostly plumbing. If there is a better way to do it, let me know :)

I assume there will be e2e tests for the non-containerized case. I will need to test the containerized case myself, which may take a while.
**Release note**:

```release-note
NONE
```
2018-06-27 02:15:12 -07:00
Matthew Wong
b376b31ee0 Resolve potential devicePath symlink when MapVolume in containerized kubelet 2018-06-26 13:08:36 -04:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton
a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue
300f4915f3
Merge pull request #65216 from wojtek-t/log_long_iptables_operations
Automatic merge from submit-queue (batch tested with PRs 65152, 65199, 65179, 64598, 65216). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Log long operations on iptables

Ref #48107
2018-06-21 18:20:19 -07:00
Kubernetes Submit Queue
152b0c12da
Merge pull request #64831 from brendandburns/todo
Automatic merge from submit-queue (batch tested with PRs 58690, 64773, 64880, 64915, 64831). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Address an old 'TODO' and lazy initialize firewallD signal handler.

@kubernetes/sig-network-misc
2018-06-20 14:21:24 -07:00
Yecheng Fu
c542b6be5d Remove mount.GetMountRefs in favor of mounter.GetMountRefs 2018-06-20 17:01:27 +08:00
Kubernetes Submit Queue
148350d3c4
Merge pull request #64426 from cofyc/remove_unnecessary_fakemounters
Automatic merge from submit-queue (batch tested with PRs 64142, 64426, 62910, 63942, 64548). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Clean up fake mounters.

**What this PR does / why we need it**:

Fixes https://github.com/kubernetes/kubernetes/issues/61502

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

list of fake mounters:

- (keep) pkg/util/mount.FakeMounter
- (removed) pkg/kubelet/cm.fakeMountInterface:
- (inherit from mount.FakeMounter) pkg/util/mount.fakeMounter
- (inherit from mount.FakeMounter) pkg/util/removeall.fakeMounter
- (removed) pkg/volume/host_path.fakeFileTypeChecker

**Release note**:

```release-note
NONE
```
2018-06-20 00:05:10 -07:00
wojtekt
0f9df22616 Log long operations on iptables 2018-06-20 08:43:42 +02:00
Kubernetes Submit Queue
77cf4fe2cc
Merge pull request #65161 from islinwb/add_to_reviewers
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add islinwb to pkg/util/ipset reviewers list

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-19 18:48:34 -07:00
Kubernetes Submit Queue
516167dce2
Merge pull request #64138 from jsafrane/nsenter-approvers
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Create nsenter OWNERS

- I (and Red Hat) runs parts of its deployments with containerized kubelet, so I am committed to have nsenter working long term. I reviewed most (if not all) PRs in pkg/util/nsenter.

I don't like single person in OWNERS (due to holidays, time zones, ...), so:

- @msau42 has worked on or reviewed latest nsenter patches for pkg/util/mount

- @cofyc has contributed several patches in nsenter area in pkg/util/mount, pkg/util/nsenter and hack/local-up-cluster.sh.

```release-note
NONE
```
2018-06-19 18:44:29 -07:00
Weibin Lin
86e35b4463 add islinwb to pkg/util/ipset reviewers list 2018-06-16 11:40:52 +08:00
Brendan Burns
7b02b6d98c Address a TODO, move to lazy initialization of the firewallD signal handler. 2018-06-07 22:05:20 -07:00
Lucas Käldström
1a0de9442e
Add a 'kubeadm upgrade node config' command and finish up the kubelet integration work 2018-06-06 23:17:04 +03:00
Michelle Au
f3f1a04705 Only mount subpath as readonly if specified in volumeMount 2018-06-04 12:05:23 -07:00
Yecheng Fu
40c3937320 Clean up fake mounters. 2018-06-02 15:55:19 +08:00
Kubernetes Submit Queue
2aced6d9e4
Merge pull request #63248 from andyzhangx/formatAndMount-windows
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix formatAndMount func issue on Windows

**What this PR does / why we need it**:
disk format code is missing in formatAndMount func on Windows, currently it only has mount related code:
b87a392b1a/pkg/util/mount/mount_windows.go (L356-L377)

format code is now here, which is not correct(invoked in `azuredisk.WaitForAttach` operation, it's not correct, these code should be in `formatAndMount` func and invoked by `MountDevice` operation finally)
b87a392b1a/pkg/volume/azure_dd/azure_common_windows.go (L100-L117)

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63236 

**Special notes for your reviewer**:
This is the first PR,  in second PR, I will remove disk format code in azure_common_windows.go
b87a392b1a/pkg/volume/azure_dd/azure_common_windows.go (L100-L117)

Also need to mention that there would not be issue if  following command invoked twice(by `WaitForAttach` and `formatAndMount`)
```
Get-Disk -Number 4 | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru  | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem ntfs -Confirm:$false
```
**Release note**:

```
fix formatAndMount func issue on Windows
```

/sig windows
/assign @rootfs 
cc @msau42
2018-06-01 21:25:57 -07:00
Kubernetes Submit Queue
d2495b8329
Merge pull request #63143 from jsafrane/containerized-subpath
Automatic merge from submit-queue (batch tested with PRs 63348, 63839, 63143, 64447, 64567). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Containerized subpath

**What this PR does / why we need it**:
Containerized kubelet needs a different implementation of `PrepareSafeSubpath` than kubelet running directly on the host.

On the host we safely open the subpath and then bind-mount `/proc/<pidof kubelet>/fd/<descriptor of opened subpath>`.

With kubelet running in a container, `/proc/xxx/fd/yy` on the host contains path that works only inside the container, i.e. `/rootfs/path/to/subpath` and thus any bind-mount on the host fails.

Solution:
- safely open the subpath and gets its device ID and inode number
- blindly bind-mount the subpath to `/var/lib/kubelet/pods/<uid>/volume-subpaths/<name of container>/<id of mount>`. This is potentially unsafe, because user can change the subpath source to a link to a bad place (say `/run/docker.sock`) just before the bind-mount.
- get device ID and inode number of the destination. Typical users can't modify this file, as it lies on /var/lib/kubelet on the host.
- compare these device IDs and inode numbers.

**Which issue(s) this PR fixes**
Fixes #61456

**Special notes for your reviewer**:

The PR contains some refactoring of `doBindSubPath` to extract the common code. New `doNsEnterBindSubPath` is added for the nsenter related parts.

**Release note**:

```release-note
NONE
```
2018-06-01 12:12:19 -07:00
Minhan Xia
212a16eccc add utils to patch pod status 2018-05-30 11:15:47 -07:00
Yecheng Fu
28b6f34107 Should use hostProcMountinfoPath constant in nsenter_mount.go. 2018-05-26 00:09:25 +08:00
Kubernetes Submit Queue
481b2dc7cf
Merge pull request #62102 from cofyc/fixlocalvolumefsgroup
Automatic merge from submit-queue (batch tested with PRs 64013, 63896, 64139, 57527, 62102). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Setup fsGroup for local volumes correctly

**What this PR does / why we need it**:

This pr fixes fsGroup check in local volume in containerized kubelet. Except this, it also fixes fsGroup check when volume source is a normal directory whether kubelet is running on the host or in a container.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61741 

**Special notes for your reviewer**:

Bind mounts are detected in `/proc/mounts`, but it does not contain root of mount for bind mounts. So `mount.GetMountRefsByDev()` cannot get all references if source is a normal directory. e.g.

```
# mkdir /tmp/src /mnt/dst
# mount --bind /tmp/src /tmp/src # required by local-volume-provisioner, see https://github.com/kubernetes-incubator/external-storage/pull/499
# mount --bind /tmp/src /mnt/dst
# grep -P 'src|dst' /proc/mounts 
tmpfs /tmp/src tmpfs rw,nosuid,nodev,noatime,size=4194304k 0 0
tmpfs /mnt/dst tmpfs rw,nosuid,nodev,noatime,size=4194304k 0 0
# grep -P 'src|dst' /proc/self/mountinfo 
234 409 0:42 /src /tmp/src rw,nosuid,nodev,noatime shared:30 - tmpfs tmpfs rw,size=4194304k
235 24 0:42 /src /mnt/dst rw,nosuid,nodev,noatime shared:30 - tmpfs tmpfs rw,size=4194304k
```

We need to compare root of mount and device in this case.

**Release note**:

```release-note
NONE
```
2018-05-23 19:44:24 -07:00
Kubernetes Submit Queue
60b626379b
Merge pull request #64102 from atombender/ext-reserved-blocks
Automatic merge from submit-queue (batch tested with PRs 64102, 63303, 64150, 63841). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

When creating ext3/ext4 volume, disable reserved blocks

**What this PR does / why we need it**:
When creating ext3/ext4 volume, `mkfs` defaults to reserving 5% of the volume for the super-user (root). This patch changes the `mkfs` to pass `-m0` to disable this setting.

Rationale: Reserving a percentage of the volume is generally a neither useful nor desirable feature for volumes that aren't used as root file systems for Linux distributions, since the reserved portion becomes unavailable for non-root users. For containers, the general case is to use the entire volume for data, without running as root. The case where one might want reserved blocks enabled is much rarer.

**Special notes for your reviewer**:
I also added some comments to describe the flags passed to `mkfs`.

**Release note**:

```release-note
Changes ext3/ext4 volume creation to not reserve any portion of the volume for the root user.
```
2018-05-23 04:53:13 -07:00
Jan Safranek
cb5eb25ec1 Nsenter unit tests 2018-05-23 10:21:21 +02:00
Jan Safranek
9b74125440 Pass Nsenter to NsenterMounter and NsenterWriter
So Nsenter is initialized only once and with the right parameters.
2018-05-23 10:21:21 +02:00
Jan Safranek
a8a37fb714 Created directories in /var/lib/kubelet directly. 2018-05-23 10:21:21 +02:00
Jan Safranek
9f80de3772 Split NsEnterMounter and Mounter implementation of doBindSubpath
nsenter implementation needs to mount different thing in the end and do
different checks on the result.
2018-05-23 10:21:21 +02:00
Jan Safranek
225a879b07 Refactor doBindSubPath into smaller functions:
- getSubpathBindTarget() computes final target of subpath bind-mount.
- prepareSubpathTarget() creates target for bind-mount.
- safeOpenSubPath() checks symlinks in Subpath and safely opens it.
2018-05-23 10:21:21 +02:00
Jan Safranek
7e3fb502a8 Change SafeMakeDir to resolve symlinks in mounter implementation
Kubelet should not resolve symlinks outside of mounter interface.
Only mounter interface knows, how to resolve them properly on the host.

As consequence, declaration of SafeMakeDir changes to simplify the
implementation:
from SafeMakeDir(fullPath string, base string, perm os.FileMode)
to   SafeMakeDir(subdirectoryInBase string, base string, perm os.FileMode)
2018-05-23 10:21:20 +02:00
Jan Safranek
74ba0878a1 Enhance ExistsPath check
It should return error when the check fails (e.g. no permissions, symlink link
loop etc.)
2018-05-23 10:21:20 +02:00
Jan Safranek
7450d1b427 Allow EvalSymlinks target not to exist.
Various NsEnterMounter function need to resolve the part of the path that
exists and blindly add the part that doesn't.
2018-05-23 10:21:18 +02:00
Jan Safranek
97b5299cd7 Add GetMode to mounter interface.
Kubelet must not call os.Lstat on raw volume paths when it runs in a container.
Mounter knows where the file really is.
2018-05-23 10:17:59 +02:00
Yecheng Fu
df0f108a02 Fixes fsGroup check in local volume in containerized kubelet. Except
this, it also fixes fsGroup check when volume source is a normal
directory whether kubelet is running on the host or in a container.
2018-05-23 10:41:42 +08:00
Kubernetes Submit Queue
36b1f67617
Merge pull request #64026 from jsafrane/csi-selinux
Automatic merge from submit-queue (batch tested with PRs 63914, 63887, 64116, 64026, 62933). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Enable SELinux relabeling in CSI volumes

**What this PR does / why we need it**:
CSI volume plugin should provide correct information in `GetAttributes` call so kubelet can ask container runtime to relabel the volume. Therefore CSI volume plugin needs to check if a random volume mounted by a CSI driver supports SELinux or not by checking for "seclabel" mount or superblock option.


**Which issue(s) this PR fixes**
Fixes #63965

**Release note**:
```release-note
NONE
```

@saad-ali @vladimirvivien @davidz627 
@cofyc, FYI, I'm changing `struct mountInfo`.
2018-05-22 17:36:18 -07:00
Kubernetes Submit Queue
773ced14ce
Merge pull request #63887 from luxas/kubeadm_kubelet_integration
Automatic merge from submit-queue (batch tested with PRs 63914, 63887, 64116, 64026, 62933). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubeadm: Write kubelet config file to disk and persist in-cluster

**What this PR does / why we need it**:
In order to make configuration flow from the cluster level to node level, we need a way for kubeadm to tell the kubelet what config to use. As of v1.10 (I think) the kubelet can read `--config` using the kubelet Beta ComponentConfiguration API, so now we have an interface to talk to the kubelet properly.

This PR:
 - Writes the kubelet ComponentConfig to `/var/lib/kubelet/config.yaml` on init and join
 - Writes an environment file to source in the kubelet systemd dropin `/var/lib/kubelet/kubeadm-flags.env`. This file contain runtime flags that should be passed to the kubelet.
 - Uploads a ConfigMap with the name `kubelet-config-1.X`
 - Patches the node object so that it starts using the ConfigMap with updates using Dynamic Kubelet Configuration, **only if the feature gate is set** (currently alpha and off by default, not intended to be switched on in v1.11)
 - Updates the phase commands to reflect this new flow

The kubelet dropin file I used now looks like this:
```
# v1.11.x dropin as-is at HEAD
# /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
---
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
EnvironmentFile-=/var/lib/kubelet/kubeadm-flags.env
# Should default to 0 in v1.11: https://github.com/kubernetes/kubernetes/pull/63881, and hence not be here in the real v1.11 manifest
Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0"
# Should be configurable via the config file: https://github.com/kubernetes/kubernetes/issues/63878, and hence be configured using the file in v1.11
Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS
---
# v1.11.x dropin end goal
# /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
---
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
EnvironmentFile-=/var/lib/kubelet/kubeadm-flags.env
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
---
# Environment file dynamically created at runtime by "kubeadm init"
# /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS=--cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --network-plugin=cni
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubeadm/issues/822
Fixes https://github.com/kubernetes/kubeadm/issues/571

**Special notes for your reviewer**:

**Release note**:

```release-note
"kubeadm init" now writes a structured and versioned kubelet ComponentConfiguration file to `/var/lib/kubelet/config.yaml` and an environment file with runtime flags (you can source this file in the systemd kubelet dropin) to `/var/lib/kubelet/kubeadm-flags.env`.
```
@kubernetes/sig-cluster-lifecycle-pr-reviews @mtaufen
2018-05-22 17:36:12 -07:00
Jan Safranek
49b3de6623 Create nsenter OWNERS 2018-05-22 10:04:58 +02:00
Lucas Käldström
0aa0f3208a
kubeadm: Write kubelet config file to disk and persist in-cluster. Also write runtime environment file and fixup the kubelet phases command 2018-05-22 09:12:25 +03:00
stewart-yu
5f4025c029 auto generated file 2018-05-22 11:20:47 +08:00