Commit Graph

2079 Commits (750881c0ab62a9f59d53582bc33826caa167aa83)

Author SHA1 Message Date
andyzhangx 6c2060db86 fix formatAndMount func issue on Windows
fix comments
2018-05-18 05:20:20 +00:00
Jan Safranek 598ca5accc Add GetSELinuxSupport to mounter. 2018-05-17 13:36:37 +02:00
Kubernetes Submit Queue 932bd19fd6
Merge pull request #63332 from zhouhaibing089/exec-timeout
Automatic merge from submit-queue (batch tested with PRs 63792, 63495, 63742, 63332, 63779). 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 timeout for exec interface

This should get us away from situations like https://github.com/kubernetes/kubernetes/issues/63331.

A little bit more context, the `os/exec` package starts to accept `context.Context` in golang 1.7. We should leverage that so we can have a more predictable behavior, then. 

```release-note
NONE
```
2018-05-15 09:04:28 -07:00
Kubernetes Submit Queue 89b747b39b
Merge pull request #63272 from andyzhangx/IsLikelyNotMountPoint-windows-fix
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 mount unmount failure for a Windows pod

**What this PR does / why we need it**:
`IsLikelyNotMountPoint` func does not return correctly, for invalid symlink, it should return true(not a mount point), now it will always return false:
7711d88661/pkg/util/mount/mount_windows.go (L141-L148)

7711d88661/pkg/volume/util/util.go (L147-L163)

**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 #63249

**Special notes for your reviewer**:

**Release note**:

```
fix mount unmount failure for a Windows pod
```

/sig windows
/assign @msau42
2018-05-15 04:47:09 -07:00
Weibin Lin 10664ee8c6 Add comments for ipset entries in kube-proxy 2018-05-11 17:11:34 +08:00
Kubernetes Submit Queue b733342f3c
Merge pull request #61883 from CaoShuFeng/configz
Automatic merge from submit-queue (batch tested with PRs 63297, 61883). 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>.

set right Content-Type for configz

**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-05-08 20:38:11 -07:00
andyzhangx 1d24f48bba add IsLikelyNotMountPoint test on Windows
fix comments

fix comments on unit test

fix comments
2018-05-09 02:41:38 +00:00
Kubernetes Submit Queue e6b6e5c4b4
Merge pull request #63045 from msau42/fix-subpath-readonly
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>.

passthrough readOnly to subpath

**What this PR does / why we need it**:
If a volume is mounted as readonly, or subpath volumeMount is configured as readonly, then the subpath bind mount should be readonly.

**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 #62752

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes issue where subpath readOnly mounts failed
```
2018-05-07 23:36:49 -07:00
andyzhangx 5671cd81df fix IsLikelyNotMountPoint func on Windows 2018-05-08 05:50:30 +00:00
Kubernetes Submit Queue 54cf942a05
Merge pull request #63399 from andyzhangx/mount-windows-test-fix
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>.

use TempDir func in mount_windows_test.go

**What this PR does / why we need it**:
Use `c:\tmp` dir is not correct in windows test, this PR use `ioutil.TempDir("", xx)` to create temp dir instead.

**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**:

```
none
```

/assign @jsafrane @msau42
2018-05-04 05:30:42 -07:00
andyzhangx 3db442bcd0 use TempDir func in mount_windows_test.go
fix comments
2018-05-03 12:58:32 +00:00
Kubernetes Submit Queue 186dd7beb1
Merge pull request #62903 from cofyc/fixfsgroupcheckinlocal
Automatic merge from submit-queue (batch tested with PRs 62657, 63278, 62903, 63375). 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 more volume types in e2e and fix part of them.

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

- Add dir-link/dir-bindmounted/dir-link-bindmounted/bockfs volume types for e2e tests.
- Fix fsGroup related e2e tests partially.
- Return error if we cannot resolve volume path.
  - Because we should not fallback to volume path, if it's a symbolic link, we may get wrong results.

To safely set fsGroup on local volume, we need to implement these two methods correctly for all volume types both on the host and in container:

- get volume path kubelet can access
  - paths on the host and in container are different
- get mount references
  - for directories, we cannot use its mount source (device field) to identify mount references, because directories on same filesystem have same mount source (e.g. tmpfs), we need to check filesystem's major:minor and directory root path on it

Here is current status:

| | (A) volume-path (host) | (B) volume-path (container) | (C) mount-refs (host) | (D) mount-refs (container) |
| --- | --- | --- | --- | --- |
| (1) dir | OK | FAIL | FAIL | FAIL |
| (2) dir-link | OK | FAIL | FAIL | FAIL |
| (3) dir-bindmounted | OK | FAIL | FAIL | FAIL |
| (4) dir-link-bindmounted | OK | FAIL | FAIL | FAIL |
| (5) tmpfs| OK | FAIL | FAIL | FAIL |
| (6) blockfs| OK | FAIL | OK | FAIL |
| (7) block| NOTNEEDED | NOTNEEDED | NOTNEEDED | NOTNEEDED |
| (8) gce-localssd-scsi-fs| NOTTESTED | NOTTESTED | NOTTESTED | NOTTESTED |

- This PR uses `nsenter ... readlink` to resolve path in container as @msau42  @jsafrane [suggested](https://github.com/kubernetes/kubernetes/pull/61489#pullrequestreview-110032850). This fixes B1:B6 and D6, , the rest will be addressed in https://github.com/kubernetes/kubernetes/pull/62102.
- C5:D5 marked `FAIL` because `tmpfs` filesystems can share same mount source, we cannot rely on it to check mount references. e2e tests passes due to we use unique mount source string in tests.
- A7:D7 marked `NOTNEEDED` because we don't set fsGroup on block devices in local plugin. (TODO: Should we set fsGroup on block device?)
- A8:D8 marked `NOTTESTED` because I didn't test it, I leave it to `pull-kubernetes-e2e-gce`. I think it should be same as `blockfs`.

**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-05-02 20:13:11 -07:00
Kubernetes Submit Queue b5f61ac129
Merge pull request #62657 from matthyx/master
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>.

Update all script shebangs to use /usr/bin/env interpreter instead of /bin/interpreter

This is required to support systems where bash doesn't reside in /bin (such as NixOS, or the *BSD family) and allow users to specify a different interpreter version through $PATH manipulation.
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
```release-note
Use /usr/bin/env in all script shebangs to increase portability.
```
2018-05-02 19:44:32 -07:00
zhouhaibing089 6dc32c33d7 iptables: add timeout when checking rules
in cases where iptables stucks forever due to some reasons, we lost
the availability of kube-proxy, this is about adding a timeout for
the rule checking operations, as a result, it should give us a more
reliable working iptables proxy.
2018-05-02 16:25:17 +08:00
Yecheng Fu 3748197876 Add more volume types in e2e and fix part of them.
- Add dir-link/dir-bindmounted/dir-link-bindmounted/blockfs volume types for e2e
tests.
- Return error if we cannot resolve volume path.
- Add GetFSGroup/GetMountRefs methods for mount.Interface.
- Fix fsGroup related e2e tests partially.
2018-05-02 10:31:42 +08:00
Michelle Au 6b1947c9ba passthrough readOnly to subpath 2018-04-26 11:18:36 -07:00
Kubernetes Submit Queue aa1ec693c3
Merge pull request #62951 from dims/support-nsenter-better-in-non-systemd-envs
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>.

Support nsenter in non-systemd environments

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

In our CI, we run kubekins image for most of the jobs. This is a
debian image with upstart and does not enable systemd. So we should

* Bailout if any binary is missing other than systemd-run.
* SupportsSystemd should check the binary path to correctly
  identify if the systemd-run is present or not
* Pass the errors back to the callers so kubelet is forced to
  fail early when there is a problem. We currently assume
  that all binaries are in the root directory by default which
  is wrong.


**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-04-25 01:08:10 -07:00
Kubernetes Submit Queue 44b57338d5
Merge pull request #59692 from mtaufen/dkcfg-unpack-configmaps
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>.

unpack dynamic kubelet config payloads to files

This PR unpacks the downloaded ConfigMap to a set of files on the node.

This enables other config files to ride alongside the
KubeletConfiguration, and the KubeletConfiguration to refer to these
cohabitants with relative paths.

This PR also stops storing dynamic config metadata (e.g. current,
last-known-good config records) in the same directory as config
checkpoints. Instead, it splits the storage into `meta` and
`checkpoints` dirs.

The current store dir structure is as follows:
```
- dir named by --dynamic-config-dir (root for managing dynamic config)
| - meta (dir for metadata, e.g. which config source is currently assigned, last-known-good)
  | - current (a serialized v1 NodeConfigSource object, indicating the assigned config)
  | - last-known-good (a serialized v1 NodeConfigSource object, indicating the last-known-good config)
| - checkpoints (dir for config checkpoints)
  | - uid1 (dir for unpacked config, identified by uid1)
    | - file1
    | - file2
    | - ...
  | - uid2
  | - ...
```

There are some likely changes to the above structure before dynamic config goes beta, such as renaming "current" to "assigned" for clarity, and extending the checkpoint identifier to include a resource version, as part of resolving #61643.

```release-note
NONE
```

/cc @luxas @smarterclayton
2018-04-24 12:01:37 -07:00
Davanum Srinivas 2f98d7a3ea Support nsenter in non-systemd environments
In our CI, we run kubekins image for most of the jobs. This is a
debian image with upstart and does not enable systemd. So we should:

* Bailout if any binary is missing other than systemd-run.
* SupportsSystemd should check the binary path to correctly
  identify if the systemd-run is present or not
* Pass the errors back to the callers so kubelet is forced to
  fail early when there is a problem. We currently assume
  that all binaries are in the root directory by default which
  is wrong.
2018-04-22 22:10:36 -04:00
Michael Taufen c9d398d01e unpack dynamic kubelet config payloads to files
This PR unpacks the downloaded ConfigMap to a set of files on the node.

This enables other config files to ride alongside the
KubeletConfiguration, and the KubeletConfiguration to refer to these
cohabitants with relative paths.

This PR also stops storing dynamic config metadata (e.g. current,
last-known-good config records) in the same directory as config
checkpoints. Instead, it splits the storage into `meta` and
`checkpoints` dirs.
2018-04-19 09:18:53 -07:00
Matthias Bertschy 9b15af19b2 Update all script to use /usr/bin/env bash in shebang 2018-04-19 13:20:13 +02:00
andyzhangx 1e00396fc8 add andyzhangx as Reviewer 2018-04-16 07:13:15 +00:00
Kubernetes Submit Queue f5e8dcad9e
Merge pull request #62467 from andyzhangx/nsenter-getfiletype-fix
Automatic merge from submit-queue (batch tested with PRs 62467, 62482, 62211). 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 nsenter GetFileType issue in containerized kubelet

**What this PR does / why we need it**:
UnmountDevice would fail in containerized kubelet in v1.9.x, and in the end, pod with volume mount could not be scheduled from one node to another since the original volume will never be released. This PR fixed this issue.

In [nsenter_mount.GetFileType func](https://github.com/kubernetes/kubernetes/blob/master/pkg/util/mount/nsenter_mount.go#L238), return error of following code will be different than [mount_linux.GetFileType func](https://github.com/kubernetes/kubernetes/blob/master/pkg/util/mount/mount.go#L347)
```
outputBytes, err := mounter.ne.Exec("stat", []string{"-L", `--printf "%F"`, pathname}).CombinedOutput()
```
Return error and output would be like following in nsenter_mount.GetFileType func:
error: `exit status 1`
output: `/usr/bin/stat: cannot stat '2': No such file or directory`

This PR makes the return error consistent as mount_linux.GetFileType func, and finally makes [isDeviceOpened func](https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/util/operationexecutor/operation_generator.go#L1340) work.

**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 #62282

**Special notes for your reviewer**:
/assign @dixudx 

**Release note**:

```
fix nsenter GetFileType issue in containerized kubelet
```

/sig node
2018-04-13 07:25:14 -07:00
Kubernetes Submit Queue 06c5afe275
Merge pull request #62304 from msau42/remove-err-check
Automatic merge from submit-queue (batch tested with PRs 61608, 62304). 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 isNotDir error check

**What this PR does / why we need it**:
This check was supposed to handle the "subpath file" scenario, but:
1. It's wrong (should have been !)
2. It's not needed anymore. `IsLikelyNotMountPoint` was fixed to handle file mounts via https://github.com/kubernetes/kubernetes/pull/58433


**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-04-13 05:34:05 -07:00
Kubernetes Submit Queue 2f394a4168
Merge pull request #61914 from ianchakeres/mount-unsupported-err
Automatic merge from submit-queue (batch tested with PRs 62324, 61459, 62475, 62476, 61914). 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>.

Return error in mount_unsupported for unsupported platforms

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

Presently, `util/mount_unsupported.go` does not return any errors. For unsupported platforms, this hides failures. This PR returns errors, thereby properly informing users attempting to run on an unsupported platform.

**Which issue(s) this PR fixes** :
Fixes https://github.com/kubernetes/kubernetes/issues/61919

**Special notes for your reviewer**:

There are a few methods that simply call through to other methods. I did not return errors from those methods.

I've also updated an error check and message in `volume/fc/fc_test.go`, since it was ignoring an error on unsupported platforms.

**Release note**:
```release-note
NONE
```
2018-04-12 13:18:18 -07:00
andyzhangx d154f8d021 fix nsenter GetFileType issue
use outputBytes as return error
2018-04-12 13:12:13 +00:00
Di Xu ed506328c5 add tests for GetFileType 2018-04-10 10:53:11 +08:00
Di Xu 9c7604fe10 fix incompatible file type checking on Windows 2018-04-10 10:53:11 +08:00
Michelle Au b79e7cabbc Remove isNotDir error check 2018-04-09 17:32:13 -07:00
Peter Lee bc8525dfa5
fix wrong error type when formatting 2018-04-08 16:56:06 +08:00
Kubernetes Submit Queue c46738a3f0
Merge pull request #60073 from justaugustus/int-to-int32ptr
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>.

Use `pkg/util/pointer` functions instead of self-written versions

**What this PR does / why we need it**:
Replaces instances of module-written `int(32|64)? --> *int(32|64)?` functions with functions from k8s.io/kubernetes/pkg/util/pointer

**Special notes for your reviewer**:

Here's the grep used, based on the comments in:
* https://github.com/kubernetes/kubernetes/pull/59924#issuecomment-366119396
* https://github.com/kubernetes/kubernetes/issues/59971#issue-297766556

```bash
$ git grep -E 'func\ [^ (]+\([^ ]+\ int(32|64)?\)\ \*int(32|64)?' !(vendor|staging) | grep -v pkg/util/pointer

pkg/apis/apps/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/apps/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/apps/v1beta2/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/v2beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/validation/validation_test.go:func newInt32(val int32) *int32 {
pkg/apis/batch/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/batch/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/core/v1/defaults_test.go:func newInt(val int32) *int32 {
pkg/apis/core/validation/validation_test.go:func newInt32(val int) *int32 {
pkg/apis/extensions/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/controller/deployment/sync_test.go:func intOrStrP(val int) *intstr.IntOrString {
pkg/kubectl/autoscale_test.go:func newInt32(value int) *int32 {
plugin/pkg/admission/security/podsecuritypolicy/admission_test.go:func userIDPtr(i int) *int64 {
plugin/pkg/admission/security/podsecuritypolicy/admission_test.go:func groupIDPtr(i int) *int64 {
test/e2e/apps/deployment.go:func intOrStrP(num int) *intstr.IntOrString {
test/e2e/auth/pod_security_policy.go:func intPtr(i int64) *int64 {
test/integration/deployment/util.go:func intOrStrP(num int) *intstr.IntOrString {
```

**Release note**:

```release-note
NONE
```
/kind cleanup
/cc @php-coder 
/assign @tallclair
2018-04-02 16:22:28 -07:00
Kubernetes Submit Queue 5658a327dd
Merge pull request #61091 from Lion-Wei/ipvs-lb
Automatic merge from submit-queue (batch tested with PRs 60990, 60947, 45275, 60565, 61091). 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 service loadbalancer source range for ipvs proxy mode

**What this PR does / why we need it**:
fix service loadbalancer source range for ipvs proxy mode

**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 #61090

**Special notes for your reviewer**:

**Release note**:
```
NONE
```
2018-03-30 11:53:17 -07:00
Ian Chakeres 3fc5601e35 Return error in mount_unsupported for unsupported platforms 2018-03-29 14:17:07 -07:00
Cao Shufeng d3bac22a1f set right Content-Type for configz 2018-03-29 16:07:47 +08:00
Hemant Kumar cd36a0bca9 Use relative path for creating socket files 2018-03-28 12:27:33 -04:00
Stephen Augustus 09aa0b9c1d pkg/util/pointer: Update `int` pointer functions
* Implement `Int64Ptr` function
* Replace per module functions of `int(32|64)?` --> `*int(32|64)?`
* Update bazel rules
2018-03-27 10:30:01 -04:00
Lion-Wei c8fae0ee4d add lb source test 2018-03-27 11:31:37 +08:00
Kubernetes Submit Queue 0aa9a69bf8
Merge pull request #61480 from gnufied/fix-unix-socket-subpath-mount
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 unix socket subpath mount

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

```release-note
Fix mounting of UNIX sockets(and other special files) in subpaths
```
2018-03-25 20:40:28 -07:00
Ismo Puustinen d03b071d5b pkg/util/verify-util-pkg.sh: fix shell return value comparison.
In shell scripts inside [[ .. ]] blocks, ">" is a string comparison
operator. The return value check using it appears to work mostly by
accident, because the only values are "0" and "1". Change to -gt
operator.
2018-03-23 15:37:03 +02:00
Hemant Kumar 32de642fa1 Use O_PATH to avoid errors on Openat
Also add tests for sockets and fifos
Replace use of syscall for flags with unix
2018-03-22 18:56:58 -04:00
Kubernetes Submit Queue d23066e8b3
Merge pull request #61373 from msau42/subpath-reconstruct
Automatic merge from submit-queue (batch tested with PRs 61453, 61393, 61379, 61373, 61494). 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>.

Use inner volume name instead of outer volume name for subpath directory

**What this PR does / why we need it**:
Fixes volume reconstruction for PVCs with subpath

**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 #61372

**Special notes for your reviewer**:


**Release note**:

```release-note
ACTION REQUIRED: In-place node upgrades to this release from versions 1.7.14, 1.8.9, and 1.9.4 are not supported if using subpath volumes with PVCs.  Such pods should be drained from the node first.
```
2018-03-22 06:20:28 -07:00
Michelle Au 91c557f504 Use inner volume name instead of outer volume name for subpath directory 2018-03-21 17:13:38 -07:00
Kubernetes Submit Queue f3539784f3
Merge pull request #60927 from islinwb/ipset_ut
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 TODO: test more SetType

**What this PR does / why we need it**:
fix TODO in pkg/util/ipset/ipset_test.go: test more SetType

**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-03-20 16:34:22 -07:00
Jan Safranek e55164c42d Fix creation of subpath with SUID/SGID directories.
SafeMakeDir() should apply SUID/SGID/sticky bits to the directory it creates.
2018-03-16 16:58:47 +01:00
Kubernetes Submit Queue dce8d416d7
Merge pull request #60978 from danwinship/fix-iptables-restore-wait
Automatic merge from submit-queue (batch tested with PRs 60978, 60985). 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 use of "-w" flag to iptables-restore

iptables accepts "-w5" but iptables-restore requires "-w 5", so kube-proxy is currently broken for people with an iptables-restore new enough that kube-proxy tries to use the new flags.

Fixes #58956

**Release note**:
```release-note
Fixed kube-proxy to work correctly with iptables 1.6.2 and later.
```
2018-03-15 22:54:58 -07:00
Jordan Liggitt 3fafdb7001
Detect backsteps correctly in base path detection
Avoid false positives with atomic writer ..<timestamp> directories
2018-03-13 02:23:06 -04:00
Dan Winship 34ce573e99 Fix use of "-w" flag to iptables-restore
iptables accepts "-w5" but iptables-restore requires "-w 5"
2018-03-09 08:52:05 -05:00
linweibin db7b59dc0d fix TODO: test more SetType 2018-03-08 21:00:13 +08:00
Jan Safranek 5110db5087 Lock subPath volumes
Users must not be allowed to step outside the volume with subPath.
Therefore the final subPath directory must be "locked" somehow
and checked if it's inside volume.

On Windows, we lock the directories. On Linux, we bind-mount the final
subPath into /var/lib/kubelet/pods/<uid>/volume-subpaths/<container name>/<subPathName>,
it can't be changed to symlink user once it's bind-mounted.
2018-03-05 09:14:44 +01:00
Kubernetes Submit Queue f45f4a4ec0
Merge pull request #56880 from MrHohn/kube-proxy-ipv6-fix
Automatic merge from submit-queue (batch tested with PRs 53689, 56880, 55856, 59289, 60249). 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>.

Harden kube-proxy for unmatched IP versions

**What this PR does / why we need it**:
This PR makes kube-proxy omits & logs & emits event for unmatched IP versions configuration (IPv6 address in IPv4 mode or IPv4 address in IPv6 mode). 

**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 #57219

**Special notes for your reviewer**:

**Release note**:

```release-note
Fix the issue in kube-proxy iptables/ipvs mode to properly handle incorrect IP version.
```
2018-02-28 00:00:29 -08:00
Kubernetes Submit Queue 3d36044a62
Merge pull request #59714 from hzxuzhonghu/clean-up-goroutinemap
Automatic merge from submit-queue (batch tested with PRs 60157, 60337, 60246, 59714, 60467). 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>.

util/goroutinemap code cleanup

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

code cleanup

**Release note**:

```release-note
NONE
```
2018-02-27 12:05:40 -08:00
Zihong Zheng 6004452bed Auto-updated BUILD files 2018-02-27 11:18:11 -08:00
Zihong Zheng ca032528be [kube-proxy] Add more IP version related utils 2018-02-27 11:14:02 -08:00
Zihong Zheng dfbec1a63a [kube-proxy] Move ipv6 related funcs to utils pkg 2018-02-27 11:12:45 -08:00
andrewsykim d856a97da1 fix bug where character devices are not recognized 2018-02-26 17:18:05 -05:00
Kubernetes Submit Queue 05425f0826
Merge pull request #60256 from danwinship/review-iptables-stuff
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 me to iptables/kube-proxy reviewers

kube-proxy needs reviewers!
2018-02-26 07:50:58 -08:00
Kubernetes Submit Queue c1a73ea685
Merge pull request #59286 from prameshj/udp-conntrack
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>.

Delete stale UDP conntrack entries that use hostPort

**What this PR does / why we need it**:
This PR introduces a change to delete stale conntrack entries for UDP connections, specifically for udp connections that use hostPort. When the pod listening on that udp port get updated/restarted(and gets a new ip address), these entries need to be flushed so that ongoing udp connections can recover once the pod is back and the new iptables rules have been installed. 
**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 #59033

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-02-23 19:54:08 -08:00
Pavithra Ramesh 098a4467fe Remove conntrack entry on udp rule add.
Moved conntrack util outside of proxy pkg
Added warning message if conntrack binary is not found
Addressed review comments.
ran gofmt
2018-02-22 23:34:42 -08:00
Kubernetes Submit Queue f05a065738
Merge pull request #59713 from hanxiaoshuai/fix0211
Automatic merge from submit-queue (batch tested with PRs 60208, 60084, 60183, 59713, 60096). 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>.

Use SeekStart, SeekCurrent, and SeekEnd repalace of deprecated constant

**What this PR does / why we need it**:
Use SeekStart, SeekCurrent, and SeekEnd repalace of deprecated constant.
'''
// Deprecated: Use io.SeekStart, io.SeekCurrent, and io.SeekEnd.
const (
	SEEK_SET int = 0 // seek relative to the origin of the file
	SEEK_CUR int = 1 // seek relative to the current offset
	SEEK_END int = 2 // seek relative to the end
)

'''
**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-02-22 23:17:38 -08:00
Dan Winship fc03cfe7a8 add me to iptables/kube-proxy reviewers 2018-02-22 17:36:57 -05:00
Dr. Stefan Schimanski 061a451273 Fix nsenter on Mac 2018-02-22 16:32:06 +01:00
Kubernetes Submit Queue b2091090fc
Merge pull request #52648 from dixudx/refactor_NsenterWriter
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>.

refactor NsenterWriter to utilize pkg/util/nsenter

**What this PR does / why we need it**:
Per [discussion](https://github.com/kubernetes/kubernetes/pull/51771#discussion_r138824451)
Depend on #51771

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

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2018-02-22 03:16:50 -08:00
Kubernetes Submit Queue 96ec318718
Merge pull request #59842 from ixdy/update-rules_go-02-2018
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>.

 Update bazelbuild/rules_go, kubernetes/repo-infra, and gazelle dependencies

**What this PR does / why we need it**: updates our bazelbuild/rules_go dependency in order to bump everything to go1.9.4. I'm separating this effort into two separate PRs, since updating rules_go requires a large cleanup, removing an attribute from most build rules.

**Release note**:

```release-note
NONE
```
2018-02-19 22:23:05 -08:00
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
Davanum Srinivas 265e5ae085 Log the command line flags
With d7ddcca231, we lost the logging
of the flags. We should at least log what the command line flags
were used to start processes as those incredibly useful for trouble shooting.
2018-02-15 18:04:04 -05:00
Kubernetes Submit Queue f2b6e49e6c
Merge pull request #58433 from yue9944882/bugfix/lstat-parent-with-abs-path
Automatic merge from submit-queue (batch tested with PRs 59103, 58433). 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>.

bugfix(mount): lstat with abs path of parent instead of '/..'

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

If a nfs volume with improper permission is mounted on a Pod, operation of deleting this Pod will fail and the pod itself will be stuck at a 'TERMINATING' status. Kubelet cannot reconcile it correctly.

This is because kubelet will try to find the mount-point with '..' file which needs `x` permission of dir.  When it's forbidden, the nfs volume will never umount without a correct mount-point finded.

**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 #57095

**Special notes for your reviewer**:

**Release note**:

```release-note
Get parent dir via canonical absolute path when trying to judge mount-point
```
2018-02-14 03:55:34 -08:00
Kubernetes Submit Queue 2cd6cd6e86
Merge pull request #59818 from msau42/owners
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 reviewers to util/mount

**What this PR does / why we need it**:
Add some more reviewers

**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-02-13 11:13:04 -08:00
Michelle Au 377bff614d add reviewers to util/mount 2018-02-13 10:06:27 -08:00
Kubernetes Submit Queue 317853c90c
Merge pull request #59464 from dixudx/fix_all_typos
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 all the typos across the project

**What this PR does / why we need it**:
There are lots of typos across the project. We should avoid small PRs on fixing those annoying typos, which is time-consuming and low efficient.

This PR does fix all the typos across the project currently. And with #59463, typos could be avoided when a new PR gets merged.

**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**:
/sig testing
/area test-infra
/sig release
/cc @ixdy 
/assign @fejta 

**Release note**:

```release-note
None
```
2018-02-10 22:12:45 -08:00
hzxuzhonghu d771963a5e util/goroutinemap code cleanup 2018-02-11 11:22:36 +08:00
Di Xu 48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
hangaoshuai 7cfb94cbc5 Use SeekStart, SeekCurrent, and SeekEnd repalace of deprecated constant 2018-02-11 11:02:23 +08:00
stewart-yu 970f6528f2 fix "destroying ipset" error in kube-proxy.log when run cluster in local 2018-02-11 10:59:09 +08:00
Kubernetes Submit Queue 28b4bb0fd6
Merge pull request #59540 from andyzhangx/azurefile-windows-fix
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>.

return error if New-SmbGlobalMapping failed when mounting azure file on Windows

**What this PR does / why we need it**:
This PR will return error if New-SmbGlobalMapping failed when mounting azure file on Windows.
User wants to create a pod moutning with azure file pvc using static provisioning([doc](https://github.com/andyzhangx/Demo/tree/master/windows/azurefile#static-provisioning-for-azure-file-on-windows-server-version-1709support-from-v17x])) and user uses a wrong storage account name or key, current behavior is if mount azure file on Windows, it will create an empty directory, and user would not know actually it fails.

**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 #59538 

**Special notes for your reviewer**:

**Release note**:

```
return error if New-SmbGlobalMapping failed when mounting azure file on Windows
```
2018-02-09 23:21:53 -08:00
Kubernetes Submit Queue 3ee818c259
Merge pull request #58912 from mlmhl/volume_mount
Automatic merge from submit-queue (batch tested with PRs 59466, 58912, 59605, 59548). 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>.

return a more human readable error message if mount an unformatted vo…

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

If an unformatted volume is requested as read only mode, according device mount operation will fail, and the message is verbose and obscure. We should check this scenario and return a more human readable message.

**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 #58911

**Release note**:

```release-note
NONE
```

/sig storage
2018-02-09 03:44:35 -08:00
Kubernetes Submit Queue d6625f857a
Merge pull request #58177 from jingxu97/Jan/reconstruct
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>.

Redesign and implement volume reconstruction work

This PR is the first part of redesign of volume reconstruction work. The detailed design information is https://github.com/kubernetes/community/pull/1601

The changes include
1. Remove dependency on volume spec stored in actual state for volume
cleanup process (UnmountVolume and UnmountDevice)

Modify AttachedVolume struct to add DeviceMountPath so that volume
unmount operation can use this information instead of constructing from
volume spec

2. Modify reconciler's volume reconstruction process (syncState). Currently workflow
is when kubelet restarts, syncState() is only called once before
reconciler starts its loop.
a. If volume plugin supports reconstruction, it will use the
reconstructed volume spec information to update actual state as before.
b. If volume plugin cannot support reconstruction, it will use the
scanned mount path information to clean up the mounts.

In this PR, all the plugins still support reconstruction (except
glusterfs), so reconstruction of some plugins will still have issues.
The next PR will modify those plugins that cannot support reconstruction
well.

This PR addresses issue #52683
2018-02-08 18:21:34 -08:00
mlmhl 2f46df3540 return a more human readable error message if mount an unformatted volume as readonly 2018-02-08 20:01:41 +08:00
andyzhangx 0a63d7cc9a return error if New-SmbGlobalMapping failed in azure file mount 2018-02-08 05:56:16 +00:00
Kubernetes Submit Queue 07e849c986
Merge pull request #59429 from rramkumar1/ipvs-cleanup
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>.

Cleanup of ipvs utils

**What this PR does / why we need it**:
This PR is a small cleanup of pkg/util/ipvs.

The changes are as follows:

1. Rename toBackendService -> toIPVSService and toBackendDestination -> toIPVSDestination. The use of the term 'backend' makes things really confusing and this renamig makes it more explicit about what we are doing.

2. Give the libnetwork/ipvs package the name libipvs. This makes it less confusing since the package these files are in is also ipvs.

3. Some variable naming cleanup to make things easier to read.

/assign @m1093782566 

**Release note**:

```release-note
None
```
2018-02-07 18:07:35 -08:00
Rohit Ramkumar daae0e6cec Cleanup of ipvs utils 2018-02-07 14:15:31 -08:00
Kubernetes Submit Queue ebffd76acf
Merge pull request #57268 from m1093782566/validate-ipset
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>.

validate ipset set and entry - ipvs proxier validate entry before adding it and validate set before creating it

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

validate ipset util.

**Which issue(s) this PR fixes**:
Fixes #57269

**Special notes for your reviewer**:

I splitted this PR into some small pieces for the sake of code review.

**Release note**:

```release-note
NONE
```
2018-02-06 14:35:34 -08:00
Kubernetes Submit Queue b13092554c
Merge pull request #59050 from cofyc/get_fstype
Automatic merge from submit-queue (batch tested with PRs 51323, 59306, 58991, 59050). 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>.

Proposal: Use `blkid` to detect fs type of device instead of `lsblk`.

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

Use `blkid` to detect fs type of device instead of `lsblk`. 

`lsblk` depends on `udev`, and device driver's udev rules. If udev rules are not installed properly, `lsblk` could not get fs type of disk. This will cause problems, e.g. expanding volume will fail because it could not detect fs type of disk.

Take `rbd`  as example, `lsblk -n -o FSTYPE /dev/rbd0` command actually read fs type from `/run/udev/data/b252:0` (may vary on different machines, see real file from `strace lsblk -n -o FSTYPE /dev/rbd0` ).

This file `/run/udev/data/b252:0` is generated by `udev` and device driver's udev files. If machine don't have `/lib/udev/rules.d/60-ceph-by-parttypeuuid.rules` udev rule file installed (this file is from `ceph-osd` package on ubuntu), it will not be properly generated, e.g:

```
# cat /run/udev/data/b251:0
S:rbd/<pool>/<image>
I:13234059587579
E:ID_FS_TYPE=
E:net.ifnames=0
G:systemd
```

`lsblk -n -o FSTYPE /dev/rbd0` will get empty fs type.

[60-ceph-by-parttypeuuid.rules](https://github.com/ceph/ceph/blob/v13.0.0/udev/60-ceph-by-parttypeuuid.rules) is udev rule, which underlyingly runs `blkid` commands to get infos of device, then store them in udev file.

If we use `blkid` to get fs type, kubelet volume manager will not depend on `udev` stuffs. Currently, if kubelet node does not have `60-ceph-by-parttypeuuid.rules` installed (from `ceph-osd` package), it will fail to get fs type of rbd image. Even administrator install `ceph-osd` later, it can not get fs type of previous mapped images (udev data files not be to updated automatically).

**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**:

`udevadm test` logs:

- Ubuntu 16.04 (ceph-common installed), without ceph-osd: [without-ceph-osd.log](https://github.com/kubernetes/kubernetes/files/1678512/without-ceph-osd.log)
- Ubuntu 16.04 (ceph-common installed), with ceph-osd: [with-ceph-osd.log](https://github.com/kubernetes/kubernetes/files/1678509/with-ceph-osd.log)

**Release note**:

```release-note
NONE
```
2018-02-06 10:40:40 -08:00
Kubernetes Submit Queue f68fc04b66
Merge pull request #58687 from PengTaoWW/fixTCResourceLeaks
Automatic merge from submit-queue (batch tested with PRs 58317, 58687, 57872, 59063, 59328). 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 TC resource Leak

ref: https://github.com/kubernetes/kubernetes/issues/56840 fix



**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

```
2018-02-05 18:43:33 -08:00
m1093782566 10a899f31e clean up code 2018-02-06 10:17:02 +08:00
Jing Xu 9588d2098a Redesign and implement volume reconstruction work
This PR is the first part of redesign of volume reconstruction work. The
changes include
1. Remove dependency on volume spec stored in actual state for volume
cleanup process (UnmountVolume and UnmountDevice)

Modify AttachedVolume struct to add DeviceMountPath so that volume
unmount operation can use this information instead of constructing from
volume spec

2. Modify reconciler's volume reconstruction process (syncState). Currently workflow
is when kubelet restarts, syncState() is only called once before
reconciler starts its loop.
a. If volume plugin supports reconstruction, it will use the
reconstructed volume spec information to update actual state as before.
b. If volume plugin cannot support reconstruction, it will use the
scanned mount path information to clean up the mounts.

In this PR, all the plugins still support reconstruction (except
glusterfs), so reconstruction of some plugins will still have issues.
The next PR will modify those plugins that cannot support reconstruction
well.

This PR addresses issue #52683, #54108 (This PR includes the changes to
update devicePath after local attach finishes)
2018-02-05 13:14:09 -08:00
Kubernetes Submit Queue 0656d030a7
Merge pull request #38320 from liggitt/golang-ratelimit
Automatic merge from submit-queue (batch tested with PRs 59158, 38320, 59059, 55516, 59357). 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>.

Switch from juju/ratelimit to golang.org/x/time/rate

Replaces juju/ratelimit with golang.org/x/time/rate
xref https://github.com/kubernetes/steering/issues/21

Requires removing the Saturation() method on the rate limiter. In the process of attempting to contribute it to the `golang.org/x/time/rate` implementation, it became clear that what it was calculating was not very useful when combined with periodic polling. See discussion in https://go-review.googlesource.com/c/time/+/29958#message-4caffc11669cadd90e2da4c05122cfec50ea6a22

```release-note
NONE
```
2018-02-05 12:40:34 -08:00
Yecheng Fu 322c094841 Use `blkid` to get fs type of device.
For `blkid`, if the specified token (TYPE/PTTYPE, etc) was
not found, or no (specified) devices could be identified, an
exit code of 2 is returned.
2018-02-05 11:21:35 +08:00
Di Xu 53d340f0a1 refactor NsenterWriter to utilize pkg/util/nsenter 2018-02-04 16:27:13 +08:00
Kubernetes Submit Queue c0a7919ac1
Merge pull request #58794 from gnufied/perform-online-resize-if-mounted
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>.

Perform resize of mounted volume if necessary

Under certain conditions - we must perform resize of volume even when it is mounted. This enables us to get around problem of resizing volumes used by deployments etc.

```release-note
Allow expanding mounted volumes
```
2018-02-02 12:48:53 -08:00
Yecheng Fu 5136938ff6 Use `blkid` to get fs type of device.
If a parition table type is detected, returns a special non-empty string
as filesystem type.
2018-02-03 00:24:21 +08:00
m1093782566 3574aba7bd update bazel BUILD 2018-02-02 10:08:43 +08:00
m1093782566 477b0f0636 fix review comments 2018-02-02 10:08:43 +08:00
m1093782566 e768924a62 validate entry in ipset 2018-02-02 10:08:43 +08:00
m1093782566 4e0b4fca94 validate set in ipset 2018-02-02 10:08:43 +08:00
m1093782566 9e9e264964 refactor ipset interface AddEntry() 2018-02-02 10:08:43 +08:00
Kubernetes Submit Queue 0df0ecd528
Merge pull request #57582 from m1093782566/ipset-owners
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 pkg/util/ipset OWNERS file

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

I initialized `pkg/util/ipset` for wraping ipset exec call and authored most of the commits. 

This package is used in IPVS proxier for reducing iptables call - possibly we can use ipset in iptables proxier in the future. Because reviewing this package needs some ipset background knowledge, I am creating this OWNERS file for efficient code review. Also, I am willing to share code review burden.

**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
```

/assign @brendandburns @thockin because I also added your names.
2018-02-01 11:23:47 -08:00
Yecheng Fu 75359c0b94 Use `blkid` to get fs type of device.
`lsblk` reads fs type info from udev files. If udev rules are not
installed. `lsblk` could not get correct fs type. This will cause
problems, e.g. expanding volume depends on fs type of disk.
2018-01-31 13:33:15 +08:00
Hemant Kumar afeb53e5ee Perform resize of mounted volume if necessary
Add e2e test for mounted volume resize
2018-01-29 17:49:50 -05:00
PengTaoWW 1a7f5083f5 Fix TC resource Leak
ref: https://github.com/kubernetes/kubernetes/issues/56840 fix
2018-01-29 09:42:34 -05:00
yue9944882 c3982691ac bugfix(mount): lstat with abs path of parent instead of '/..' 2018-01-21 23:08:01 +08:00
Jordan Liggitt 4b9f00988b
Switch from juju/ratelimit to golang.org/x/time/rate 2018-01-19 11:48:52 -05:00
Jordan Liggitt a9ed90f227
Remove Saturation() from rate limiter interface 2018-01-19 11:48:51 -05:00
m1093782566 5388e0aa47 add pkg/util/ipset OWNERS file 2018-01-19 09:48:35 +08:00
Kubernetes Submit Queue 6369a10004
Merge pull request #58284 from mfojtik/findmnt-out
Automatic merge from submit-queue (batch tested with PRs 57868, 58284, 56370, 58400, 58439). 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>.

Show findmnt command output in case of error

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

We don't print the error output from the `findmnt` command, which makes it pretty hard to debug. 

The current implementation just print:

`
I0115 11:59:36.078285   18230 nsenter_mount.go:168] Failed findmnt command for path /var/lib/origin/openshift.local.volumes/pods/8d723ec8-f9e9-11e7-bc52-025000000001/volumes/kubernetes.io~secret/pvinstaller-token-bxh42: exit status 1
`

With this patch, we can actually see the error:

`
I0115 12:04:30.908164   23301 nsenter_mount.go:168] Failed findmnt command for path /var/lib/origin/openshift.local.volumes/pods/8ff8bb98-f9e9-11e7-bc52-025000000001/volumes/kubernetes.io~secret/deployer-token-g4sg9: nsenter: failed to execute /findmnt: No such file or directory
 exit status 1
`

**Release note**:
```release-note
NONE
```
2018-01-18 13:11:30 -08:00
Kubernetes Submit Queue 44d0ba29d3
Merge pull request #56960 from islinwb/remove_unused_code_ut_pkg
Automatic merge from submit-queue (batch tested with PRs 53631, 56960). 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 code in UT files in pkg/

**What this PR does / why we need it**:
Remove unused code in UT files in pkg/ .

**Release note**:

```release-note
NONE
```
2018-01-18 02:41:29 -08:00
Kubernetes Submit Queue 74f2305c4f
Merge pull request #57967 from jsafrane/fix-nfs-root-squash
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>.

Fixed TearDown of NFS with root squash.

NFS plugin should not use `IsLikelyNotMountPoint()`, as it uses `lstat()` / `stat()` to determine if the NFS volume is still mounted - NFS server may use root_squash and kubelet may not be allowed to do `lstat()` / `stat()` there.

It must use slower `IsNotMountPoint()` instead, including in `TearDown()` function.

**Release note**:

```release-note
NONE
```

/assign @gnufied @rootfs
2018-01-17 13:32:03 -08:00
Michal Fojtik fd520aef61
Show findmt command output in case of error 2018-01-15 13:02:31 +01:00
linweibin fa8afc1d39 Remove unused code in UT files in pkg/ 2018-01-15 16:02:35 +08:00
Jan Safranek da1eec2853 Add jsafrane as util/mount approver. 2018-01-08 14:19:22 +01:00
Jan Safranek 45d21ee36b Fixed TearDown of NFS with root squash.
NFS plugin should not use IsLikelyNotMountPoint(), as it uses lstat() / stat()
to determine if the NFS volume is still mounted - NFS server may use
root_squash and kubelet may not be allowed to do lstat() / stat() there.

It must use slower IsNotMountPoint() instead, including TearDown() function.
2018-01-08 14:01:33 +01:00
Kubernetes Submit Queue 7585998299
Merge pull request #57317 from m1093782566/notfound
Automatic merge from submit-queue (batch tested with PRs 57906, 57425, 56939, 57317, 57762). 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 "Not Found" error for ipset set & entry delete

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

Add "not found error" for ipset set and entry delete. For example,

```
[root@SHA1000130405 k8s-yml]# ipset list
Name: KUBE-LOOP-BACK
Type: hash:ip,port,ip
Revision: 2
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 16776
References: 1
Members:
172.17.0.2,udp:53,172.17.0.2
172.17.0.2,tcp:53,172.17.0.2
100.106.89.164,tcp:6443,100.106.89.164

[root@SHA1000130405 k8s-yml]# ipset delete foo
ipset v6.19: The set with the given name does not exist

[root@SHA1000130405 k8s-yml]# ipset del KUBE-LOOP-BACK 1.2.3.4,tcp:80,1.2.3.4
ipset v6.19: Syntax error: Third element is missing from 1.2.3.4,tcp:80,1.2.3.4.
```
Just need to filter the error message "does not exist" or "element is missing". We should ignore these error when try to make sure they are deleted.

**Which issue(s) this PR fixes**:
Fixes #57318

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-01-05 17:52:41 -08:00
Kubernetes Submit Queue 2df01488fe
Merge pull request #57651 from Lion-Wei/ipvs-3
Automatic merge from submit-queue (batch tested with PRs 57651, 56411, 56779, 57523, 57624). 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 fake IPVS Real Server delete

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

Delete `Weight` equal in identify ipvs Realservice equal, since `Address` + `port` can indetify an unique `Realservice`.

**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 #57674

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-01-02 14:09:40 -08:00
Kubernetes Submit Queue 27d2ffb32f
Merge pull request #49856 from dixudx/polish_UpdateNodeStatus
Automatic merge from submit-queue (batch tested with PRs 49856, 56257, 57027, 57695, 57432). 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>.

Change to pkg/util/node.UpdateNodeStatus

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

> // TODO: Change to pkg/util/node.UpdateNodeStatus.

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

**Special notes for your reviewer**:
/cc @brendandburns @dchen1107 @lavalamp 

**Release note**:

```release-note
None
```
2018-01-02 13:15:42 -08:00
Lion-Wei e852ad38f3 add fake.DeleteRealServer UT 2017-12-29 14:30:23 +08:00
Lion-Wei b842f008fc Modify ipvs real server equal 2017-12-29 14:30:11 +08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
m1093782566 5052f3aed0 add error string reference 2017-12-22 13:49:47 +08:00
Kubernetes Submit Queue 070f946476
Merge pull request #57438 from m1093782566/ipset-util-test
Automatic merge from submit-queue (batch tested with PRs 57292, 56274, 57435, 57438, 57429). 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>.

Implement FakeIPSet so that can add tests in IPVS proxier

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

Implement FakeIPSet so that can add tests in IPVS proxier - the tests can run everywhere(linux, mac, windows...).

**Which issue(s) this PR fixes**:
Fixes #57439

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @thockin @brendandburns
2017-12-20 22:16:49 -08:00
Kubernetes Submit Queue d3ea100ad9
Merge pull request #57292 from m1093782566/ipvs-ownerfile
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 pkg/util/ipvs OWNERS file

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

This PR adds `pkg/util/ipvs/OWNERS` file, including two people: @thockin, @m1093782566(me).

I created `pkg/util/ipvs` package for wrapping netlink IPVS call, which is used by IPVS proxier. Because reviewing this package needs some IPVS background knowledge, I create this OWNERS file for efficient code review. And, I am willing to share code review burden of this util package :)

**Which issue(s) this PR fixes**:
Fixes #57361

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/sig network
2017-12-20 21:58:58 -08:00
m1093782566 0f201037bd update bazel BUILD 2017-12-20 16:02:14 +08:00
m1093782566 b4a47bc228 implement fakeIPSet in ipset util 2017-12-20 09:49:14 +08:00
m1093782566 e6b9b5e0c3 add not found error for ipset set and entry delete 2017-12-18 18:36:32 +08:00
m1093782566 1793e6eb18 add pkg/util/ipvs OWNERS file 2017-12-18 09:25:28 +08:00
pospispa e1312f2c00 Addressing Comments from Code Review
Addressing comments from code review (https://github.com/kubernetes/kubernetes/pull/55824#pullrequestreview-78597250) in order to simplify the code.
2017-11-29 15:50:23 +01:00
Shyam Jeedigunta 19e56eb42d Use PATCHs instead of PUTs in CIDR allocator 2017-11-23 21:04:28 +01:00
Hemant Kumar 2f2a643684 Implement file system resizing support on kubelet start
Update bazel files
Fix operation executor tests
2017-11-22 16:06:10 -05:00
Kubernetes Submit Queue 3df3c580b7
Merge pull request #54219 from m1093782566/ipset
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>.

Using ipset doing SNAT and packet filter in IPVS kube-proxy

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

Try ipset in ipvs proxy mode.

**Which issue this PR fixes**: 

fixes #54203

xref: #53393, #53775

**Special notes for your reviewer**:

**Release note**:

```release-note
Using ipset doing SNAT and packet filtering in IPVS kube-proxy
```

/sig network

/area kube-proxy
2017-11-19 22:09:13 -08:00
Kubernetes Submit Queue 936bcd1361
Merge pull request #55858 from yanxuean/unit-slice
Automatic merge from submit-queue (batch tested with PRs 55988, 53555, 55858). 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 test for slice

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>

**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
```
2017-11-18 20:31:26 -08:00
xiangpengzhao cafb2f731f Kubeadm supports for Kubelet Dynamic Configuration. 2017-11-17 11:19:12 +08:00
fabriziopandini 746e7f988e Clone documentation utility from //pkg/kubectl/cmd/templates 2017-11-16 10:18:00 +01:00
yanxuean 68df307378 add test for slice
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-11-16 16:37:29 +08:00
Chun Chen c6375c20b7 Add tests to test if legacy chains/rules can be cleaned up 2017-11-15 15:15:04 +08:00
Jan Safranek 790f513d23 Fix cross-compliation of mount_exec.go
Add dummy implementation for non-linux platforms
2017-11-14 16:30:00 +01:00
m1093782566 45ad69765e wrapper ipset util 2017-11-14 21:48:44 +08:00
Kubernetes Submit Queue 2f622b2a28
Merge pull request #52569 from tmjd/add-proxy-forward-rules
Automatic merge from submit-queue (batch tested with PRs 55009, 55532, 55601, 52569, 55533). 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>.

Kube-proxy adds forward rules to ensure NodePorts work

**What this PR does / why we need it**:
Updates kube-proxy to set up proper forwarding so that NodePorts work with docker 1.13 without depending on iptables FORWARD being changed manually/externally.

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

**Special notes for your reviewer**:
@thockin I used option number 2 that I mentioned in the #39823 issue, please let me know what you think about this change.  If you are happy with the change then I can try to add tests but may need a little direction about what and where to add them.

**Release note**:

```release-note
Add iptables rules to allow Pod traffic even when default iptables policy is to reject.
```
2017-11-14 00:09:57 -08:00
Kubernetes Submit Queue 2d64ce5e8e
Merge pull request #53440 from jsafrane/mount-container4-10-03
Automatic merge from submit-queue (batch tested with PRs 54005, 55127, 53850, 55486, 53440). 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 mount utilities

This is implementation of https://github.com/kubernetes/community/pull/589

@tallclair @vishh @dchen1107 PTAL
@kubernetes/sig-node-pr-reviews 

**Release note**:
```release-note
Kubelet supports running mount utilities and final mount in a container instead running them on the host.
```
2017-11-13 16:45:33 -08:00
Zihong Zheng f7ed9cf09a [kube-proxy] Fix session affinity with local endpoints traffic 2017-11-10 18:42:07 -08:00
Jan Safranek 1dd32ce7eb Add ExecMounter 2017-11-10 13:14:40 +01:00
Dr. Stefan Schimanski bec617f3cc Update generated files 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski 012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Kubernetes Submit Queue a0898db683
Merge pull request #55147 from WanLinghao/keymutex_remove
Automatic merge from submit-queue (batch tested with PRs 55247, 55324, 55261, 55147, 54052). 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 function in keymutex_test.go file

**What this PR does / why we need it**:
remove unused function in keymutex_test.go file

**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
```
2017-11-09 00:59:27 -08:00
Kubernetes Submit Queue 73d53678c6
Merge pull request #55095 from smarterclayton/fix_mac
Automatic merge from submit-queue (batch tested with PRs 55092, 55348, 55095, 55277, 55352). 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 tests on darwin / non-linux platforms
2017-11-08 21:18:23 -08:00
Kubernetes Submit Queue 18402f6c51
Merge pull request #55248 from knobunc/fix/increase-iptables-wait
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 the iptables wait flag change to more places

There were a few places that the last PR (https://github.com/kubernetes/kubernetes/pull/54763) missed because the flags that PR covered were of the form `-w2`.  Some of the code had `--wait=2`.  This changes that code to use the same global variable for the wait setting so that everything is consistent.
2017-11-07 14:33:36 -08:00
Kubernetes Submit Queue 576c9118a6
Merge pull request #53592 from frodenas/bootstrap-controller
Automatic merge from submit-queue (batch tested with PRs 53592, 52562, 55175, 55213). 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>.

Check RegisterMetricAndTrackRateLimiterUsage error when starting BootstrapSigner & TokenCleaner controllers

**What this PR does / why we need it**:
Prevent `BootstrapSigner` and `TokenCleaner` controllers to start if `metrics.RegisterMetricAndTrackRateLimiterUsage` returns an error.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-11-07 11:21:15 -08:00
Benjamin Bennett a5c334046b Add the iptables wait flag change to more places
There were a few places that the last PR https://github.com/kubernetes/kubernetes/pull/54763 missed because the flags that PR covered were of the form -w2.  Some of the code had --wait=2.  This changes that code to use the same global variable for the wait setting so that everything is consistent.
2017-11-07 10:50:28 -05:00
Kubernetes Submit Queue b4b851cb0e
Merge pull request #52976 from sakeven/fix/netsh_checkIPExists
Automatic merge from submit-queue (batch tested with PRs 55114, 52976, 54871, 55122, 55140). 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 netsh checkIPExists in Chinese

Signed-off-by: sakeven <jc5930@sina.cn>



**What this PR does / why we need it**:
On Windows in Chinese language, kube-proxy ip dump outputs like this:

```
接口 "vEthernet (KubeProxySwitch)" 的配置
    DHCP 已启用:                          否
    IP 地址:                           10.96.0.2
    子网前缀:                        10.0.0.0/8 (掩码 255.0.0.0)
    IP 地址:                           10.99.233.195
    子网前缀:                        10.0.0.0/8 (掩码 255.0.0.0)
    IP 地址:                           10.109.68.207
    子网前缀:                        10.0.0.0/8 (掩码 255.0.0.0)
    IP 地址:                           10.110.60.68
    子网前缀:                        10.0.0.0/8 (掩码 255.0.0.0)
    IP 地址:                           10.110.252.225
    子网前缀:                        10.0.0.0/8 (掩码 255.0.0.0)
    InterfaceMetric:                      15
```

And here we used ''IP Address:" in English to search IP, so it would never succeed even if ip address was right here. ''IP Address:" in Chinese is "IP 地址: "。

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

**Special notes for your reviewer**:

**Release note**:

```
NONE
```
2017-11-06 23:19:15 -08:00
WanLinghao 7b7135ef79 remove unused function in keymutex_test.go file
modified:   pkg/util/keymutex/keymutex_test.go
2017-11-06 17:05:23 +08:00
Di Xu 13a355c837 refactor method to pkg/util/node 2017-11-06 09:51:09 +08:00
Clayton Coleman b844ac44f5
Tmpdir can be a symlink, also fake mount needs to call nested mounter 2017-11-03 22:21:29 -04:00
Kubernetes Submit Queue b7968e0907
Merge pull request #54921 from weiwei04/fix_reflector_last_resource_version
Automatic merge from submit-queue (batch tested with PRs 54800, 53898, 54812, 54921, 53558). 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>.

rename metric reflector_xx_last_resource_version

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

mv reflector name from metric name to metric label

before:

```
reflector_k8s_io_kubernetes_pkg_client_informers_informers_generated_internalversion_factory_go:73_8664_last_resource_version{instance="104.154.20.21:443",job="kubernetes-apiservers"}
```

after

```
reflector_last_resource_version{instance="10.0.2.15:6443",job="kubernetes-apiservers",name="k8s_io_kubernetes_pkg_client_informers_informers_generated_internalversion_factory_go_73_8664"}
```

**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 #52121 

**Special notes for your reviewer**:

None

**Release note**:

```release-note
NONE
```
2017-11-02 03:14:24 -07:00
Kubernetes Submit Queue 574492aed6
Merge pull request #53553 from bsteciuk/kubeadm-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>.

Kubeadm - Added initial support for Windows worker nodes to join cluster using kubeadm

**What this PR does / why we need it**:
This PR adds initial support for adding a Windows worker node to a Kubernetes cluster with kubeadm.  Also adds Windows build of kubeadm to node build targets. 

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

**Special notes for your reviewer**:

Depends on #53730 

**Release note**:

```release-note
kubeadm: Add support for adding a Windows node
```
2017-11-01 14:58:58 -07:00
Bob Steciuk 44fbec29c4 Kubeadm - Added initial support for Windows worker nodes to join cluster using kubeadm
Added kubeadm to node build targets

Created unix/windows specific conditionally compiled for checks.go and defaults.go
2017-11-01 10:36:37 -04:00
Kubernetes Submit Queue 618b705a4b
Merge pull request #53629 from andyzhangx/azurefile-improve
Automatic merge from submit-queue (batch tested with PRs 46341, 53629). 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 azure file mount limit issue on windows due to using drive letter

**What this PR does / why we need it**:
It's not necessary to use drive letter in azure file mount, correct usage for New-SmbGlobalMapping is like following:
```
New-SmbGlobalMapping -RemotePath $AzureFilePath -Credential $Credential
mklink /D $mountPath $AzureFilePath 
```
I removed the `LocalPath` parameter in New-SmbGlobalMapping

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54668
Without this PR, there is a limit(25) for azure file mount number on each node because only 25 drive letters could be used on each windows node, With this PR, there would be no such limit.

**Special notes for your reviewer**:
@PatrickLang 

**Release note**:

```
fix azure file mount limit issue on windows due to using drive letter
```
/sig azure
/sig windows
2017-11-01 04:38:12 -07:00
Ferran Rodenas 0e0a85f2a7 Add metrics.UnregisterMetricAndUntrackRateLimiterUsage function
For testing purposes, we want to unregister a previously registered
rate limiter prometheus metric and stop the goroutine that updates
this metric.

Signed-off-by: Ferran Rodenas <rodenasf@vmware.com>
2017-11-01 12:28:34 +01:00
Wei Wei bca495e229 rename metric reflector_xx_last_resource_version to reflector_last_resource_version{name="xx"} 2017-11-01 16:34:18 +08:00
Kubernetes Submit Queue 59cee2c73c
Merge pull request #54763 from rajatchopra/iptables_wait
Automatic merge from submit-queue (batch tested with PRs 54533, 54777, 54763, 54806, 54703). 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>.

make iptables wait flag generic and tune it to 5 seconds

Excerpt from [bug](https://bugzilla.redhat.com/show_bug.cgi?id=1506396) opened by @eparis 

> iptables-restore has a 2s wait timeout. Data collected today shows that even with a much faster kernel we can reasonably expect iptables-restore to take upwards of 2.4 seconds. (with unpatched/released RHEL kernel this can easily take 7-8 second)

> longest runs I saw over about 30 minutes were:
> 2.267244
> 2.284707
> 2.291535
> 2.376457

> If we get 2 iptables restores going at the same time, with a 2s timeout it is very likely the second will fail.

> I'd like to suggest a 5s timeout. It should still bound the number of thread we may be waiting on and increases the reliability that a common situation will be automatically resolved without failing up the stack.
2017-10-30 17:38:19 -07:00
Rajat Chopra c5740a3737 make iptables wait flag generic; increase the max wait time from 2 seconds to 5 seconds 2017-10-30 14:22:25 -04:00
Kubernetes Submit Queue f34a24e98e
Merge pull request #52401 from andyzhangx/azuredisk-getdevfunc
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 warning messages due to GetMountRefs func not implemented in windows

**What this PR does / why we need it**:
This PR completes the windows implementation of GetMountRefs in mount.go. In linux, the GetMountRefs implementaion is: read `/proc/mounts` and find all mount points, while in Windows, there is no such `/proc/mounts` place which shows all mounting points. 
There is another way in windows, **we could walk through(by `getAllParentLinks` func) the mount path(symbolic link) and get all symlinks until we got the final device, which is actually a drive**.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54670
This PR fixed the warnning issue mentioned in https://github.com/kubernetes/kubernetes/pull/51252

**Special notes for your reviewer**:
Some values in the code would be like follwoing:
```
GetMountRefs: mountPath ("\\var\\lib\\kubelet\\pods/4c74b128-92ca-11e7-b86b-000d3a36d70c/volumes/kubernetes.io~azure-disk/pvc-1cc91c70-92ca-11e7-b86b-000d3a36d70c")
getAllParentLinks: refs (["" "" "c:\\var\\lib\\kubelet\\plugins\\kubernetes.io\\azure-disk\\mounts\\b1246717734" "G:\\"])
basemountPath c:\var\lib\kubelet\plugins\kubernetes.io\azure-disk\mounts
got volumeID b1246717734
```

**Release note**:

```
fix warning messages due to GetMountRefs func not implemented in windows
```
2017-10-27 20:28:36 -07:00
sakeven c45a7ba4e5 fix netsh checkIPExists in Chinese
Signed-off-by: sakeven <jc5930@sina.cn>
2017-10-27 16:55:11 +08:00
Kevin 4c8539cece use core client with explicit version globally 2017-10-27 15:48:32 +08:00
Kubernetes Submit Queue 0579603613 Merge pull request #54389 from chentao1596/support-pkg-util-file-test-cases
Automatic merge from submit-queue (batch tested with PRs 54656, 54552, 54389, 53634, 54408). 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>.

Adding unit tests to methods of file's util

What this PR does / why we need it:

Add unit tests, thank you!
2017-10-26 21:08:28 -07:00
Kubernetes Submit Queue 22b83689d1 Merge pull request #54552 from chentao1596/pkg-util-netsh-unit-tests
Automatic merge from submit-queue (batch tested with PRs 54656, 54552, 54389, 53634, 54408). 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>.

Adding unit tests to methods of netsh

What this PR does / why we need it:

Add unit tests, thank you!
2017-10-26 21:08:24 -07:00
Kubernetes Submit Queue 90a35f1d16 Merge pull request #51608 from cofyc/rbd_attach_detach
Automatic merge from submit-queue (batch tested with PRs 53730, 51608, 54459, 54534, 54585). 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>.

RBD Plugin: Implement Attacher/Detacher interfaces.

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

This PR continues @rootfs 's work in #33660. It implements volume.Attacher/Volume.Detacher interfaces to resolve RBD image locking and makes RBD plugin more robust.

Summary of interfaces and what they do for RBD plugin:

- Attacher.Attach(): does nothing
- Attacher.VolumesAreAttached(): method to query volume attach status
- Attacher.GetDeviceMountPath(): method to get device mount path 
- Attacher.WaitForAttach(): kubelet maps the image on the node (and lock the image if needed)
- Attacher.MountDevice(): kubelet mounts device at the device mount path
- Detacher.UnmountDevice: kubelet unmounts device from the device mount path (currently, we need to unmaps image from the node here) (and unlock the image if needed)
- Detacher.Detach(): does nothing

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

fixes #50142.

**Special notes for your reviewer**:

RBD changes:

  1) Modify rbdPlugin to implement volume.AttachableVolumePlugin interface.
  2) Add rbdAttacher/rbdDetacher structs to implement
  volume.Attacher/Detacher interfaces.
  3) Add mount.SafeFormatAndMount/mount.Exec fields to rbdPlugin, and setup them in
  rbdPlugin.Init for later uses. Attacher/Mounter/Unmounter/Detacher
  reference rbdPlugin to use mounter and exec. This simplifies
  code.
  4) Add testcase struct to abstract RBD Plugin test case, etc.
  5) Add newRBD constructor to unify rbd struct initialization.

Non-RBD changes:

  1) Fix FakeMounter.IsLikelyNotMountPoint to return ErrNotExist if the
  directory does not exist. Mounter.IsLikelyNotMountPoint interface
  requires this, and RBD plugin depends on it.
  2) ~~Extend Detacher.Detach method to pass `*volume.Spec`, RBD plugin
  needs it to detach device from the node.~~
  3) ~~Extend Volume.Spec struct to include namespace string, RBD Plugin needs
  it to locate objects (e.g. secrets) in Pod's namespace.~~
  4) ~~Update RABC bootstrap policy to allow
  `system:controller:attachdetach-controller` cluster role to get
  Secrets object. RBD attach/detach needs to access secrets object in
  Pod's namespace.~~

**Release note**:

```
NONE
```
2017-10-26 19:59:19 -07:00
Kubernetes Submit Queue 04c5f800a5 Merge pull request #53731 from smarterclayton/dbus_races
Automatic merge from submit-queue (batch tested with PRs 49865, 53731, 54013, 54513, 51502). 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>.

The DBusFakeConnection should have locks to prevent races
2017-10-26 13:24:30 -07:00
chentao1596 8368ef6a44 Adding unit tests to methods of netsh 2017-10-26 11:18:09 +08:00
Yecheng Fu a768092f9a RBD Plugin: Prepare to implement Attacher/Detacher interfaces.
1) Fix FakeMounter.IsLikelyNotMountPoint to return ErrNotExist if the
   directory does not exist. Mounter.IsLikelyNotMountPoint interface
   requires this, and RBD plugin depends on it.
2017-10-25 17:07:27 +08:00
Xing Zhou 86813f161e Added unit test cases for the public methods of pkg/util/taints.go
Added unit test cases for the public methods of pkg/util/taints.go
2017-10-25 13:51:14 +08:00
chentao1596 9a70273edc Adding unit tests to methods of file's util 2017-10-24 08:26:58 +08:00
Kubernetes Submit Queue d1c58238da Merge pull request #52471 from xingzhou/taint-delete
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>.

Need to validate taint effect when removing taints.

Instead of reporting taint not found, it's better to report user
that the effect is invalid. This will help user to check errors.
So when user tries to remove a taint, two conditions will be checked:
1. Whether or not the effect is an empty string.
2. Whether or not the non-empty effect is a valid taint effect.

**Release note**:
```release-note
None
```
2017-10-20 22:29:22 -07:00
andyzhangx 286d8ae287 add windows implementation of GetMountRefs
add unit test and fix according to comments

fix unit test issue

add const in getAllParentLinks func
2017-10-17 07:35:18 +00:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Kubernetes Submit Queue 02f0d92160 Merge pull request #51686 from choury/fix_dup_unbind
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 duplicate unbind action in kube-proxy

**What this PR does / why we need it**:
Fix duplicate unbind action in kube-proxy. It will generate unnecessary error info If unbind multi-ports on one service .

**Which issue this PR fixes**:
fixes #51694

**Release-note**:
```release-note
NONE
```
2017-10-15 17:38:45 -07:00
Clayton Coleman 3707b10b9f
The DBusFakeConnection should have locks to prevent races
Otherwise tests that use dbus signals fail race detection.
2017-10-11 11:42:19 -04:00
Kubernetes Submit Queue 494be59fda Merge pull request #50478 from leblancd/v6_iptables_cmds
Automatic merge from submit-queue (batch tested with PRs 52520, 52033, 53626, 50478). 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 kube-proxy to use proper iptables commands for IPv6 operation

For iptables save and restore operations, kube-proxy currently uses
the IPv4 versions of the iptables save and restore utilities
(iptables-save and iptables-restore, respectively). For IPv6 operation,
the IPv6 versions of these utilities need to be used
(ip6tables-save and ip6tables-restore, respectively).

Both this change and PR #48551 are needed to get Kubernetes services
to work in an IPv6-only Kubernetes cluster (along with setting
'--bind-address ::0' on the kube-proxy command line. This change
was alluded to in a discussion on services for issue #1443.

fixes #50474



**What this PR does / why we need it**:
This change modifies kube-proxy so that it uses the proper commands for iptables save and
iptables restore for IPv6 operation. Currently kube-proxy uses 'iptables-save' and 'iptables-restore'
regardless of whether it is being used in IPv4 or IPv6 mode. This change fixes kube-proxy so
that it uses 'ip6tables-save' and 'ip6tables-restore' commands when kube-proxy is being run
in IPv6 mode.

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

**Special notes for your reviewer**:

**Release note**:

```release-note NONE
```
2017-10-11 01:41:42 -07:00
Kubernetes Submit Queue aaf14d4619 Merge pull request #53525 from sttts/sttts-scheme-copier-romoval
Automatic merge from submit-queue (batch tested with PRs 53525, 53652). 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>.

apimachinery: remove ObjectCopier interface(s)

The big commit is a mechanical, transitive removal of the copier interfaces in all structs and function calls.
2017-10-10 08:31:41 -07:00
Kubernetes Submit Queue 194501c4aa Merge pull request #53571 from frodenas/util-metrics-error
Automatic merge from submit-queue (batch tested with PRs 53444, 52067, 53571, 53182). 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>.

Return an error if metric cannot be registered

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

`prometheus.MustRegister` panics if a metric cannot be registered. This PR replaces it with `prometheus.Register`, as it does not panic, and returns the error if the metric cannot be registered.

I also adds lacking tests for `RegisterMetricAndTrackRateLimiterUsage`.

**Which issue this PR fixes**:

Fixes #52872

**Special notes for your reviewer**:

None of the `metrics.RegisterMetricAndTrackRateLimiterUsage` invocations check the returned error, so I plan to submit new PRs to address this.

**Release note**:

```release-note
NONE
```
/sig instrumentation
2017-10-10 00:33:25 -07:00
andyzhangx c9070ffa8c remove getAvailableDriveLetter func and test 2017-10-10 04:50:52 +00:00
andyzhangx 5275598d35 not necessary to use disk letter in azure file mount 2017-10-10 03:30:26 +00:00
Ferran Rodenas a334eb1a49 Return an error if metric cannot be registered
`prometheus.MustRegister` panics if the metric cannot be registered.
Instead, use `prometheus.Register` and return the error if the metric
cannot be registered.

Also, add tests for `RegisterMetricAndTrackRateLimiterUsage`.

Signed-off-by: Ferran Rodenas <frodenas@gmail.com>
2017-10-09 11:05:32 +02:00
Kubernetes Submit Queue 85b252d47e Merge pull request #51771 from dixudx/refactor_nsenter
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>.

Refactor nsenter

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

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

**Special notes for your reviewer**:
/assign @jsafrane 

**Release note**:

```release-note
None
```
2017-10-08 23:27:32 -07:00
choury 00f8ae3540 fix duplicate unbind action 2017-10-09 12:14:24 +08:00
Kubernetes Submit Queue 2d1626028e Merge pull request #53058 from kad/fix-version
Automatic merge from submit-queue (batch tested with PRs 52768, 51898, 53510, 53097, 53058). 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 version comparison for versions with preRelease components

**What this PR does / why we need it**:
Fixes algorithm of comparing versions in pkg/util/version.
Also improve unit testing, so reverse comparison of versions also works

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-10-06 13:16:47 -07:00
Dr. Stefan Schimanski ed586da147 apimachinery: remove Scheme.DeepCopy 2017-10-06 14:59:17 +02:00
m1093782566 8f6f382003 implement fakeIPVS update virtual server 2017-10-06 11:58:48 +08:00
Kubernetes Submit Queue 2eadc737aa Merge pull request #53130 from m1093782566/test-fake
Automatic merge from submit-queue (batch tested with PRs 53418, 53366, 53115, 53402, 53130). 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>.

Implement delete real server for fakeIPVS and add UTs

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

* Implement DeleteRealServer() for FakeIPVS because ipvs/proxier needs it.
* Add UTs - Since there are some real logics in fakeIPVS interface, it's important to add some UTs which can help avoiding some mistakes. Sadly, there is already a bug :(

**Which issue this PR fixes**: 

fixes #53137

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-05 17:31:26 -07:00
Kubernetes Submit Queue 3b1b19a1e2 Merge pull request #53120 from m1093782566/fake-ipv6
Automatic merge from submit-queue (batch tested with PRs 53227, 53120). 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 ipv4 in pkg/util/ipvs

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

remove ipv4 in util/ipvs

**Which issue this PR fixes**:

xref: #51866


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-05 13:07:38 -07:00
Kubernetes Submit Queue a2ce3bcf63 Merge pull request #52935 from m1093782566/ipv6
Automatic merge from submit-queue (batch tested with PRs 53454, 53446, 52935, 53443, 52917). 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 ipv4 constraint of Node IPs in ipvs proxier

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

We are targeting to IPV6. So, we should remove ipv4 constraint of Node IPs in ipvs proxier.

Besides, adding some log messages.


**Which issue this PR fixes**:

xref #51866 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-05 05:06:27 -07:00
Kubernetes Submit Queue 33f911cb53 Merge pull request #51221 from MrHohn/kube-proxy-adj-flag
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>.

Use `--oom-score-adj` flag for kube-proxy

**What this PR does / why we need it**:
Replace `echo -998 > /proc/$$$/oom_score_adj` with `--oom-score-adj` flag for kube-proxy.

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

**Special notes for your reviewer**:
/assign @justinsb @vishh 

**Release note**:

```release-note
NONE
```
2017-10-04 14:08:19 -07:00
Kubernetes Submit Queue 15992a6a72 Merge pull request #49826 from dixudx/fix_err_msg_on_two_lines
Automatic merge from submit-queue (batch tested with PRs 49826, 53404). 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 newline "\n" in the error to break log msg to 2 lines

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

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

**Special notes for your reviewer**:
/cc @justinsb @rrati 

**Release note**:

```release-note
avoid newline "\n" in the error to break log msg to 2 lines
```
2017-10-03 15:43:44 -07:00
m1093782566 2243577569 remove ipv4 constraints of Node IPs in ipvs proxier 2017-09-28 16:24:52 +08:00
m1093782566 f21cf88797 implement delete real server for fakeIPVS and add UTs 2017-09-28 15:55:42 +08:00
Alexander Kanevskiy 699756b7d0 Fix version comparison for versions with preRelease components
Improve unit testing, so reverse comparison of versions also works

Fixes #53055
2017-09-27 19:54:43 +03:00
m1093782566 074c8469a0 remove ipv4 in pkg/util/ipvs 2017-09-27 21:09:57 +08:00
Kubernetes Submit Queue 65a2f15e06 Merge pull request #52493 from mtaufen/fix-file-leak
Automatic merge from submit-queue (batch tested with PRs 52721, 53057, 52493, 52998, 52896). 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 a potential file leak

Previously, if a write or sync error occurred, we would not have called
Close(). This commit refactors ReplaceFile() so that we are sure to call
Close(), and also attempts to delete the temporary file if errors occur.

See: https://github.com/kubernetes/kubernetes/pull/52119#discussion_r137916659
Fixes: #53060

```release-note
NONE
```

@yujuhong @ash2k
2017-09-26 15:51:19 -07:00
Michael Taufen 62fecfb0f4 Fix a potential file leak
Previously, if a write or sync error occurred, we would not have called
Close(). This commit refactors ReplaceFile() so that we are sure to call
Close(), and also attempts to delete the temporary file if errors occur.
2017-09-25 20:45:52 -07:00
Di Xu 542bd17e36 auto-gen 2017-09-26 09:57:13 +08:00
Di Xu 57ead4898b use GetFileType per mount.Interface to check hostpath type 2017-09-26 09:57:06 +08:00
Di Xu 46b0b3491f refactor nsenter to new pkg/util 2017-09-26 09:56:44 +08:00
Kubernetes Submit Queue 7c9e614cbb Merge pull request #52873 from ixdy/bazel-cleanup
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>..

bazel: build/test almost everything

**What this PR does / why we need it**: Miscellaneous cleanups and bug fixes. The main motivating idea here was to make `bazel build //...` and `bazel test //...` mostly work. (There's a few reasons these still don't work, but we're a lot closer.)

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @BenTheElder @mikedanese @spxtr
2017-09-24 00:04:36 -07:00
Kubernetes Submit Queue 536409084e Merge pull request #52330 from m1093782566/ipvs-service-equal
Automatic merge from submit-queue (batch tested with PRs 52469, 52574, 52330, 52689, 52829). 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 IPVS service Flags

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

**Which issue this PR fixes**: 

fixes #52393

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-09-23 21:52:51 -07:00
Kubernetes Submit Queue 17ba22aa85 Merge pull request #52469 from andyzhangx/azurefile-mount-windows
Automatic merge from submit-queue (batch tested with PRs 52469, 52574, 52330, 52689, 52829). 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 feature: azurefile mount on windows node

**What this PR does / why we need it**:
feature: azurefile mount on windows node. I created this new PR, close the original one(https://github.com/kubernetes/kubernetes/pull/50233) as there is a big rebase change.
Currently only SMB(a nfs protocol) is supported for windows container in the new Windows 2016 RS3 image, and windows container in RS3 could only use New-SmbGlobalMapping cmdlet for volume mapping, "net use" command does not work for windows container.

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

**Special notes for your reviewer**:
As there is a known blocking issue in Windows 2016 server when mounting a SMB(a NFS protocol in Windows) share on a container host and then bind that share to a container ( Azure file on Windows is using SMB protocol), this PR still could not mount an azure file on current windows 2016 server node, it depends on 2016 RS3 release, and it will still succeed (as a workaround) if customer want to mount an azure file on current windows node.


Main code logic is similar to what it does in Linux node:

1. create target directory in Windows host
2. Use New-SmbGlobalMapping powershell cmdlet to mount SMB azure file to a drive in Windows host
3. Use mklink command to link target directory to the mounted drive

K8s would bind target directory to the container directory
source in mount function would be like:
`\\[accountname].file.core.windows.net\test`

target in mount function would be like:
`c:\var\lib\kubelet\pods\5f679f75-7ce3-11e7-b718-000d3a31dac4\volumes\kubernetes.io~azure-file`

sample azure file config file:
```
apiVersion: v1
kind: Pod
metadata:
 name: iis
spec:
 containers:
  - image: microsoft/iis
    name: iis
    volumeMounts:
      - name: azure
        mountPath: "d:"
 nodeSelector:
   beta.kubernetes.io/os: windows
 volumes:
      - name: azure
        azureFile:
          secretName: azure-secret
          shareName: k8stest
          readOnly: false
```

**Release note**:

```release-note
```
2017-09-23 21:52:46 -07:00
Kubernetes Submit Queue ebb488f3ab Merge pull request #52597 from smarterclayton/roundtrip_options
Automatic merge from submit-queue (batch tested with PRs 52485, 52443, 52597, 52450, 51971). 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>..

Some kubelet flags do not accept their default values

Correct the flags and add a round trip test that ensure these do not
break again in the future.

@deads2k as observed when we tried to turn flags into args.
2017-09-23 18:48:55 -07:00
Kubernetes Submit Queue 4a9fb7d646 Merge pull request #50294 from xingzhou/comment-typo
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>..

Fixed a small comment typo

**Release note**:
```
None
```
2017-09-23 11:27:54 -07:00
Kubernetes Submit Queue 4d5bcda664 Merge pull request #52015 from m1093782566/flush-ipvs
Automatic merge from submit-queue (batch tested with PRs 51929, 52015, 51906, 52069, 51542). 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>..

Support IPVS Flush API

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

Currently, we implement IPVS flush API by deleting IPVS services one by one, which is inefficient.

**Which issue this PR fixes**: 

fixes #52070

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-09-23 06:16:09 -07:00
Kubernetes Submit Queue 7d9eb60837 Merge pull request #51518 from jianglingxia/jlx8291910
Automatic merge from submit-queue (batch tested with PRs 43016, 50503, 51281, 51518, 51582). 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>..

double const in mount_linux.go

**What this PR does / why we need it**:
fix some typo and double const
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-09-22 23:35:59 -07:00
Kubernetes Submit Queue 980a8e6367 Merge pull request #50503 from karataliu/mount_clean
Automatic merge from submit-queue (batch tested with PRs 43016, 50503, 51281, 51518, 51582). 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 diskLooksUnformatted literal

**What this PR does / why we need it**:
#16948 moved the `formatAndMount` function to mount_linux.go, but `diskLooksUnformatted` does not necessarily need to appear in mount_unsupported.go
#31515 Renames `diskLooksUnformatted` to `getDiskFormat`, but did not update the comment

This is to do the small cleanup.

**Which issue this PR fixes**

**Special notes for your reviewer**:

**Release note**:
2017-09-22 23:35:54 -07:00
Jeff Grafton 02fb4200dc Use buildozer to delete licenses() rules 2017-09-21 15:53:22 -07:00
Jeff Grafton 532bd482df Use buildozer to remove deprecated automanaged tags 2017-09-21 15:53:22 -07:00
andyzhangx 98487a0cde only allow cifs mount on windows node 2017-09-20 14:14:54 +00:00
m1093782566 21b02ad574 fix service hash flags 2017-09-20 16:39:47 +08:00
andyzhangx faffe82df7 add feature: azurefile mount on windows node
fix according to review comments

add comments for SMB mount support on Windows
2017-09-20 07:15:25 +00:00
Xing Zhou 9cd219969f Need to validate taint effect when removing taints.
Instead of reporting taint not found, it's better to report user
that the effect is invalid. This will help user to check errors.
So when user tries to remove a taint, two conditions will be checked:
1. Whether or not the effect is an empty string.
2. Whether or not the non-empty effect is a valid taint effect.
2017-09-18 15:42:31 +08:00
Clayton Coleman 748172f94e
Some kubelet flags do not accept their default values
Correct the flags and add a round trip test that ensure these do not
break again in the future.
2017-09-16 16:20:00 -04:00
Erik Stidham 7c108f595d Initial changes for adding forward rules 2017-09-15 13:34:20 -05:00
Jordan Liggitt f8f57d8959
Use separate client for node status loop 2017-09-14 15:56:22 -04:00
Kubernetes Submit Queue 39659ac1dd Merge pull request #51252 from andyzhangx/azuredisk-windows
Automatic merge from submit-queue

Azuredisk mount on windows node

**What this PR does / why we need it**:
This PR will enable azure disk on windows node, customer could create a pod mounted with azure disk on windows node. 
There are a few pending items still left:
1) Current fstype would be forced as NTFS, will change if there is such requirement
2) GetDeviceNameFromMount function is not implemented(empty) because in Linux, we could use "cat /proc/mounts" to read all mounting points in OS easily, but in Windows, there is no such place, I am still figuring out. The empty function would cause a few warning logging, but it will not affect the main logic now.

**Special notes for your reviewer**:
1. This PR depends on https://github.com/kubernetes/kubernetes/pull/51240, which allow windows mount path in config validation
2. There is a bug in docker on windows(https://github.com/moby/moby/issues/34729), the ContainerPath could only be a drive letter now(e.g. D:), dir path would fail in the end.

The example pod with mount path is like below:

```
kind: Pod
apiVersion: v1
metadata:
  name: pod-uses-shared-hdd-5g
  labels:
    name: storage
spec:
  containers:
  - image: microsoft/iis
    name: az-c-01
    volumeMounts:
    - name: blobdisk01
      mountPath: 'F:'
  nodeSelector:
    beta.kubernetes.io/os: windows
  volumes:
  - name: blobdisk01
    persistentVolumeClaim:
      claimName: pv-dd-shared-hdd-5
```

**Release note**:

```release-note
2017-09-12 17:43:13 -07:00
xiazhang 82c909cc99 enable azure disk mount on windows node
add initial work for mount azure file on windows

fix review comments

full implementation for attach azure file on windows node

working azure file mount

remove useless functions

add a workable implementation about mounting azure file on windows node

fix review comments and make the pod creating successful even azure file mount failed

fix according to review comments

add mount_windows_test

add implementation for IsLikelyNotMountPoint func

remove mount_windows_test.go temporaly

add back unit test for mount_windows.go

add normalizeWindowsPath func

fix normalizeWindowsPath func issue

implment azure disk on windows

update bazel BUILD

revert validation.go change as it's another PR

fix merge issue and compiling issue

fix windows compiling issue

fix according to review comments

fix according to review comments

fix cross-build failure

fix according to review comments

fix test build failure temporalily

fix darwin build failure

fix azure windows test failure

add empty implementation of MakeRShared on windows

fix gofmt errors
2017-09-12 01:52:48 +00:00
Michael Taufen 47beb80368 fsync config checkpoint files after writing 2017-09-07 14:42:18 -07:00
m1093782566 7fa9f2ad59 support ipvs flush API 2017-09-06 19:07:42 +08:00
David Ashpole e5a6a79fd7 update cadvisor, docker, and runc godeps 2017-09-05 12:38:57 -07:00
jianglingxia 4629c8a54e squash the commits into one 2017-09-04 09:44:53 +08:00
Kubernetes Submit Queue f07279ada2 Merge pull request #51474 from verult/ProberTest
Automatic merge from submit-queue (batch tested with PRs 51805, 51725, 50925, 51474, 51638)

Flexvolume dynamic plugin discovery: Prober unit tests and basic e2e test.

**What this PR does / why we need it**: Tests for changes introduced in PR #50031 .
As part of the prober unit test, I mocked filesystem, filesystem watch, and Flexvolume plugin initialization.
Moved the filesystem event goroutine to watcher implementation.

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

**Special notes for your reviewer**:
First commit contains added functionality of the mock filesystem.
Second commit is the refactor for moving mock filesystem into a common util directory.
Third commit is the unit and e2e tests.

**Release note**:

```release-note
NONE
```
/release-note-none
/sig storage
/assign @saad-ali @liggitt 
/cc @mtaufen @chakri-nelluri @wongma7
2017-09-03 11:10:05 -07:00
Kubernetes Submit Queue 917f9f02ef Merge pull request #45724 from jsafrane/mount-propagation2
Automatic merge from submit-queue

Make /var/lib/kubelet as shared during startup

This is part of ~~https://github.com/kubernetes/community/pull/589~~ https://github.com/kubernetes/community/pull/659

We'd like kubelet to be able to consume mounts from containers in the future, therefore kubelet should make sure that `/var/lib/kubelet` has shared mount propagation to be able to see these mounts. 

On most distros, root directory is already mounted with shared mount propagation and this code will not do anything. On older distros such as Debian Wheezy, this code detects that `/var/lib/kubelet` is a directory on `/` which has private mount propagation and kubelet bind-mounts `/var/lib/kubelet` as rshared.

Both "regular" linux mounter and `NsenterMounter` are updated here.

@kubernetes/sig-storage-pr-reviews @kubernetes/sig-node-pr-reviews 
@vishh 

Release note:
```release-note
Kubelet re-binds /var/lib/kubelet directory with rshared mount propagation during startup if it is not shared yet.
```
2017-09-02 12:00:30 -07:00
Kubernetes Submit Queue b832992fc6 Merge pull request #49257 from k82cn/k8s_42001
Automatic merge from submit-queue (batch tested with PRs 51574, 51534, 49257, 44680, 48836)

Task 1: Tainted node by condition.

**What this PR does / why we need it**:
Tainted node by condition for MemoryPressure, OutOfDisk and so on.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: part of #42001 

**Release note**:
```release-note
Tainted nodes by conditions as following:
  * 'node.kubernetes.io/network-unavailable=:NoSchedule' if NetworkUnavailable is true
  * 'node.kubernetes.io/disk-pressure=:NoSchedule' if DiskPressure is true
  * 'node.kubernetes.io/memory-pressure=:NoSchedule' if MemoryPressure is true
  * 'node.kubernetes.io/out-of-disk=:NoSchedule' if OutOfDisk is true
```
2017-08-31 23:13:20 -07:00
Cheng Xing 52a77aaccd Added basic Flexvolume dynamic plugin discovery e2e test; added Flexvolume prober unit tests. 2017-08-31 16:50:02 -07:00
Jan Safranek d9500105d8 Share /var/lib/kubernetes on startup
Kubelet makes sure that /var/lib/kubelet is rshared when it starts.
If not, it bind-mounts it with rshared propagation to containers
that mount volumes to /var/lib/kubelet can benefit from mount propagation.
2017-08-30 16:45:04 +02:00
Slava Semushin 19e9e027bb Fix godoc comments. 2017-08-30 15:22:47 +02:00
m1093782566 09a853257f wrapper ipvs API as util 2017-08-30 10:01:21 +08:00
Zihong Zheng 47ddd733d5 Remove cgo flag for oom package 2017-08-29 11:14:02 -07:00
Cheng Xing 8618e28194 Refactoring for filesystem mock move 2017-08-28 16:17:15 -07:00
Cheng Xing fde9541c80 Moving filesystem mock to pkg/util, and added some functionality 2017-08-28 11:33:26 -07:00
Serguei Bezverkhi 1be99dd78e Adding fsGroup check before mounting a volume
fsGroup check will be enforcing that if a volume has already been
mounted by one pod and another pod wants to mount it but has a different
fsGroup value, this mount operation will not be allowed.
2017-08-24 17:33:51 -04:00
Kubernetes Submit Queue bf00190037 Merge pull request #47698 from fabriziopandini/kubeadm308
Automatic merge from submit-queue (batch tested with PRs 46458, 50934, 50766, 50970, 47698)

kubeadm: Warn in preflight checks if KubernetesVersion is of a newer branch than kubeadm

**What this PR does / why we need it**:
see https://github.com/kubernetes/kubeadm/issues/307

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

**Special notes for your reviewer**:

**Release note**:
2017-08-21 18:11:28 -07:00
Kubernetes Submit Queue 198e83588b Merge pull request #46458 from jsafrane/mount-prep
Automatic merge from submit-queue (batch tested with PRs 46458, 50934, 50766, 50970, 47698)

Prepare VolumeHost for running mount tools in containers

This is the first part of implementation of https://github.com/kubernetes/features/issues/278 - running mount utilities in containers.

It updates `VolumeHost` interface:

*  `GetMounter()` now requires volume plugin name, as it is going to return different mounter to different volume plugings, because mount utilities for these plugins can be on different places.
* New `GetExec()` method that should volume plugins use to execute any utilities. This new `Exec` interface will execute them on proper place.
* `SafeFormatAndMount` is updated to the new `Exec` interface.

This is just a preparation, `GetExec` right now leads to simple `os.Exec` and mount utilities are executed on the same place as before. Also, the volume plugins will be updated in subsequent PRs (split into separate PRs, some plugins required lot of changes).

```release-note
NONE
```

@kubernetes/sig-storage-pr-reviews 
@rootfs @gnufied
2017-08-21 18:11:16 -07:00
Kubernetes Submit Queue 990395d5ea Merge pull request #47506 from zhangxiaoyu-zidif/replace-sliceequal-by-deepequal
Automatic merge from submit-queue (batch tested with PRs 50693, 50831, 47506, 49119, 50871)

Use reflect.DeepEqual to replace slicesEqual

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

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/kubernetes/kubernetes/issues/50952

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-21 14:30:00 -07:00
fabriziopandini 35f6b12e79 adding version.Components(), .Major(), .Minor() .Patch() etc. 2017-08-21 22:04:32 +02:00
Kubernetes Submit Queue 4564f3d810 Merge pull request #49993 from mathspanda/master
Automatic merge from submit-queue

verify pkg/util contains no code

**What this PR does / why we need it**:
verify util packages contain no go codes

related issue: #49923
2017-08-17 22:32:13 -07:00
Kubernetes Submit Queue a4acc38c96 Merge pull request #50550 from atlassian/cleanup-configz
Automatic merge from submit-queue (batch tested with PRs 50550, 50768)

Cleanup locking in configz

**What this PR does / why we need it**:
- Reduce scope of lock in `write()` method
- Use the read lock in `write()` method

**Release note**:
```release-note
NONE
```
/kind cleanup

@mikedanese 

p.s. looks like the `Set()` method could be removed if the value is accepted as an argument to `New()`. I.e. looks like to code re-sets the value.
2017-08-17 03:13:57 -07:00
mathspanda 0e441494e7 verify pkg/util contains no code 2017-08-17 15:28:27 +08:00
ymqytw b776df8a20 move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
Jan Safranek 0e547bae22 SafeFormatAndMount should use volume.Exec provided by VolumeHost
We need to execute mkfs / fsck where the utilities are.
2017-08-14 12:16:27 +02:00
Jan Safranek 282404cbc9 Add Exec interface to VolumeHost
This exec should be used by volume plugins to execute mount utilities.
It will eventually execute things in mount containers.
2017-08-14 12:16:25 +02:00
Mikhail Mazurskiy 7e7a811717
Cleanup locking in configz
- Reduce scope of lock in write() method
- User read lock in write() method
2017-08-12 17:24:32 +10:00
Kubernetes Submit Queue be1f14391c Merge pull request #49699 from xingzhou/kube-49384-bug
Automatic merge from submit-queue (batch tested with PRs 50537, 49699, 50160, 49025, 50205)

AddOrUpdateTaint should ignore duplicate Taint.

The parameter of AddOrUpdateTaint is Taint pointer, so should use
Taint object itself to compare with the node's taint list to ignore
duplicate taint.

While doing #49384, found this issue and fixed.

Fixed part of #49384, other test cases will be added in the following patch

**Release note**:
```
None
```
2017-08-11 19:43:57 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
Jeff Grafton cf55f9ed45 Autogenerate BUILD files 2017-08-11 09:30:23 -07:00
Dong Liu a6ff000ea5 Clean up diskLooksUnformatted literal 2017-08-11 16:11:39 +08:00
Klaus Ma 55fa10c182 Tainted node by condition. 2017-08-11 09:55:29 +08:00
Dane LeBlanc b45a406aca Fix kube-proxy to use proper iptables commands for IPv6 operation
For iptables save and restore operations, kube-proxy currently uses
the IPv4 versions of the iptables save and restore utilities
(iptables-save and iptables-restore, respectively). For IPv6 operation,
the IPv6 versions of these utilities needs to be used
(ip6tables-save and ip6tables-restore, respectively).

Both this change and PR #48551 are needed to get Kubernetes services
to work in an IPv6-only Kubernetes cluster (along with setting
'--bind-address ::0' on the kube-proxy command line. This change
was alluded to in a discussion on services for issue #1443.

fixes #50474
2017-08-10 19:24:44 -04:00