Commit Graph

1861 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
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
ymqytw d7659dffff move logs to kubectl/util 2017-08-10 11:30:26 -07:00
Xing Zhou fff9940a3d 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.
2017-08-10 09:36:17 +08:00
Kubernetes Submit Queue 68ac78ae45 Merge pull request #49640 from jsafrane/systemd-mount-service
Automatic merge from submit-queue

Run mount in its own systemd scope.

Kubelet needs to run /bin/mount in its own cgroup.

- When kubelet runs as a systemd service, "systemctl restart kubelet" may kill all processes in the same cgroup and thus terminate fuse daemons that are needed for gluster and cephfs mounts.

- When kubelet runs in a docker container, restart of the container kills all fuse daemons started in the container.

Killing fuse daemons is bad, it basically unmounts volumes from running pods.

This patch runs mount via "systemd-run --scope /bin/mount ...", which makes sure that any fuse daemons are forked in its own systemd scope (= cgroup) and they will survive restart of kubelet's systemd service or docker container.

This helps with #34965

As a downside, each new fuse daemon will run in its own transient systemd service and systemctl output may be cluttered.

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

```release-note
fuse daemons for GlusterFS and CephFS are now run in their own systemd scope when Kubernetes runs on a system with systemd.
```
2017-08-09 12:05:01 -07:00
Jan Safranek dd03384747 Detect systemd on mounter startup 2017-08-08 15:40:27 +02:00
Xing Zhou ecc20e9024 Fixed a small comment typo 2017-08-08 13:47:25 +08:00
Kubernetes Submit Queue 5d24a2c199 Merge pull request #49300 from tklauser/syscall-to-x-sys-unix
Automatic merge from submit-queue

Switch from package syscall to golang.org/x/sys/unix

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

The syscall package is locked down and the comment in https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24 advises to switch code to use the corresponding package from golang.org/x/sys. This PR does so and replaces usage of package syscall with package golang.org/x/sys/unix where applicable. This will also allow to get updates and fixes
without having to use a new go version.

In order to get the latest functionality, golang.org/x/sys/ is re-vendored. This also allows to use Eventfd() from this package instead of calling the eventfd() C function.

**Special notes for your reviewer**:

This follows previous works in other Go projects, see e.g. moby/moby#33399, cilium/cilium#588

**Release note**:

```release-note
NONE
```
2017-08-03 04:02:12 -07:00
Kubernetes Submit Queue ce27fa6359 Merge pull request #48517 from dims/fix-tests-on-osx
Automatic merge from submit-queue (batch tested with PRs 50029, 48517, 49739, 49866, 49782)

iptables_test should not run on OSX or Windows

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

Fix for failing tests. Let's just skip these on darwin and windows
platforms as iptables is not available on these.

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

Fixes #48509

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-02 12:46:50 -07:00
Di Xu 4bef8af685 avoid newline "\n" in the error to break log msg to 2 lines 2017-07-29 13:54:09 +08:00
Jan Safranek 5a8a6110a2 Run mount in its own systemd scope.
Kubelet needs to run /bin/mount in its own cgroup.

- When kubelet runs as a systemd service, "systemctl restart kubelet" may kill
  all processes in the same cgroup and thus terminate fuse daemons that are
  needed for gluster and cephfs mounts.

- When kubelet runs in a docker container, restart of the container kills all
  fuse daemons started in the container.

Killing fuse daemons is bad, it basically unmounts volumes from running pods.

This patch runs mount via "systemd-run --scope /bin/mount ...", which makes
sure that any fuse daemons are forked in its own systemd scope (= cgroup) and
they will survive restart of kubelet's systemd service or docker container.

As a downside, each new fuse daemon will run in its own transient systemd
service and systemctl output may be cluttered.
2017-07-26 16:14:39 +02:00
deads2k 151d39682e add reflector metrics 2017-07-25 09:01:37 -04:00
Kubernetes Submit Queue c1c7193b4d Merge pull request #46514 from ravisantoshgudimetla/scheduler_taints_refactor
Automatic merge from submit-queue (batch tested with PRs 49420, 49296, 49299, 49371, 46514)

Refactoring taint functions to reduce sprawl

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

**Special notes for your reviewer**:
@gmarek @timothysc @k82cn @jayunit100 - I moved some fn's to helpers and some to utils. LMK, if you are ok with this change.

**Release note**:

```release-note
NONE
```
2017-07-21 22:23:24 -07:00
Tobias Klauser 4a69005fa1 switch from package syscall to x/sys/unix
The syscall package is locked down and the comment in [1] advises to
switch code to use the corresponding package from golang.org/x/sys. Do
so and replace usage of package syscall with package
golang.org/x/sys/unix where applicable.

  [1] https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24

This will also allow to get updates and fixes for syscall wrappers
without having to use a new go version.

Errno, Signal and SysProcAttr aren't changed as they haven't been
implemented in /x/sys/. Stat_t from syscall is used if standard library
packages (e.g. os) require it. syscall.SIGTERM is used for
cross-platform files.
2017-07-21 12:14:42 +02:00
Kubernetes Submit Queue feed4aa12a Merge pull request #49234 from mengqiy/master
Automatic merge from submit-queue (batch tested with PRs 49107, 47177, 49234, 49224, 49227)

Move util/exec to vendor

Move util/exec to vendor.
Update import paths.
Update godep

Part of #48209

Associate PR against `k8s.io/utils` repo: https://github.com/kubernetes/utils/pull/5

```release-note
NONE
```

/assign @apelisse
2017-07-20 15:08:22 -07:00
Kubernetes Submit Queue 6329c862ee Merge pull request #49111 from jsafrane/nsenter-path-space
Automatic merge from submit-queue

Fix findmnt parsing in containerized kubelet

NsEnterMounter should not stop parsing findmnt output on the first space but on the last one, just in case the mount point name itself contains a space.

Fixes #49106

```release-note
Fixed unmounting of vSphere volumes when kubelet runs in a container.
```

@kubernetes/sig-storage-pr-reviews
2017-07-20 14:10:31 -07:00
ymqytw 9b393a83d4 update godep 2017-07-20 11:03:49 -07:00
ymqytw 3dfc8bf7f3 update import 2017-07-20 11:03:49 -07:00
ravisantoshgudimetla b01a1c3881 Build files generated 2017-07-19 18:36:12 -04:00
ravisantoshgudimetla 9dbf1a5644 Refactoring taints to reduce sprawl 2017-07-19 18:36:07 -04:00
Jan Safranek 87551071a1 Fix findmnt parsing in containerized kubelet
NsEnterMounter should not stop parsing findmnt output on the first space but
on the last one, just in case the mount point name itself contains a space.
2017-07-18 13:35:44 +02:00
xiangpengzhao 01daf707c5 Refactor: pkg/util into sub-pkgs 2017-07-18 14:34:08 +08:00
Jacob Simpson 29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Davanum Srinivas a6c3af0226 iptables_test should not run on OSX or Windows
Fix for failing tests. Let's just skip building iptables_test.go
on non-linux platforms.

Fixes #48509
2017-07-17 09:59:21 -04:00
Kubernetes Submit Queue 009858f18d Merge pull request #48555 from redbaron/hostPath-and-subPath-symlink
Automatic merge from submit-queue

Fix subPath existence check to not follow symlink

**What this PR does / why we need it**:
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script

**Release note**:
```release-note
Fix pods failing to start when subPath is a dangling symlink from kubelet point of view, which can happen if it is running inside a container
```
2017-07-12 23:43:12 -07:00
Kubernetes Submit Queue 2b03c2e6df Merge pull request #47948 from allencloud/remove-unused-code-in-loadSystemLanguage
Automatic merge from submit-queue

fix system language judging bug in loadSystemLanguage

Signed-off-by: allencloud <allen.sun@daocloud.io>



**What this PR does / why we need it**:
This PR removes some unused code in loadSystemLanguage. Since in code `pieces := strings.Split(langStr, ".")`, even `langStr` is an empty string, `piece` is a slice with one element of empty string, so there is no chance that len(pieces) == 0.

According to these, I think it is OK to remove the unused code in loadSystemLanguage.

According to the discuss we had, finally we decided to use a more accurate way to change the code, using `if len(pieces) != 1` to make the decision. 

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

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2017-07-12 03:42:10 -07:00
Kubernetes Submit Queue 03360d7b65 Merge pull request #48402 from ianchakeres/local-storage-teardown-fix
Automatic merge from submit-queue

Local storage teardown fix

**What this PR does / why we need it**: Local storage uses bindmounts and the method IsLikelyNotMountPoint does not detect these as mountpoints. Therefore, local PVs are not properly unmounted when they are deleted.

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

**Special notes for your reviewer**:

You can use these e2e tests to reproduce the issue and validate the fix works appropriately https://github.com/kubernetes/kubernetes/pull/47999

The existing method IsLikelyNotMountPoint purposely does not check mountpoints reliability (4c5b22d4c6/pkg/util/mount/mount_linux.go (L161)), since the number of mountpoints can be large. 4c5b22d4c6/pkg/util/mount/mount.go (L46)

This implementation changes the behavior for local storage to detect mountpoints reliably, and avoids changing the behavior for any other callers to a UnmountPath.

**Release note**:

```
Fixes bind-mount teardown failure with non-mount point Local volumes (issue https://github.com/kubernetes/kubernetes/issues/48331).
```
2017-07-11 20:35:29 -07:00
Ian Chakeres 2b18d3b6f7 Fixes bind-mount teardown failure with non-mount point Local volumes
Added IsNotMountPoint method to mount utils (pkg/util/mount/mount.go)
Added UnmountMountPoint method to volume utils (pkg/volume/util/util.go)
Call UnmountMountPoint method from local storage (pkg/volume/local/local.go)
IsLikelyNotMountPoint behavior was not modified, so the logic/behavior for UnmountPath is not modified
2017-07-11 17:19:58 -04:00
Kubernetes Submit Queue 22550b62a6 Merge pull request #48514 from freehan/iptables-lock
Automatic merge from submit-queue (batch tested with PRs 47234, 48410, 48514, 48529, 48348)

expose error lock release failure from iptables util

ref: https://github.com/kubernetes/kubernetes/issues/48107
2017-07-07 23:53:36 -07:00
Kubernetes Submit Queue 6cd6d89d40 Merge pull request #48410 from xiangpengzhao/remove-empty-util-dir
Automatic merge from submit-queue (batch tested with PRs 47234, 48410, 48514, 48529, 48348)

Remove unused sub-pkgs in pkg/util

**What this PR does / why we need it**:
Remove no longer used sug-pkgs in pkg/util

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

**Special notes for your reviewer**:
/cc @deads2k 

**Release note**:

```release-note
NONE
```
2017-07-07 23:53:34 -07:00
Maxim Ivanov 020ec43b56 Fix subPath existence check to not follow symlink
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script
2017-07-07 11:52:16 +01:00
Minhan Xia 8de419b19f expose lock release error from iptables util 2017-07-05 14:31:24 -07:00
ymqytw ce561b2044 fix cross build for windows 2017-07-05 12:42:41 -07:00
xiangpengzhao 6cfbd9329a Fix lint errors of pkg/util/net/sets/ipnet.go 2017-07-04 12:04:24 +08:00
xiangpengzhao 016f1cfd8f Remove unused sub-pkgs in pkg/util 2017-07-04 12:04:06 +08:00
ymqytw 8dac9639e4 split util/slice 2017-06-30 23:04:18 -07:00
Kubernetes Submit Queue ed8993e3df Merge pull request #47944 from allencloud/fix-CopyStrings-and-ShuffleStrings-when-slice-is-nil
Automatic merge from submit-queue (batch tested with PRs 48264, 48324, 48125, 47944, 47489)

fix CopyStrings and ShuffleStrings for slice when slice is nil

Signed-off-by: allencloud <allen.sun@daocloud.io>



**What this PR does / why we need it**:
This PR fixes two functions in util/slice.go, in which I think `CopyStrings` and `ShuffleStrings` miss one case. The case is input data is nil, in this case I think the data returned should be nil as well rather than a non-nil slice with 0 element.
In addition, I added some test code for this.
 
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE, I did not raise a issue for this code. I ran into this when code learning.

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2017-06-30 20:58:33 -07:00
ymqytw f0ce897277 move term to kubectl/util 2017-06-30 15:00:24 -07:00
Kubernetes Submit Queue 903a4541ba Merge pull request #48298 from mengqiy/kubectl_crlf
Automatic merge from submit-queue (batch tested with PRs 48295, 48298, 47339, 44910, 48037)

move crlf to kubectl/util

move crlf from pkg/util/crlf to pkg/kubectl/util/crlf

Ref: https://github.com/kubernetes/kubernetes/issues/48209

```release-note
NONE
```
/assign @apelisse @monopole 

cc: @pwittrock
2017-06-30 14:34:26 -07:00
ymqytw 2510a47374 move crlf to kubectl/util 2017-06-29 15:48:41 -07:00
ymqytw 6660726ce6 eliminate kubectl dependency on k8s.io/kubernetes/pkg/util 2017-06-29 14:49:51 -07:00
allencloud 2e79f6c61a remove unused codes in loadSystemLanguage
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-06-29 12:18:11 +08:00
Dan Winship 127eb53d4d Fix the names of some iptables tests
The delete tests were copy+pasted from the create tests, and the names
not fully updated to match.
2017-06-27 09:26:10 -04:00
Dan Winship 3d48091ce8 Fix ebtables_test.go to actually get run, and to pass 2017-06-27 09:26:10 -04:00
Kubernetes Submit Queue 95be540bd4 Merge pull request #47242 from k82cn/make_golint_happy
Automatic merge from submit-queue

Updated comments for functions.
2017-06-26 20:02:40 -07:00
Jan Safranek b73517d437 Fix lint errors
Removal of io.go revealed new lint errors in pkg/util/io
2017-06-26 16:05:35 +02:00
Jan Safranek c2dc5b5bf1 Move LoadPodFromFile to volume utils
SavePodToFile is not used anywhere and LoadPodFromFile is used only by PV
recycler.
2017-06-26 16:02:43 +02:00
allencloud f98bc7d454 fix CopyStrings and ShuffleStrings for slice when slice is nil
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-06-23 11:47:13 +08:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
zhangxiaoyu-zidif f528bce5c6 Use reflect.DeepEqual to replace sliceEqual 2017-06-14 16:25:43 +08:00
Klaus Ma 3953f90102 Updated comments for functions. 2017-06-09 16:41:24 +08:00
William Chang 9ac960124f Add Traditional Chinese translation for kubectl 2017-06-08 15:24:04 +08:00
Kubernetes Submit Queue 69342bd1df Merge pull request #43005 from cmluciano/cml/consolidatesysctl
Automatic merge from submit-queue (batch tested with PRs 43005, 46660, 46385, 46991, 47103)

Consolidate sysctl commands for kubelet

**What this PR does / why we need it**:
These commands are important enough to be in the Kubelet itself.
By default, Ubuntu 14.04 and Debian Jessie have these set to 200 and
20000. Without this setting, nodes are limited in the number of
containers that they can start.

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

**Special notes for your reviewer**:
I had a difficult time writing tests for this. It is trivial to create a fake sysctl for testing, but the Kubelet does not have any tests for the prior settings.
**Release note**:

```release-note
```
2017-06-07 13:30:54 -07:00
Kubernetes Submit Queue 443ed358a2 Merge pull request #46756 from girikuncoro/japanese-translate
Automatic merge from submit-queue (batch tested with PRs 46235, 44786, 46833, 46756, 46669)

Add Japanese translation for kubectl

**What this PR does / why we need it**:
I messed up the original PR(#45562) which was already been reviewed and approved. This PR provides first attempt to translate kubectl in Japanese (related to #40645 and #40591).

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

**Special notes for your reviewer**:
Should be reviewed by member of Japanese k8s community (I stayed in Japan for 4 years, but my language is not as good as native Japanese)
2017-06-07 00:27:51 -07:00
Giri Kuncoro dec34b5197 Add Japanese translation for kubectl 2017-06-02 14:34:39 -07:00
deads2k 954eb3ceb9 move labels to components which own the APIs 2017-05-31 10:32:06 -04:00
Kubernetes Submit Queue 28996ac6c3 Merge pull request #43275 from lvjiangzhao/fix-typo-170317
Automatic merge from submit-queue (batch tested with PRs 43275, 45014, 46449, 46488, 46525)

Fix typo

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-30 07:49:00 -07:00
Wojciech Tyczynski 1242e8ca20 Minor improvement for memory allocations 2017-05-30 08:11:12 +02:00
Wojciech Tyczynski 46e9b522fd Make BoundedFrequencyRunner Run() really non-blocking 2017-05-25 16:12:16 +02:00
Kubernetes Submit Queue ee671e64ee Merge pull request #46266 from thockin/proxy-periodic-runner-2
Automatic merge from submit-queue (batch tested with PRs 44774, 46266, 46248, 46403, 46430)

kube-proxy: ratelimit runs of iptables by sync-period flags

This bounds how frequently iptables can be synced.  It will be no more often than every 10 seconds and no less often than every 1 minute, by default.

@timothysc FYI

@dcbw @freehan FYI
2017-05-25 06:17:56 -07:00
Kubernetes Submit Queue 4234d79aca Merge pull request #45573 from shiywang/zh
Automatic merge from submit-queue (batch tested with PRs 45573, 46354, 46376, 46162, 46366)

Add Simplified Chinese translation for kubectl

What this PR does / why we need it:
This PR provides first attempt to translate kubectl in Simplified Chinese.

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

Special notes for your reviewer:
Although I'm a native speaker for Mandarin Chinese, but I think translation is a whole different knowledge which I'm not good at it, so this pr absolutely need to be polished.
@adohe @mengqiy @resouer @k82cn @caesarxuchao @wanghaoran1988 sorry I think there are so many folks who are good at Chinese I haven't mention, feel free to leave a comment on it : )
also cc @brendandburns
2017-05-25 03:13:57 -07:00
Tim Hockin bbb80c252b Add bounded frequency runner
This lib manages runs of a function to have min and max frequencies.
2017-05-24 20:33:15 -07:00
Kubernetes Submit Queue c586f36e55 Merge pull request #46209 from wojtek-t/remove_iptables_save
Automatic merge from submit-queue (batch tested with PRs 46022, 46055, 45308, 46209, 43590)

Remove Save() from iptables interface

This is what @thockin requested in one of the reviews.
2017-05-22 20:00:00 -07:00
Kubernetes Submit Queue 503a8421fb Merge pull request #38990 from mikedanese/go-genrule-sets
Automatic merge from submit-queue (batch tested with PRs 38990, 45781, 46225, 44899, 43663)

migrate set generation to go_genrule

Depends on https://github.com/kubernetes/release/pull/238
2017-05-22 19:06:58 -07:00
Wojciech Tyczynski 9e6de42745 Remove Save() from iptables interface 2017-05-22 13:23:49 +02:00
Kubernetes Submit Queue 3456d4d239 Merge pull request #46033 from wojtek-t/reduce_memory_allocations_in_kube_proxy
Automatic merge from submit-queue

Reduce memory allocations in kube proxy

Memory allocation (and Go GarbageCollection) seems to be one of the most expensive operations in kube-proxy (I've seen profiles where it was more than 50%).

The commits are mostly independent from each other and all of them are mostly about reusing already allocated memory.

This PR is reducing memory allocation by ~5x (results below from 100-node load test):

before:
```
(pprof) top
38.64GB of 39.11GB total (98.79%)
Dropped 249 nodes (cum <= 0.20GB)
Showing top 10 nodes out of 61 (cum >= 0.20GB)
      flat  flat%   sum%        cum   cum%
   15.10GB 38.62% 38.62%    15.10GB 38.62%  bytes.makeSlice
    9.48GB 24.25% 62.87%     9.48GB 24.25%  runtime.rawstringtmp
    8.30GB 21.21% 84.07%    32.47GB 83.02%  k8s.io/kubernetes/pkg/proxy/iptables.(*Proxier).syncProxyRules
    2.08GB  5.31% 89.38%     2.08GB  5.31%  fmt.(*fmt).padString
    1.90GB  4.86% 94.24%     3.82GB  9.77%  strings.Join
    0.67GB  1.72% 95.96%     0.67GB  1.72%  runtime.hashGrow
    0.36GB  0.92% 96.88%     0.36GB  0.92%  runtime.stringtoslicebyte
    0.31GB  0.79% 97.67%     0.62GB  1.58%  encoding/base32.(*Encoding).EncodeToString
    0.24GB  0.62% 98.29%     0.24GB  0.62%  strings.genSplit
    0.20GB   0.5% 98.79%     0.20GB   0.5%  runtime.convT2E
```

after:
```
7.94GB of 8.13GB total (97.75%)
Dropped 311 nodes (cum <= 0.04GB)
Showing top 10 nodes out of 65 (cum >= 0.11GB)
      flat  flat%   sum%        cum   cum%
    3.32GB 40.87% 40.87%     8.05GB 99.05%  k8s.io/kubernetes/pkg/proxy/iptables.(*Proxier).syncProxyRules
    2.85GB 35.09% 75.95%     2.85GB 35.09%  runtime.rawstringtmp
    0.60GB  7.41% 83.37%     0.60GB  7.41%  runtime.hashGrow
    0.31GB  3.76% 87.13%     0.31GB  3.76%  runtime.stringtoslicebyte
    0.28GB  3.43% 90.56%     0.55GB  6.80%  encoding/base32.(*Encoding).EncodeToString
    0.19GB  2.29% 92.85%     0.19GB  2.29%  strings.genSplit
    0.18GB  2.17% 95.03%     0.18GB  2.17%  runtime.convT2E
    0.10GB  1.28% 96.31%     0.71GB  8.71%  runtime.mapassign
    0.10GB  1.21% 97.51%     0.10GB  1.21%  syscall.ByteSliceFromString
    0.02GB  0.23% 97.75%     0.11GB  1.38%  syscall.SlicePtrFromStrings
```
2017-05-19 23:21:49 -07:00
Wojciech Tyczynski a3da8d7300 Fix naming and comments in kube-proxy. 2017-05-19 21:34:05 +02:00
Wojciech Tyczynski 7d44f83441 Descrese logs verbosity for iptables 2017-05-19 20:44:26 +02:00
Wojciech Tyczynski bcfae7e1ed Extend Iptables interface with SaveInto 2017-05-19 20:44:25 +02:00
Wojciech Tyczynski 028ac8034b Remove SaveAll from iptables interface 2017-05-19 20:44:25 +02:00
Shiyang Wang 95fb791b3f Add Simplified Chinese translation for kubectl
update

update
2017-05-19 16:18:24 +08:00
Paul Michali 65342a0000 IPv6 support for hexCIDR()
Includes these changes:
- Modified so that IPv6 CIDRs can be converted correctly.
- Added test cases for IPv6 addresses.
- Split UTs for hexCIDR() and asciiCIDR() so that masking can be tested.
- Add UTs for failure cases.

Note: Some code that calls hexCIDR() builds a CIDR from the pod IP string
and the concatenation of "/32". These should, in the future, use "128",
if/when the pod IP is IPv6. Not addressed as part of this commit.
2017-05-17 20:35:37 +00:00
Kubernetes Submit Queue c5e9031d7d Merge pull request #45856 from shyamjvs/save-iptables
Automatic merge from submit-queue

Make fake iptables' Save operation more realistic

Ref https://github.com/kubernetes/kubernetes/pull/45622#issuecomment-301624384 (2nd point)

This would make fake IPtables actually return the iptable contents it stores.

cc @kubernetes/sig-scalability-misc @wojtek-t
2017-05-16 04:28:34 -07:00
Shyam Jeedigunta da924fc337 Make fake iptables' Save operation more realistic 2017-05-16 11:58:44 +02:00
Dmitry Shulyak c0a3e9ad13 Fix golint and godeps verification 2017-05-15 16:28:56 +03:00
Dmitry Shulyak 2612e0c78a Move client/unversioned/remotecommand to client-go
Module remotecommand originally part of kubernetes/pkg/client/unversioned was moved
to client-go/tools, and will be used as authoritative in kubectl, e2e and other places.

Module remotecommand relies on util/exec module which will be copied to client-go/pkg/util
2017-05-15 16:28:56 +03:00
Dan Williams a4624a0e75 util/iptables: fix cross-build failures due to syscall.Flock()
Fixes: https://github.com/kubernetes/kubernetes/issues/45554
2017-05-14 23:37:52 -05:00
Cao Shufeng a393e95018 Remove leaked tmp file in unit tests 2017-05-08 18:07:02 +08:00
Kubernetes Submit Queue 15f0468986 Merge pull request #44895 from dcbw/iptables-restore-manual-locking
Automatic merge from submit-queue

util/iptables: grab iptables locks if iptables-restore doesn't support --wait

When iptables-restore doesn't support --wait (which < 1.6.2 don't), it may
conflict with other iptables users on the system, like docker, because it
doesn't acquire the iptables lock before changing iptables rules. This causes
sporadic docker failures when starting containers.

To ensure those don't happen, essentially duplicate the iptables locking
logic inside util/iptables when we know iptables-restore doesn't support
the --wait option.

Unfortunately iptables uses two different locking mechanisms, one until
1.4.x (abstract socket based) and another from 1.6.x (/run/xtables.lock
flock() based).  We have to grab both locks, because we don't know what
version of iptables-restore exists since iptables-restore doesn't have
a --version option before 1.6.2.  Plus, distros (like RHEL) backport the
/run/xtables.lock patch to 1.4.x versions.

Related: https://github.com/kubernetes/kubernetes/pull/43575
See also: https://github.com/openshift/origin/pull/13845
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1417234

@kubernetes/rh-networking @kubernetes/sig-network-misc @eparis @knobunc @danwinship @thockin @freehan
2017-05-06 15:17:21 -07:00
Kubernetes Submit Queue 79a2e359cd Merge pull request #44024 from zhangxiaoyu-zidif/egnew
Automatic merge from submit-queue

fix the typos of e.g.

fix the typos of e.g.


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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-05 23:41:33 -07:00
Dan Williams 1067a22885 iptables: add OWNERS file 2017-05-05 23:34:18 -05:00
Kubernetes Submit Queue 17d33ea82e Merge pull request #44830 from NickrenREN/remove-NodeLegacyHostIP
Automatic merge from submit-queue

Remove deprecated NodeLegacyHostIP

**Release note**:
```release-note
Remove deprecated node address type `NodeLegacyHostIP`.
```

ref #44807
2017-05-05 15:38:58 -07:00
Christopher M. Luciano bafabcbb44
Consolidate sysctl commands for kubelet
These commands are important enough to be in the Kubelet itself.
By default, Ubuntu 14.04 and Debian Jessie have these set to 200 and
20000. Without this setting, nodes are limited in the number of
containers that they can start.
2017-05-02 12:15:01 -07:00
Andy Goldstein 43cb024402 Add kube-proxy config file support
Add support for configuring kube-proxy via a config file instead of
command line flags.
2017-05-01 18:02:47 -04:00
Mike Danese ff4a814cce migrate set generation to go genrule
and move ./types to staging
2017-05-01 11:11:14 -07:00
Clayton Coleman 49209b3394
Make timeouts in the Kubelet slightly offset to aid debugging
Several of these loops overlap, and when they are the reason a failure
is happening it is difficult to sort them out. Slighly misalign these
loops to make their impact obvious.
2017-04-28 12:00:28 -04:00
Dan Williams c7677a4753 util/iptables: grab iptables locks if iptables-restore doesn't support --wait
When iptables-restore doesn't support --wait (which < 1.6.2 don't), it may
conflict with other iptables users on the system, like docker, because it
doesn't acquire the iptables lock before changing iptables rules. This causes
sporadic docker failures when starting containers.

To ensure those don't happen, essentially duplicate the iptables locking
logic inside util/iptables when we know iptables-restore doesn't support
the --wait option.

Unfortunately iptables uses two different locking mechanisms, one until
1.4.x (abstract socket based) and another from 1.6.x (/run/xtables.lock
flock() based).  We have to grab both locks, because we don't know what
version of iptables-restore exists since iptables-restore doesn't have
a --version option before 1.6.2.  Plus, distros (like RHEL) backport the
/run/xtables.lock patch to 1.4.x versions.

Related: https://github.com/kubernetes/kubernetes/pull/43575
See also: https://github.com/openshift/origin/pull/13845
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1417234
2017-04-25 14:26:04 -05:00
Mike Danese e48a4f0af7 fix various bad tests 2017-04-25 11:23:33 -07:00
Kubernetes Submit Queue 9ac111c5f9 Merge pull request #44825 from rata/remove-unused-abstraction
Automatic merge from submit-queue (batch tested with PRs 40060, 44860, 44865, 44825, 44162)

Remove unused chmod/chown abstractions

**What this PR does / why we need it**: Simplifies the code

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-04-24 23:07:44 -07:00
Kubernetes Submit Queue 902d53d5e7 Merge pull request #43575 from dcbw/iptables-restore-lock
Automatic merge from submit-queue (batch tested with PRs 43575, 44672)

util/iptables: check for and use new iptables-restore 'wait' argument

iptables-restore did not previously perform any locking, meaning that
when callers (like kube-proxy) asked iptables-restore to write large
numbers of rules, the iptables-restore process might run in parallel
with other 'iptables' invocations in kubelet (hostports), docker,
and other software.  This causes errors like:

"CNI request failed with status 400: 'Failed to ensure that nat chain
POSTROUTING jumps to MASQUERADE: error checking rule: exit status 4:
iptables: Resource temporarily  unavailable."

or from Docker:

"Failed to allocate and map port 1095-1095: iptables failed:
iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 1095
-j DNAT --to-destination 10.1.0.2:1095 ! -i lbr0: iptables:
Resource temporarily unavailable.\n (exit status 4)"

iptables-restore "wait" functionality was added in iptables git
commit 999eaa241212d3952ddff39a99d0d55a74e3639e which
is not yet in a release.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1417234

@eparis @knobunc @kubernetes/rh-networking @kubernetes/sig-network-misc @freehan @thockin @brendandburns
2017-04-24 10:33:58 -07:00
NickrenREN 7d00e5cfb6 remove deprecated NodeLegacyHostIP 2017-04-24 11:01:25 +08:00
Rodrigo Campos 2eb1583e4b Remove unused chmod/chown abstractions
These abstractions have not been used since I first hacked into
kubernetes, so let's just remove them and add them back if it's needed
later.
2017-04-23 20:25:23 -03:00
Dan Williams 4cd6d34a0b util/iptables: check for and use new iptables-restore 'wait' argument
iptables-restore did not previously perform any locking, meaning that
when callers (like kube-proxy) asked iptables-restore to write large
numbers of rules, the iptables-restore process might run in parallel
with other 'iptables' invocations in kubelet (hostports), docker,
and other software.  This causes errors like:

"CNI request failed with status 400: 'Failed to ensure that nat chain
POSTROUTING jumps to MASQUERADE: error checking rule: exit status 4:
iptables: Resource temporarily  unavailable."

or from Docker

"Failed to allocate and map port 1095-1095: iptables failed:
iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 1095
-j DNAT --to-destination 10.1.0.2:1095 ! -i lbr0: iptables:
Resource temporarily unavailable.\n (exit status 4)"

iptables-restore "wait" functionality was added in iptables git
commit 999eaa241212d3952ddff39a99d0d55a74e3639e but is NOT YET
in a released version of iptables.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1417234
2017-04-20 13:38:44 -05:00
Kubernetes Submit Queue 409b0a6f5d Merge pull request #44222 from fabianofranz/better_generic_getters_and_describers
Automatic merge from submit-queue (batch tested with PRs 44222, 44614, 44292, 44638)

Smarter generic getters and describers

Makes printers and describers smarter for generic resources.

This traverses unstructured objects and prints their attributes for generic resources (TPR, federated API, etc) in `kubectl get` and `kubectl describe`. Makes use of the object's field names to come up with a best guess for describer labels and get headers, and field value types to understand how to better print it, indent, etc.

A nice intermediate solution while we don't have [get and describe extensions](https://github.com/kubernetes/community/pull/308).

Examples:

```
$ kubectl get serviceclasses
NAME                    KIND                                          BINDABLE   BROKER NAME   OSB GUID
user-provided-service   ServiceClass.v1alpha1.servicecatalog.k8s.io   false      ups-broker    4f6e6cf6-ffdd-425f-a2c7-3c9258ad2468
```

```
$ kubectl describe serviceclasses/user-provided-service
Name:		user-provided-service
Namespace:	
Labels:		<none>
Annotations:	FOO=BAR
		openshift.io/deployment.phase=test
OSB Metadata:	<nil>
Kind:		ServiceClass
Metadata:
  Self Link:		/apis/servicecatalog.k8s.io/v1alpha1/serviceclassesuser-provided-service
  UID:			1509bd96-1b05-11e7-98bd-0242ac110006
  Resource Version:	256
  Creation Timestamp:	2017-04-06T20:10:29Z
Broker Name:		ups-broker
Bindable:		false
Plan Updatable:		false
OSB GUID:		4f6e6cf6-ffdd-425f-a2c7-3c9258ad2468
API Version:		servicecatalog.k8s.io/v1alpha1
Plans:
  Name:		default
  OSB GUID:	86064792-7ea2-467b-af93-ac9694d96d52
  OSB Free:	true
  OSB Metadata:	<nil>
Events:		<none>
```

**Release note**:
```release-note
Improved output on 'kubectl get' and 'kubectl describe' for generic objects.
```
PTAL @pmorie @pwittrock @kubernetes/sig-cli-pr-reviews
2017-04-18 17:41:59 -07:00
Kubernetes Submit Queue a1684fea80 Merge pull request #42085 from cblecker/gofmt-fix
Automatic merge from submit-queue (batch tested with PRs 40055, 42085, 44509, 44568, 43956)

Fix gofmt errors

**What this PR does / why we need it**:
There were some gofmt errors on master. Ran the following to fix:
```
hack/verify-gofmt.sh | grep ^diff | awk '{ print $2 }' | xargs gofmt -w -s
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-04-17 15:39:07 -07:00
Fabiano Franz 151770c8fd Smarter describer for generic resources 2017-04-17 15:42:47 -03:00
Kubernetes Submit Queue 32e927f4d8 Merge pull request #44506 from caesarxuchao/fix-cross-build
Automatic merge from submit-queue

fix cross-build

Fix https://github.com/kubernetes/kubernetes/pull/41543#issuecomment-294207870
2017-04-14 14:51:06 -07:00
Chao Xu 59396e6b13 fix cross-build 2017-04-14 11:45:11 -07:00
Mike Danese a05c3c0efd autogenerated 2017-04-14 10:40:57 -07:00
Kubernetes Submit Queue 4653a9b280 Merge pull request #41543 from dshulyak/decouple_remotecommand
Automatic merge from submit-queue (batch tested with PRs 44406, 41543, 44071, 44374, 44299)

Decouple remotecommand

Refactored unversioned/remotecommand to decouple it from undesirable dependencies:

- term package now is not required, and functionality required to resize terminal size can be plugged in directly in kubectl
- in order to remove dependency on kubelet package - constants from kubelet/server/remotecommand were moved to separate util package (pkg/util/remotecommand)
- remotecommand_test.go moved to pkg/client/tests module
2017-04-13 19:52:05 -07:00
Dmitry Shulyak f50480c714 Decouple remotecommand client from term/kubelet dependencies
In order to move client/unversioned/remotecommand to client-go as a followup
for this change we have to decouple it from tons of dependencies
2017-04-13 15:56:40 +03:00
Avesh Agarwal 0a9cdbb587 Auto-generated stuff. 2017-04-06 16:15:34 -04:00
Avesh Agarwal af53794854 Pod toleration restriction plugin with taints and tolerations. 2017-04-06 16:15:34 -04:00
zhangxiaoyu-zidif 932ece5cfd e3d534b2c4 2017-04-04 14:16:34 +08:00
Christoph Blecker 6681835b0c
Fix gofmt errors 2017-03-28 17:12:04 -07:00
Kubernetes Submit Queue 1ed77078da Merge pull request #43378 from jsafrane/fix-partition-mount
Automatic merge from submit-queue (batch tested with PRs 43378, 43216, 43384, 43083, 43428)

Do not reformat devices with partitions

`lsblk` reports FSTYPE of devices with partition tables as empty string `""`,
which is indistinguishable from empty devices. We must look for dependent
devices (i.e. partitions) to see that the device is really empty and report
error otherwise.

The main point of this patch is to run `lsblk` without `"-n"`, i.e. print all
dependent devices and check it output.

Sample output:
```
  FirstSeen     LastSeen        Count   From                                    SubObjectPath   Type            Reason          Message
  ---------     --------        -----   ----                                    -------------   --------        ------          -------
  10s           10s             1       default-scheduler                                       Normal          Scheduled       Successfully assigned testpod to ip-172-18-11-149.ec2.internal
  2s            2s              1       kubelet, ip-172-18-11-149.ec2.internal                  Warning         FailedMount     MountVolume.MountDevice failed for volume "kubernetes.io/aws-ebs/vol-0fa9da8b91913b187" (spec.Name: "vol") pod "b74f68c5-0d6a-11e7-9233-0e11251010c0" (UID: "b74f68c5-0d6a-11e7-9233-0e11251010c0") with: failed to mount the volume as "ext4", it already contains unknown data, probably partitions. Mount error: mount failed: exit status 32
Mounting command: mount
Mounting arguments: /dev/xvdbb /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/vol-0fa9da8b91913b187 ext4 [defaults]
Output: mount: wrong fs type, bad option, bad superblock on /dev/xvdbb,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

```

Without this patch, the device would be reformatted and all data in the device partitions would be lost.

Fixes #13212

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

@kubernetes/sig-storage-pr-reviews
2017-03-25 21:22:22 -07:00
Kubernetes Submit Queue d14854fd5c Merge pull request #37698 from jsafrane/remove-all-filesystems
Automatic merge from submit-queue (batch tested with PRs 41139, 41186, 38882, 37698, 42034)

Make kubelet never delete files on mounted filesystems

With bug #27653, kubelet could remove mounted volumes and delete user data.
The bug itself is fixed, however our trust in kubelet is significantly lower.
Let's add an extra version of RemoveAll that does not cross mount boundary
(rm -rf --one-file-system).

It calls lstat(path) three times for each removed directory - once in
RemoveAllOneFilesystem and twice in IsLikelyNotMountPoint, however this way
it's platform independent and the directory that is being removed by kubelet
should be almost empty.
2017-03-24 12:33:27 -07:00
Jan Safranek 4cf36b8b39 Do not reformat devices with partitions
lsblk reports FSTYPE of devices with partition tables as empty string "",
which is indistinguishable from empty devices. We must look for dependent
devices (i.e. partitions) to see that the device is really empty and report
error otherwise.

I checked that LVM, LUKS and MD RAID have their own FSTYPE in lsblk output,
so it should be only a partition table that has empty FSTYPE.

The main point of this patch is to run lsblk without "-n", i.e. print all
dependent devices and check if they're there.
2017-03-20 13:08:13 +01:00
lvjiangzhao 92fff6c9c4 fix typo 2017-03-17 13:42:12 +08:00
Yifan Gu a489bd2674 pkg/util/flock: Fix the flock so it actually locks.
With this PR, the second call to `Acquire()` will block unless the lock is released (process exits).
Also removed the memory mutex in the previous code since we don't need `Release()` here so no need to save and protect the local fd.

Fix #42929.
2017-03-13 14:24:59 -07:00
Kubernetes Submit Queue 44a7be98fd Merge pull request #41618 from JiangtianLi/k8swin
Automatic merge from submit-queue (batch tested with PRs 42316, 41618, 42201, 42113, 42191)

Support unqualified and partially qualified domain name in DNS query in Windows kube-proxy

**What this PR does / why we need it**:
In Windows container networking, --dns-search is not currently supported on Windows Docker. Besides, even with --dns-suffix, inside Windows container DNS suffix is not appended to DNS query names. That makes unqualified domain name or partially qualified domain name in DNS query not able to resolve.

This PR provides a solution to resolve unqualified domain name or partially qualified domain name in DNS query for Windows container in Windows kube-proxy. It uses well-known Kubernetes DNS suffix as well host DNS suffix search list to append to the name in DNS query. DNS packet in kube-proxy UDP stream is modified as appropriate.

This PR affects the Windows kube-proxy only.

**Special notes for your reviewer**:
This PR is based on top of Anthony Howe's commit 48647fb, 0e37f0a and 7e2c71f which is already included in the PR 41487. Please only review commit b9dfb69.

**Release note**:

```release-note
Add DNS suffix search list support in Windows kube-proxy.
```
2017-03-01 07:48:16 -08:00
Kubernetes Submit Queue 81d01a84e0 Merge pull request #41944 from jingxu97/Feb/mounter
Automatic merge from submit-queue (batch tested with PRs 35094, 42095, 42059, 42143, 41944)

Use chroot for containerized mounts

This PR is to modify the containerized mounter script to use chroot
instead of rkt fly. This will avoid the problem of possible large number
of mounts caused by rkt containers if they are not cleaned up.
2017-02-28 09:20:21 -08:00
Jan Safranek d7d039dba2 Make kubelet never delete files on mounted filesystems
With bug #27653, kubelet could remove mounted volumes and delete user data.
The bug itself is fixed, however our trust in kubelet is significantly lower.
Let's add an extra version of RemoveAll that does not cross mount boundary
(rm -rf --one-file-system).

It calls lstat(path) three times for each removed directory - once in
RemoveAllOneFilesystem and twice in IsLikelyNotMountPoint, however this way
it's platform independent and the directory that is being removed by kubelet
should be almost empty.
2017-02-28 14:32:07 +01:00
Jiangtian Li b9dfb69dd7 Fix DNS suffix search list issue for Windows container and workaround in kube-proxy.
kube-proxy iterates over DNS suffix search list and appends to DNS query for client.
2017-02-27 19:25:46 -08:00
Anthony Howe 0e37f0a890 cleanup proxier 2017-02-27 16:00:49 -08:00
Minhan Xia f006c8bcd3 teach kubenet to use annotation instead of pod object for traffic shaper 2017-02-27 10:11:09 -08:00
Kubernetes Submit Queue bf984aa328 Merge pull request #42120 from kevin-wangzefeng/kubectl-taint-respect-noexecute
Automatic merge from submit-queue (batch tested with PRs 41116, 41804, 42104, 42111, 42120)

make kubectl taint command respect effect NoExecute

**What this PR does / why we need it**:
Part of feature forgiveness implementation, make kubectl taint command respect effect NoExecute.

**Which issue this PR fixes**: 
Related Issue: #1574
Related PR: #39469

**Special notes for your reviewer**:

**Release note**:

```release-note
make kubectl taint command respect effect NoExecute
```
2017-02-27 04:10:30 -08:00
Kubernetes Submit Queue d1f5331102 Merge pull request #41804 from chakri-nelluri/flex
Automatic merge from submit-queue (batch tested with PRs 41116, 41804, 42104, 42111, 42120)

Add support for attacher/detacher interface in Flex volume

Add support for attacher/detacher interface in Flex volume
This change breaks backward compatibility and requires to be release noted.

```release-note
Flex volume plugin is updated to support attach/detach interfaces. It broke backward compatibility. Please update your drivers and implement the new callouts. 
```
2017-02-27 04:10:25 -08:00
Kevin f4d3339612 make kubectl respect taint effect NoExecute 2017-02-26 22:41:57 +08:00
Kubernetes Submit Queue 258a5cb3f1 Merge pull request #40665 from brendandburns/i18n
Automatic merge from submit-queue (batch tested with PRs 40665, 41094, 41351, 41721, 41843)

Update i18n tools and process.

@fabianofranz @zen @kubernetes/sig-cli-pr-reviews 

This is an update to the translation process based on feedback from folks.

The main changes are:
   * `msgctx` is being removed from the files.
   * String wrapping and string extraction have been separated.
   * More tools from the `gettext` family of tools are being used
   * Extracted strings are being sorted for canonical ordering
   * A `.pot` template has been added.
2017-02-25 03:56:51 -08:00
Kubernetes Submit Queue a426904009 Merge pull request #31515 from jsafrane/format-error
Automatic merge from submit-queue (batch tested with PRs 41714, 41510, 42052, 41918, 31515)

Show specific error when a volume is formatted by unexpected filesystem.

kubelet now detects that e.g. xfs volume is being mounted as ext3 because of
wrong volume.Spec.

Mount error is left in the error message to diagnose issues with mounting e.g.
'ext3' volume as 'ext4' - they are different filesystems, however kernel should
mount ext3 as ext4 without errors.

Example kubectl describe pod output:

```
  FirstSeen     LastSeen        Count   From                                    SubobjectPath   Type            Reason          Message
  41s           3s              7       {kubelet ip-172-18-3-82.ec2.internal}                   Warning         FailedMount     MountVolume.MountDevice failed for volume "kubernetes.io/aws-ebs/aws://us-east-1d/vol-ba79c81d" (spec.Name: "pvc-ce175cbb-6b82-11e6-9fe4-0e885cca73d3") pod "3d19cb64-6b83-11e6-9fe4-0e885cca73d3" (UID: "3d19cb64-6b83-11e6-9fe4-0e885cca73d3") with: failed to mount the volume as "ext4", it's already formatted with "xfs". Mount error: mount failed: exit status 32
Mounting arguments: /dev/xvdba /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/us-east-1d/vol-ba79c81d ext4 [defaults]
Output: mount: wrong fs type, bad option, bad superblock on /dev/xvdba,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
```
2017-02-25 02:17:57 -08:00
Chakravarthy Nelluri 0d2af70e95 Add support for attacher/detacher interface in Flex volume 2017-02-24 20:18:06 -05:00
Jing Xu ac22416835 Use chroot for containerized mounts
This PR is to modify the containerized mounter script to use chroot
instead of rkt fly. This will avoid the problem of possible large number
of mounts caused by rkt containers if they are not cleaned up.
2017-02-24 13:46:26 -08:00
Brendan Burns be26836f64 Update extraction script, sort messages, add .pot file. 2017-02-23 18:53:00 +00:00
Anthony Howe 48647fb9b5 add tcp or udp proxy for service addresses 2017-02-22 19:42:33 -08:00
Tim Hockin c88b2d9bf4 Merge pull request #41029 from jingxu97/Feb/mountonwer
Add owner file in /pkg/util/mount package
2017-02-21 16:29:51 -06:00
Kubernetes Submit Queue 98962212a3 Merge pull request #41330 from feiskyer/fix
Automatic merge from submit-queue (batch tested with PRs 41706, 39063, 41330, 41739, 41576)

Fix regex match doc of procfs.PidOf

Fixes #41247.

cc @bboreham
2017-02-21 02:24:41 -08:00
Aaron Crickenberger ddc8d8c400 fix FakeMounter to work with OSX
OSX 10.11.x has `/var` symlinked to `/private/var`, which was tripping
up logic in `mount.GetMountRefs`

This fixes unit tests for pkg/volume/fc and pkg/volume/iscsi
2017-02-15 16:14:33 -08:00
Harry Zhang 3bdc3f25ec Use fnv.New32a() in hash instead adler32 2017-02-15 14:03:54 +08:00
Pengfei Ni 55bfc8d7e6 Fix regex match doc of procfs.PidOf 2017-02-13 23:10:14 +08:00
Jan Safranek c8df30973b Show specific error when a volume is formatted by unexpected filesystem.
kubelet now detects that e.g. xfs volume is being mounted as ext3 because of
wrong volume.Spec.

Mount error is left in the error message to diagnose issues with mounting e.g.
'ext3' volume as 'ext4' - they are different filesystems, however kernel should
mount ext3 as ext4 without errors.
2017-02-13 12:15:34 +01:00
Jing Xu fb808c3417 Add owner file in /pkg/util/mount package
Add owner file in /pkg/util/mount
2017-02-06 10:51:26 -08:00
Kubernetes Submit Queue 5eef12700c Merge pull request #40645 from brendandburns/fr
Automatic merge from submit-queue

Add initial french translations for kubectl

Add initial French translations, mostly as an example of how to add a new language.

@fabianofranz @kubernetes/sig-cli-pr-reviews
2017-01-31 21:27:52 -08:00
Kubernetes Submit Queue 0c15857a1d Merge pull request #40145 from nebril/iptables-util-unit-tests
Automatic merge from submit-queue (batch tested with PRs 38443, 40145, 40701, 40682)

pkg/util/iptables missing unit tests
2017-01-30 20:59:42 -08:00
deads2k c9a008dff3 move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
deads2k 2c1c0f3f72 move workqueue to client-go 2017-01-30 09:08:21 -05:00
Brendan Burns 45ade78eb3 Add initial french translations as an example. 2017-01-29 22:56:48 -08:00
Dr. Stefan Schimanski 44ea6b3f30 Update generated files 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski 79adb99a13 pkg/api: move Semantic equality to k8s.io/apimachinery/pkg/api/equality 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski bc6fdd925d pkg/api/resource: move to apimachinery 2017-01-29 21:41:44 +01:00
Dr. Stefan Schimanski a12c661773 pkg/util: move trace.go to k8s.io/apiserver/pkg/util/trace 2017-01-29 21:41:44 +01:00
Dr. Stefan Schimanski 674d78b2ab pkg/util: move httpstream to k8s.io/apimachinery 2017-01-27 15:10:42 -05:00
Dr. Stefan Schimanski a0137e9b28 Update generated files 2017-01-25 19:49:45 +01:00
Dr. Stefan Schimanski e57d7b1c60 third_party/forked/golang/netutil: move to k8s.io/apimachinery 2017-01-25 19:45:10 +01:00
Dr. Stefan Schimanski d216ebef73 pkg/util: move proxy into k8s.io/apiserver 2017-01-25 19:45:10 +01:00
Dr. Stefan Schimanski d7eb3b6870 pkg/util: move uuid and strategicpatch into k8s.io/apimachinery 2017-01-25 19:45:09 +01:00
Dr. Stefan Schimanski 8541304582 pkg/util: move CompileRegex helper into apiserver
This is a little helper, not a generic utility of general value.
2017-01-25 17:21:12 +01:00
Dr. Stefan Schimanski 3bd00afaf9 pkg/util: move Trie to k8s.io/apiserver 2017-01-25 17:21:12 +01:00
Dr. Stefan Schimanski 2b8e938128 Update generated files 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 82826ec273 pkg/util/flag: move to k8s.io/apiserver 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski a6b2ebb50c pkg/flag: make feature gate extensible and split between generic and kube 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 56d60cfae6 pkg/util: move flags from pkg/util/config to pkg/util/flags 2017-01-24 20:56:03 +01:00
deads2k 5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
Clayton Coleman 4f865efdb9
Create meta/internalversion for ListOptions
Move over only the conversions that are needed, create a new scheme that
is private to meta and only accessible via ParameterCodec. Move half of
pkg/util/labels/.readonly to pkg/apis/meta/v1/labels.go
2017-01-23 16:53:18 -05:00
Kubernetes Submit Queue fce60637ae Merge pull request #39341 from smarterclayton/termination_log
Automatic merge from submit-queue

Improve TerminationMessagePath to be more flexible

* Support `terminationMessagePolicy: fallbackToLogsOnError` which allows pod authors to get useful information from containers as per kubernetes/community#154
* Set an upper bound on the size of the termination message path or log output to prevent callers from DoSing the master
* Add tests for running as root, non-root, and for the new terminationMessagePolicy cases.

I set the limit to 4096 bytes, but this may be too high for large pod containers.  Probably need to set an absolute bound, i.e. max message size allowed is 20k total, and we truncate if we're above that limit.

Fixes #31839, #23569

```release-note
A new field `terminationMessagePolicy` has been added to containers that allows a user to request `FallbackToLogsOnError`, which will read from the container's logs to populate the termination message if the user does not write to the termination message log file.  The termination message file is now properly readable for end users and has a maximum size (4k bytes) to prevent abuse.  Each pod may have up to 12k bytes of termination messages before the contents of each will be truncated.
```
2017-01-23 12:13:33 -08:00
Antoine Pelisse 62af7dd33d OWNERS: Update latest OWNERS files
These files have been created lately, so we don't have much information
about them anyway, so let's just:
- Remove assignees and make them approvers
- Copy approves as reviewers
2017-01-23 10:05:48 -08:00
Clayton Coleman 2bb2604f0b
Limit the size of the termination log and allow log input
Enforce the following limits:

12kb for total message length in container status
4kb for the termination message path file
2kb or 80 lines (whichever is shorter) from the log on error

Fallback to log output if the user requests it.
2017-01-23 12:26:38 -05:00
Clayton Coleman e6d35b0362
generated: api 2017-01-23 12:26:35 -05:00
deads2k 335ef747d6 mechanical 2017-01-23 10:03:55 -05:00
deads2k 9c6a522882 mechanical results of client auth plugin 2017-01-20 08:05:18 -05:00
deads2k 2f51cc4ce4 move client auth plugins 2017-01-20 08:04:53 -05:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k 32a2c2d05c remove old restclient 2017-01-20 07:56:35 -05:00
Maciej Kwiek 2220c6dfbf pkg/util/iptables missing unit tests
Added tests for Save, SaveAll, Restore and RestoreAll
2017-01-20 10:50:45 +01:00
deads2k c47717134b move utils used in restclient to client-go 2017-01-19 07:55:14 -05:00
Kubernetes Submit Queue 723fa08767 Merge pull request #39324 from wojtek-t/change_patch_api
Automatic merge from submit-queue

Prepare for using optimized conversion to/from map[string]interface{} in Patch operation

Ref #39017
2017-01-19 00:50:12 -08:00
Andrew Rynhard f46bf42ba0 Add authorization mode to kubeadm 2017-01-18 14:02:53 -08:00
Jordan Liggitt e49554501f
Use versioned Taint/Toleration/AllowPods objects when marshalling 2017-01-18 12:52:14 -05:00
Kubernetes Submit Queue 6dfe5c49f6 Merge pull request #38865 from vwfs/ext4_no_lazy_init
Automatic merge from submit-queue

Enable lazy initialization of ext3/ext4 filesystems

**What this PR does / why we need it**: It enables lazy inode table and journal initialization in ext3 and ext4.

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

**Release note**:
```release-note
Enable lazy inode table and journal initialization for ext3 and ext4
```

**Special notes for your reviewer**:
This PR removes the extended options to mkfs.ext3/mkfs.ext4, so that the defaults (enabled) for lazy initialization are used.

These extended options come from a script that was historically located at */usr/share/google/safe_format_and_mount* and later ported to GO so this dependency to the script could be removed. After some search, I found the original script here: https://github.com/GoogleCloudPlatform/compute-image-packages/blob/legacy/google-startup-scripts/usr/share/google/safe_format_and_mount

Checking the history of this script, I found the commit [Disable lazy init of inode table and journal.](4d7346f7f5). This one introduces the extended flags with this description:
```
Now that discard with guaranteed zeroing is supported by PD,
initializing them is really fast and prevents perf from being affected
when the filesystem is first mounted.
```

The problem is, that this is not true for all cloud providers and all disk types, e.g. Azure and AWS. I only tested with magnetic disks on Azure and AWS, so maybe it's different for SSDs on these cloud providers. The result is that this performance optimization dramatically increases the time needed to format a disk in such cases.

When mkfs.ext4 is told to not lazily initialize the inode tables and the check for guaranteed zeroing on discard fails, it falls back to a very naive implementation that simply loops and writes zeroed buffers to the disk. Performance on this highly depends on free memory and also uses up all this free memory for write caching, reducing performance of everything else in the system. 

As of https://github.com/kubernetes/kubernetes/issues/30752, there is also something inside kubelet that somehow degrades performance of all this. It's however not exactly known what it is but I'd assume it has something to do with cgroups throttling IO or memory. 

I checked the kernel code for lazy inode table initialization. The nice thing is, that the kernel also does the guaranteed zeroing on discard check. If it is guaranteed, the kernel uses discard for the lazy initialization, which should finish in a just few seconds. If it is not guaranteed, it falls back to using *bio*s, which does not require the use of the write cache. The result is, that free memory is not required and not touched, thus performance is maxed and the system does not suffer.

As the original reason for disabling lazy init was a performance optimization and the kernel already does this optimization by default (and in a much better way), I'd suggest to completely remove these flags and rely on the kernel to do it in the best way.
2017-01-18 09:09:52 -08:00
Wojciech Tyczynski d08abdb187 Allow for returning map[string]interface{} from patch. 2017-01-18 11:53:30 +01:00
Kubernetes Submit Queue d357a72161 Merge pull request #40039 from timstclair/api-redirect
Automatic merge from submit-queue

Enable streaming proxy redirects by default (beta)

Prerequisite to moving CRI to Beta.

I'd like to enable this early in our 1.6 cycle to get plenty of test coverage before release.

@yujuhong @liggitt 

```release-note
Follow redirects for streaming requests (exec/attach/port-forward) in the apiserver by default (alpha -> beta).
```
2017-01-17 16:18:48 -08:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
Tim St. Clair b42663bb14
Enable streaming proxy redirects by default (beta) 2017-01-17 12:56:03 -08:00
Kubernetes Submit Queue e5fe366eaf Merge pull request #39894 from deads2k/client-03-remove-old
Automatic merge from submit-queue

Remove packages which are now apimachinery

Removes all the content from the packages that were moved to `apimachinery`.  This will force all vendoring projects to figure out what's wrong.  I had to leave many empty marker packages behind to have verify-godep succeed on vendoring heapster.

@sttts straight deletes and simple adds
2017-01-17 12:00:00 -08:00
deads2k 26c46971f2 move PatchType to apimachinery 2017-01-17 08:32:05 -05:00
deads2k a6b655fb6a add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
deads2k 67fac70ea3 remove files moved to apimachinery 2017-01-17 07:46:34 -05:00
deads2k 8686d67c80 move pkg/util/rand 2017-01-16 16:04:03 -05:00
deads2k 7993e7c8aa move openapi types to pkg/openapi 2017-01-16 13:40:14 -05:00
Kubernetes Submit Queue 6defc30337 Merge pull request #39882 from deads2k/api-59-errors
Automatic merge from submit-queue (batch tested with PRs 38592, 39949, 39946, 39882)

move api/errors to apimachinery

`pkg/api/errors` is a set of helpers around `meta/v1.Status` that help to create and interpret various apiserver errors.  Things like `.NewNotFound` and `IsNotFound` pairings.  This pull moves it into apimachinery for use by the clients and servers.

@smarterclayton @lavalamp First commit is the move plus minor fitting.  Second commit is straight replace and generation.
2017-01-16 10:37:42 -08:00
deads2k 77b4d55982 mechanical 2017-01-16 09:35:12 -05:00
Dr. Stefan Schimanski 918868b115 genericapiserver: cut off certificates api dependency 2017-01-16 14:10:59 +01:00
Kubernetes Submit Queue eb9f953496 Merge pull request #39876 from deads2k/generic-20-deps-03
Automatic merge from submit-queue

move more things to apiserver

```
pkg/genericapiserver/api/handlers/negotiation/ -> apiserver/pkg/handlers/negotiation
pkg/genericapiserver/api/metrics -> apiserver/pkg/metrics
pkg/genericapiserver/api/request -> apiserver/pkg/request
pkg/util/wsstream -> apiserver/pkg/util/wsstream
plugin/pkg/auth/authenticator/request/headerrequest -> apiserver/pkg/authentication/request/headerrequest
plugin/pkg/webhook -> apiserver/pkg/webhook
```

and mechanicals.

`k8s.io/kubernetes/pkg/genericapiserver/routes/data/swagger` needs to be sorted out.
2017-01-16 04:14:37 -08:00
Kubernetes Submit Queue 5723979b60 Merge pull request #39525 from kargakis/update-equality-helper
Automatic merge from submit-queue (batch tested with PRs 39807, 37505, 39844, 39525, 39109)

Update deployment equality helper

@mfojtik @janetkuo this is split out of https://github.com/kubernetes/kubernetes/pull/38714 to reduce the size of that PR, ptal
2017-01-13 13:40:45 -08:00
deads2k 31b6ba4e94 mechanicals 2017-01-13 16:33:09 -05:00
deads2k 81b073a5f5 move no k8s.io/kubernetes deps to apiserver 2017-01-13 16:26:58 -05:00
Kubernetes Submit Queue 212234ab3f Merge pull request #39807 from deads2k/client-02-client-go
Automatic merge from submit-queue

run staging client-go update

Chasing to see what real problems we have in staging-client-go.

@sttts you get similar results?
2017-01-13 13:21:19 -08:00
Kubernetes Submit Queue a6fa5c2bfd Merge pull request #39814 from deads2k/api-58-multi-register
Automatic merge from submit-queue

replace global registry in apimachinery with global registry in k8s.io/kubernetes

We'd like to remove all globals, but our immediate problem is that a shared registry between k8s.io/kubernetes and k8s.io/client-go doesn't work.  Since client-go makes a copy, we can actually keep a global registry with other globals in pkg/api for now.

@kubernetes/sig-api-machinery-misc @lavalamp @smarterclayton @sttts
2017-01-13 12:37:02 -08:00
deads2k 633e9d98fc use apimachinery packages instead of client-go packages 2017-01-13 14:04:54 -05:00
deads2k f1176d9c5c mechanical repercussions 2017-01-13 08:27:14 -05:00
Kubernetes Submit Queue 14362160ba Merge pull request #38665 from ymqytw/fix_list_of_primitives
Automatic merge from submit-queue (batch tested with PRs 39834, 38665)

Use parallel list for deleting items from a primitive list with merge strategy

Implemented parallel list for deleting items from a primitive list with merge strategy. Ref: [design doc](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#list-of-primitives)

fixes #35163 and #32398

When using parallel list, we don't need to worry about version skew.
When an old APIServer gets a new patch like:
```yaml
metadata:
  $deleteFromPrimitiveList/finalizers:
  - b
  finalizers:
  - c
```
It won't fail and work as before, because the parallel list will be dropped during json decoding.

Remaining issue: There is no check when creating a set (primitive list with merge strategy). Duplicates may get in.
It happens in two cases:
1) Creation using POST
2) Creating a list that doesn't exist before using PATCH

Fixing the first case is the beyond the scope of this PR.
The second case can be fixed in this PR if we need that.

cc: @pwittrock @kubernetes/kubectl @kubernetes/sig-api-machinery 

```release-note
Fix issue around merging lists of primitives when using PATCH or kubectl apply.
```
2017-01-12 20:03:23 -08:00
ymqytw 9a8ef00888 add unit test 2017-01-12 15:01:38 -08:00
ymqytw a3584f2c34 use parallel list for deleting items in a set 2017-01-12 15:01:16 -08:00
Kubernetes Submit Queue ee49906c45 Merge pull request #39661 from NickrenREN/clientset-redundant-modify
Automatic merge from submit-queue

fix redundant alias clientset

remove redundant alias clientset
2017-01-12 13:29:16 -08:00
NickrenREN ad1f0d30e0 delete ErrorTimeout() function and modify Umask() args
ErrorTimeout is never used
2017-01-12 11:05:30 +08:00
NickrenREN a12dea14e0 fix redundant alias clientset 2017-01-12 10:21:05 +08:00
deads2k c4fae4e690 mechanical repercussions 2017-01-11 15:20:36 -05:00
deads2k 5280c8d3ac moves of genericapiserver packages without dependencies 2017-01-11 15:06:38 -05:00
Michail Kargakis 6013186ac3 Update deployment equality helper 2017-01-11 18:34:12 +01:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue ebf1a533aa Merge pull request #38342 from ymqytw/make_SPatch_delete_all_duplicates
Automatic merge from submit-queue (batch tested with PRs 34488, 39511, 39619, 38342, 39491)

Make StrategicPatch delete all matching maps in a merging list

fixes #38332

```release-note
NONE
```

cc: @lavalamp @pwittrock
2017-01-10 16:07:16 -08:00
Kubernetes Submit Queue 7d2f798052 Merge pull request #39511 from zhouhaibing089/lru-time-ut
Automatic merge from submit-queue (batch tested with PRs 34488, 39511, 39619, 38342, 39491)

use fake clock in lruexpiration cache test

when the system clock is extremely slow(usually see in VMs), this [check](https://github.com/kubernetes/kubernetes/blob/master/pkg/util/cache/lruexpirecache.go#L74) might still return the value.  

```go
if c.clock.Now().After(e.(*cacheEntry).expireTime) {
	go c.remove(key)
	return nil, false
}
```

that means even we set the ttl to be 0 second, the after check might still be false(because the clock is too slow, and thus equals).

the change here helps to reduce flakes.
2017-01-10 16:07:12 -08:00
deads2k e10d4cbd2e tolerate clock change in throttle testing 2017-01-09 14:03:09 -05:00
zhouhaibing089 f12a6c1618 use fake clock in lruexpiration cache test 2017-01-07 13:58:03 +08:00
ymqytw 03081a0003 make StrategicPatch delete all matching maps in a merging list 2017-01-06 15:52:00 -08:00
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Kubernetes Submit Queue 13780bba82 Merge pull request #39433 from deads2k/generic-04-no-dep-01
Automatic merge from submit-queue

move no k8s.io/kubernetes dependencies round 01

Builds on the previous, adds unit testing the staging dir.

moves

 1. pkg/healthz -> apiserver/pkg/healthz
 2. pkg/util/flushwriter -> apiserver/pkg/util/flushwriter
 3. pkg/auth/authenticator -> apiserver/pkg/authentication/authenticator
 4. pkg/auth/authorizer -> apiserver/pkg/authorization/authorizer

@sttts
2017-01-05 10:18:54 -08:00
Kubernetes Submit Queue 4422ddecba Merge pull request #39432 from deads2k/generic-06-strings
Automatic merge from submit-queue

snip pkg/util/strings dependency

The `pkg/util/strings` package looks to be largely used by volumes, which are independent of the bits used by genericapiserver which aren't used by anyone else.  This moves the single function (used no where else) to its point of use.

@sttts
2017-01-05 08:32:38 -08:00
deads2k b813e98a26 move no k8s.io/kubernetes dependencies round one 2017-01-05 11:09:42 -05:00
deads2k 37c0c14215 snip pkg/util/strings dependency 2017-01-05 09:42:42 -05:00
deads2k 1ebe759743 selectively move to client-go packages 2017-01-04 17:49:24 -05:00
Lucas Käldström 733393d800
Add a PrivateKeyFromFile method to certutil for parsing a private key from a file 2017-01-03 23:36:23 +02:00
Jeff Grafton fae627dd65 Update generated for 2017 2017-01-01 23:11:09 -08:00
Mike Danese 161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
Kubernetes Submit Queue 69ddd8eb27 Merge pull request #39247 from wojtek-t/optimize_controller_manager_memory
Automatic merge from submit-queue

Avoid unnecessary memory allocations

Low-hanging fruits in saving memory allocations. During our 5000-node kubemark runs I've see this:

ControllerManager:
- 40.17% k8s.io/kubernetes/pkg/util/system.IsMasterNode
- 19.04% k8s.io/kubernetes/pkg/controller.(*PodControllerRefManager).Classify

Scheduler:
- 42.74% k8s.io/kubernetes/plugin/pkg/scheduler/algrorithm/predicates.(*MaxPDVolumeCountChecker).filterVolumes

This PR is eliminating all of those.
2016-12-28 00:02:59 -08:00
Kubernetes Submit Queue 745928aa43 Merge pull request #39213 from k82cn/k8s_33936_master
Automatic merge from submit-queue (batch tested with PRs 38909, 39213)

Add TLS conf for Go1.7

fixes #33936 / #38596  in master
2016-12-27 16:14:12 -08:00
Wojciech Tyczynski d1292a7397 Optimize memory allocations in controller manager 2016-12-27 16:11:11 +01:00
Wojciech Tyczynski 9a4828821d Retry connection reset by peer 2016-12-27 10:01:42 +01:00
Kubernetes Submit Queue 1ee7163308 Merge pull request #36802 from brendandburns/i18n
Automatic merge from submit-queue

Begin paths for internationalization in kubectl

This is just the first step, purposely simple so we can get the interface correct.

@kubernetes/sig-cli @deads2k
2016-12-24 13:09:12 -08:00