Commit Graph

956 Commits

Author SHA1 Message Date
Kubernetes Publisher
5859689dc3 sync: reset Godeps/Godeps.json 2017-09-06 13:49:15 +00:00
Kubernetes Publisher
bac0212263 Merge pull request #47367 from derekwaynecarr/event-spam
Automatic merge from submit-queue

Add client side event spam filtering

**What this PR does / why we need it**:
Add client side event spam filtering to stop excessive traffic to api-server from internal cluster components.

this pr defines a per source+object event budget of 25 burst with refill of 1 every 5 minutes.

i tested this pr on the following scenarios:

**Scenario 1: Node with 50 crash-looping pods**
```
$ create 50 crash-looping pods on a single node
$ kubectl run bad --image=busybox --replicas=50 --command -- derekisbad
```
Before:
* POST events with peak of 1.7 per second, long-tail: 0.2 per second
* PATCH events with peak of 5 per second, long-tail: 5 per second

After:
* POST events with peak of 1.7 per second, long-tail: 0.2 per second
* PATCH events with peak of 3.6 per second, long-tail: 0.2 per second

Observation:
* https://github.com/kubernetes/kubernetes/pull/47462 capped the number of total events in the long-tail as expected, but did nothing to improve total spam of master.

**Scenario 2: replication controller limited by quota**
```
$ kubectl create quota my-quota --hard=pods=1
$ kubectl run nginx --image=nginx --replicas=50
```
Before:
* POST events not relevant as aggregation worked well here.
* PATCH events with peak and long-tail of 13.6 per second

After:
* POST events not relevant as aggregation worked well here.
* PATCH events with peak: .35 per second, and long-tail of 0

**Which issue this PR fixes**
fixes https://github.com/kubernetes/kubernetes/issues/47366

**Special notes for your reviewer**:
this was a significant problem in a kube 1.5 cluster we are running where events were co-located in a single etcd.  this cluster was normal to have larger numbers of unhealty pods as well as denial by quota.

**Release note**:
```release-note
add support for client-side spam filtering of events
```

Kubernetes-commit: 870406bec5b6e071c3854298bd357629b2939f7c
2017-09-05 13:48:56 +00:00
Derek Carr
170149c11b Add client side event rate limiting
Kubernetes-commit: b62fa1d72855ef1eb02ec2c908b16b7477feb3b1
2017-09-05 13:48:55 +00:00
Sergey Lanzman
302b3649ef Move regexp.MustCompile to global variable
Kubernetes-commit: 34747474659b26456c3615d9f79d014deacf505a
2017-09-04 22:56:06 +03:00
Kubernetes Publisher
a18b27ec1f Merge pull request #51868 from sttts/sttts-fix-client-go-build
Automatic merge from submit-queue (batch tested with PRs 51845, 51868, 51864)

client-go: fix 'go build ./...'

Kubernetes-commit: 0f8febf1b42c0de19b4728a15dea3d06a2b67e34
2017-09-04 13:49:16 +00:00
Kubernetes Publisher
4d791e3272 Merge pull request #51638 from mfojtik/client-gen-custom-methods
Automatic merge from submit-queue (batch tested with PRs 51805, 51725, 50925, 51474, 51638)

Allow custom client verbs to be generated using client-gen

This change will allow to define custom verbs for resources using the following new tag:

```
// +genclient:method=Foo,verb=create,subresource=foo,input=Bar,output=k8s.io/pkg/api.Blah
```

This will generate client method `Foo(bar *Bar) (*api.Blah, error)` (format depends on the particular verb type)

With this change we can add `UpdateScale()` and `GetScale()` into all scalable resources. Note that intention of this PR is not to fix the Scale(), but that is used as an example of this new capability.
Additionally this will also allow us to get rid of `// +genclient:noStatus` and fix guessing of the "updateStatus" subresource presence based on the existence of '.Status' field.
Basically you will have to add following into all types you want to generate `UpdateStatus()` for:

```
// +genclient:method=UpdateStatus,verb=update,subresource=status
```

This allows further extension of the client without writing an expansion (which proved to be pain to maintain and copy...). Also allows to customize native CRUD methods if needed (input/output types).

```release-note
NONE
```

Kubernetes-commit: bee221cca98f1ebf0d46e18d58ecd309bf4f6199
2017-09-04 13:49:16 +00:00
Dr. Stefan Schimanski
bab8392c82 client-go: fix 'go build ./...'
Test-only directories seem to confuse go-build and make it fail. We do this as
a smoke test in the github publishing bot.

Kubernetes-commit: 48cba8a44f94d70cf2ff0ed4fb765c84da8519a6
2017-09-04 13:49:16 +00:00
Michal Fojtik
e748549190 generate UpdateScale and GetScale verbs for scalable resources
Kubernetes-commit: 7d2be1c521dc7f93ae3f83dd123199963598c938
2017-09-04 13:49:16 +00:00
Michal Fojtik
ab00972686 update bazel
Kubernetes-commit: ba731a6ccaaae3ad2c31a6d35df849c00c7f0d4d
2017-09-04 13:49:16 +00:00
Michal Fojtik
bf85a9d89b add missing sub-resources test actions
Kubernetes-commit: c026b62d19d83d4f68235d1bd039a469e87d215d
2017-09-04 13:49:16 +00:00
Kubernetes Publisher
74549f85f4 Merge pull request #50579 from erhudy/bugfix/29271-accept-prefixed-namespaces
Automatic merge from submit-queue

Fixes kubernetes/kubernetes#29271: accept prefixed namespaces

**What this PR does / why we need it**: `kubectl get namespaces -o name` outputs the names of all namespaces, prefixed with `namespaces/`. This changeset allows these namespace names to be passed directly back in to `kubectl` via the `-n` flag without reprocessing them to remove `namespaces/`.

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

**Special notes for your reviewer**:

**Release note**:

```NONE
```

Kubernetes-commit: ab27bc9e6e020fc475b4872a6c049ac7fe91edbb
2017-09-03 08:33:24 -07:00
Edmund Rhudy
d779598b40 Update Bazel configuration for flag.go and overrides_test.go
Kubernetes-commit: 0d0591046c3ea7780600746846e64c2a7abbf1fe
2017-09-04 13:49:15 +00:00
Edmund Rhudy
6316abbfad Add tests for stripping "namespaces/" from passed-in namespace
Kubernetes-commit: 33dff7275da46788ab4126e269a497da9c1c8003
2017-09-04 13:49:15 +00:00
Jordan Liggitt
809288e704 Allow -n namespaces/<ns>
Kubernetes-commit: 666e4be37bab925d0842935bccd3ef849d802608
2017-09-04 13:49:15 +00:00
Kubernetes Publisher
568b669bea sync: update godeps 2017-09-03 13:50:06 +00:00
Kubernetes Publisher
8466173067 Merge pull request #50497 from dixudx/kubectl-include-uninitialized
Automatic merge from submit-queue (batch tested with PRs 51301, 50497, 50112, 48184, 50993)

Introduce new flag "--include-uninitialized" to kubectl

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

Introduce `--include-uninitialized` as a global flag to kubectl

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

**Special notes for your reviewer**:
/assign @caesarxuchao @smarterclayton @ahmetb @deads2k

**Release note**:

```release-note
Add flag "--include-uninitialized" to kubectl annotate, apply, edit-last-applied, delete, describe, edit, get, label, set. "--include-uninitialized=true" makes kubectl commands apply to uninitialized objects, which by default are ignored if the names of the objects are not provided. "--all" also makes kubectl commands apply to uninitialized objects. Please see the [initializer](https://kubernetes.io/docs/admin/extensible-admission-controllers/) doc for more details.
```

Kubernetes-commit: 5c0b265a9bd7213749460ec44da30571adafdb27
2017-09-03 13:49:08 +00:00
Kubernetes Publisher
1213be369b Merge pull request #48921 from smarterclayton/paging_prototype
Automatic merge from submit-queue (batch tested with PRs 50832, 51119, 51636, 48921, 51712)

Alpha list paging implementation

Design in kubernetes/community#896

Support `?limit=NUMBER`, `?continue=CONTINUATIONTOKEN`, and a `continue` field
on ListMeta and pass through to etcd. Perform minor validation as an example.

```
# first out of three
$ curl http://127.0.0.1:8080/api/v1/namespaces?limit=1
{
  "kind": "NamespaceList",
  "apiVersion": "v1",
  "metadata": {
    "selfLink": "/api/v1/namespaces",
    "resourceVersion": "146",
    "next": "ZGVmYXVsdA"
  },
  "items": [
    {
      "metadata": {
        "name": "default",
        "selfLink": "/api/v1/namespaces/default",
        "uid": "f95e1390-6852-11e7-ab03-7831c1b76042",
        "resourceVersion": "4",
        "creationTimestamp": "2017-07-14T05:12:03Z"
      },
      "spec": {
        "finalizers": [
          "kubernetes"
        ]
      },
      "status": {
        "phase": "Active"
      }
    }
  ]
}
...
# last
$ curl "http://127.0.0.1:8080/api/v1/namespaces?limit=1&continue=a3ViZS1wdWJsaWM"
{
  "kind": "NamespaceList",
  "apiVersion": "v1",
  "metadata": {
    "selfLink": "/api/v1/namespaces",
    "resourceVersion": "145"
  },
  "items": [
    {
      "metadata": {
        "name": "kube-system",
        "selfLink": "/api/v1/namespaces/kube-system",
        "uid": "f95e9484-6852-11e7-ab03-7831c1b76042",
        "resourceVersion": "5",
        "creationTimestamp": "2017-07-14T05:12:03Z"
      },
      "spec": {
        "finalizers": [
          "kubernetes"
        ]
      },
      "status": {
        "phase": "Active"
      }
    }
  ]
}
```

Kubernetes-commit: 35ffb5c6cf70974c0a571cd1ebdc72ad8d0f8332
2017-09-03 13:49:08 +00:00
Di Xu
994192e4fe kubectl add global flag --include-uninitialized
Kubernetes-commit: 789a95971d46589fd8dd7cd4fa8ac8903189b961
2017-09-03 13:49:08 +00:00
Kubernetes Publisher
48ade6dd30 Merge pull request #51130 from luxas/fake_discovery
Automatic merge from submit-queue (batch tested with PRs 51335, 51364, 51130, 48075, 50920)

Add the possibility to set return values for the FakeDiscovery implementation

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

As an user of the fake clientset (with the fake discovery), I want to be able to set the fake server's version on demand like this for example:

```go
func TestFakingServerVersion(t *testing.T) {
	client := fakeclientset.NewSimpleClientset()
	fakeDiscovery, ok := client.Discovery().(*fakediscovery.FakeDiscovery)
	if !ok {
		t.Fatalf("couldn't convert Discovery() to *FakeDiscovery")
	}

	testGitCommit := "v1.0.0"
	fakeDiscovery.FakedServerVersion = &version.Info{
		GitCommit: testGitCommit,
	}

	sv, err := client.Discovery().ServerVersion()
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}
	if sv.GitCommit != testGitCommit {
		t.Fatalf("unexpected faked discovery return value: %q", sv.GitCommit)
	}
}
```

This PR makes that possible, in wait for a more sophisticated FakeDiscovery implementation generally.

**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
```
@kubernetes/sig-api-machinery-pr-reviews

Kubernetes-commit: 94d9457e4e4786b735c5be1224f831c6010691b5
2017-09-03 13:49:07 +00:00
Clayton Coleman
6adf847055 Server side implementation of paging for etcd3
Add a feature gate in the apiserver to control whether paging can be
used. Add controls to the storage factory that allow it to be disabled
per resource. Use a JSON encoded continuation token that can be
versioned. Create a 410 error if the continuation token is expired.

Adds GetContinue() to ListMeta.

Kubernetes-commit: 8952a0cb722b77459cf2701632a30f5b264f5aba
2017-09-03 13:49:07 +00:00
Kubernetes Publisher
2074f53993 Merge pull request #48051 from xilabao/add-selfsubjectrulesreview-api
Automatic merge from submit-queue (batch tested with PRs 45724, 48051, 46444, 51056, 51605)

Add selfsubjectrulesreview in authorization

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

**Which issue this PR fixes**: fixes #47834 #31292

**Special notes for your reviewer**:

**Release note**:

```release-note
Add selfsubjectrulesreview API for allowing users to query which permissions they have in a given namespace.
```
/cc @deads2k @liggitt

Kubernetes-commit: c84b3132a2f1c784447ed6f405be9fe9a601d423
2017-09-03 13:49:07 +00:00
Lucas Käldström
0c6cc8dd98 autogenerated code
Kubernetes-commit: e1cff67aa608723005eabf2e70333d14f6d40586
2017-09-03 13:49:07 +00:00
Clayton Coleman
2b76a1826e Enable paging for all list watchers
Kubernetes-commit: 500b130ff0a2c744b21cfb8e6d09e94b707dec61
2017-09-03 13:49:07 +00:00
Lucas Käldström
78f8f273df Make it possible to fake the ServerVersion in the FakeDiscovery implementation
Kubernetes-commit: 9b060faa2aaa262104a52c57d08ec67dc60949d9
2017-09-03 13:49:07 +00:00
Clayton Coleman
7b48f37a96 Add a new paging utility for client side ranging
Kubernetes-commit: fb68d1d3a7bfb69f3884db6d360816fb2e7eda1e
2017-09-03 13:49:07 +00:00
xilabao
daf8ef60c5 create the methods in the generated expansion files
Kubernetes-commit: 790374da10d3a59899ae832c24a73349b802f72b
2017-09-03 13:49:06 +00:00
Chen Rong
35d425a0d9 generated
Kubernetes-commit: ed8adf6e51d76b3652be3b433b2dab590f1ff1f0
2017-09-03 13:49:06 +00:00
Kubernetes Publisher
f95030429f Merge pull request #48287 from thockin/json-iterator
Automatic merge from submit-queue

Use json-iterator instead of ugorji for JSON.

@smarterclayton @wojtek-t

Fixes #36120
xref #18762

```release-note
Switch JSON marshal/unmarshal to json-iterator library.  Performance should be close to previous with no generated code.
```

Kubernetes-commit: 6a845c67f097cd76f9d90ab3c9c5b5603c70afe4
2017-09-01 16:20:06 +00:00
Tim Hockin
462d9adec6 Remove generated JSON code
Kubernetes-commit: 9e2fccd1de5384a6ecadf54849f612a10ecfe93a
2017-09-01 16:19:32 +00:00
Kubernetes Publisher
8fd8317e74 sync: reset Godeps/Godeps.json 2017-09-01 16:19:32 +00:00
Kubernetes Publisher
1d8640158d Merge pull request #51381 from mengqiy/debug_kubectl_get_cm
Automatic merge from submit-queue (batch tested with PRs 50719, 51216, 50212, 51408, 51381)

Surface reasonable error when connection closed

Try to detect connection closure when API server closed the connection due to timeout.
Surface reasonable error when connection closed.

Further improvement may be retrying when detect connection closure

related to #51353

```release-note
Surface reasonable error when client detects connection closed.
```

/assign @mml @caesarxuchao

Kubernetes-commit: 1a3a0713b218566be951fabd5d87184c2e240329
2017-08-31 21:09:19 -07:00
Kubernetes Publisher
00f65f7d44 Merge pull request #50404 from apelisse/http-cache
Automatic merge from submit-queue (batch tested with PRs 51480, 49616, 50123, 50846, 50404)

Kubectl to use http caching to cache openapi responses from the server

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

This PR is trying to address the problems raised in #50254

> * uses a disk-based cache that is not safe between processes (does not use atomic fs operations)
> * writes get/list responses to disk that should not be cached (like kubectl get secrets)
> * is vulnerable to partially written cache responses being used as responses to future requests
> * breaks uses of the client transport that make use of websockets
> * defaults to enabling the cache for any client builder using RecommendedConfigOverrideFlags or DefaultClientConfig which affects more components than just kubectl

All of these points are addressed by this pull-request:
1. It now uses atomic fs operations
2. Doesn't cache by default, only if requested by the client (and it's only done by openapi client)
3. Fixed because of atomic fs operations
4. Found the reason for the bug: Cache wrapper couldn't be unwrapped. I implemented the `WrappedRoundTripper` interface.
5. Since 2. is fixed, I think that should be fine

@smarterclayton @liggitt

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Allows kubectl to use http caching mechanism for the OpenAPI schema. The cache directory can be configured through `--cache-dir` command line flag to kubectl. If set to empty string, caching will be disabled.
```

Kubernetes-commit: 0f2c2bd847ca7a66035b2289e83359ef4c923617
2017-09-01 16:19:32 +00:00
ymqytw
f62736c05e return reasonable error when connection closed
Kubernetes-commit: 4de18dec2ba284657c89f7b6e1074385dc1d1baf
2017-09-01 16:19:32 +00:00
Antoine Pelisse
2ed3ee4524 client-go cache: Make caching layer Unwrappable
Kubernetes-commit: a804d440c3dfab8820c7f2d231dcaecb201be7b5
2017-09-01 16:19:00 +00:00
Antoine Pelisse
0b7513368a c-go cache: Use diskv TempDir to get atomic write
Kubernetes-commit: e58da7bb7c1800ffd4f24cf77c2e3f3cdfcdf906
2017-09-01 16:19:00 +00:00
Antoine Pelisse
1429110930 c-go cache: Only cache discovery requests
Only cache discovery requests, and only for kubectl.

Kubernetes-commit: a97a1ba14e06ce9dadf0d1e8ea35083842678576
2017-09-01 16:19:00 +00:00
Antoine Pelisse
e3b9d1a520 c-go: Update diskv to get atomic fs cache write
Kubernetes-commit: 30325cd580af08e13a0ebc89252842eb955fd94e
2017-09-01 16:19:00 +00:00
Antoine Pelisse
928f5804e3 Revert "Revert "Merge pull request #47353 from apelisse/http-cache""
This reverts commit 4ee72eb300423772020dd1cf208159058ba7dab5.

Kubernetes-commit: 332b681bd1d961e2cee16bca10784088a8d308f1
2017-09-01 16:19:00 +00:00
Kubernetes Publisher
1ceb9f71e1 sync: reset Godeps/Godeps.json 2017-09-01 16:19:00 +00:00
Kubernetes Publisher
17da6b01b2 Merge pull request #50775 from apelisse/fail-gke-failing-test
Automatic merge from submit-queue

client-go: Make conditionalTransport a WrapperRoundTripper

**What this PR does / why we need it**:
Fixes broken GKE test: https://k8s-gubernator.appspot.com/builds/kubernetes-jenkins/logs/ci-kubernetes-e2e-gke/

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

Kubernetes-commit: a9cceacdaea72d505d8827521f70123c8c2bbd73
2017-09-01 16:18:59 +00:00
Antoine Pelisse
fc47db2e7e client-go: Update RoundTrippers to be Unwrappable
Kubernetes-commit: fd5775c192fb4d47250a2d99f3e022acb1c7c0f0
2017-09-01 16:18:59 +00:00
wackxu
d31224ad22 add verify case in index_test.go
Kubernetes-commit: 4ab3f4500164d9a15628c4646810f67b37e57023
2017-09-01 10:03:08 +08:00
Kubernetes Publisher
db8228460e Merge pull request #51467 from liggitt/client-go-owner
Automatic merge from submit-queue

Add liggitt to client-go approvers

/assign @lavalamp
/assign @deads2k

Kubernetes-commit: a64eeb47f6ed4aa2587113793a76878b876809f9
2017-08-29 12:54:04 +00:00
Kubernetes Publisher
2554b0b462 Merge pull request #50562 from atlassian/call-cleanup-properly
Automatic merge from submit-queue (batch tested with PRs 51134, 51122, 50562, 50971, 51327)

Call the right cleanup function

**What this PR does / why we need it**:
`defer cleanup()` will always call the function that was returned by the first call to `r.resyncChan()` but it should call the one returned by the last call.

**Special notes for your reviewer**:
This will print `c1`, not `c2`. See https://play.golang.org/p/FDjDbUxOvI
```go
func main() {
	var c func()
	c = c1
	defer c()
	c = c2
}

func c1 () {
	fmt.Println("c1")
}

func c2 () {
	fmt.Println("c2")
}
```

**Release note**:
```release-note
NONE
```
/kind bug
/sig api-machinery

Kubernetes-commit: ccae631ff9d82e302631fc7f1965a09c4e1e9f56
2017-08-29 12:54:04 +00:00
Jordan Liggitt
83f7b229ea Add liggitt to client-go approvers
Kubernetes-commit: 838d8a72740ba8f85103bb9dc352f6c8588a977e
2017-08-29 12:54:04 +00:00
Kubernetes Publisher
e1798d5fa2 Merge pull request #51154 from RenaudWasTaken/gRPC-updated-1-3-0
Automatic merge from submit-queue (batch tested with PRs 51193, 51154, 42689, 51189, 51200)

Bumped gRPC version to 1.3.0

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

This PR bumps down the version of the vendored version of gRPC from v1.5.1 to v1.3.0
This is needed as part of the Device Plugin API where we expect client and server to use the Keep alive feature in order to detect an error.

Unfortunately I had to also bump the version of `golang.org/x/text` and `golang.org/x/net`.

- Design document: kubernetes/community#695
- PR tracking: [kubernetes/features#368](https://github.com/kubernetes/features/issues/368#issuecomment-321625420)

**Which issue this PR fixes**: fixes #51099
Which was caused by my previous PR updating to 1.5.1

**Special notes for your reviewer**:
@vishh @jiayingz @shyamjvs

**Release note**:
```
Bumped gRPC to v1.3.0
```

Kubernetes-commit: 5fb38a325efb343c2a0467a12732829bd5ed3c3c
2017-08-29 12:54:04 +00:00
Mikhail Mazurskiy
174c4c21d7 Call the right cleanup function
Kubernetes-commit: 1ab88c94e8e3b9ccfe16b2b0dbf26f688be1d4df
2017-08-29 12:54:04 +00:00
Kubernetes Publisher
8797b732d6 Merge pull request #51109 from kubernetes/revert-50531-gRPC-keep-alive-godeps
Automatic merge from submit-queue

Revert "Updated gRPC vendoring to support Keep Alive"

Reverts kubernetes/kubernetes#50531

Ref - https://github.com/kubernetes/kubernetes/issues/51099

/cc @wojtek-t @RenaudWasTaken

Kubernetes-commit: b0ad3a1c5d56c9129ea389fe7456dfe75be4ce72
2017-08-29 12:53:33 +00:00
Renaud Gaubert
4df9860776 Bumped gRPC version to 1.3.0
Kubernetes-commit: 1daaeb352f87399a4967b7ad72228e84a32f1e90
2017-08-29 12:53:33 +00:00
Kubernetes Publisher
ee3e658398 sync: reset Godeps/Godeps.json 2017-08-29 12:53:33 +00:00