Commit Graph

2532 Commits (951d2c060e0fa173f82bc221e388f9491709c52c)

Author SHA1 Message Date
Kubernetes Submit Queue 6997d6c062 Merge pull request #54167 from deads2k/server-03-splitfiles
Automatic merge from submit-queue (batch tested with PRs 54167, 54182). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

split up large rest handling file

These are nothing but exact block moves because the giant rest.go made it really hard to find anything.

@kubernetes/sig-api-machinery-pr-reviews 

/assign sttts
/assign caesarxuchao
2017-10-18 18:21:20 -07:00
Kubernetes Submit Queue 7f26f03b68 Merge pull request #54158 from nikhita/crd-lastTransitionTime
Automatic merge from submit-queue (batch tested with PRs 49305, 54158). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

apiextensions: fix LastTransitionTime for NamesAccepted condition

Fixes #54148. 

Without this change, `LastTransitionTime` for the NamesAccepted condition for CRDs always showed up as `null`.

**Release note**:

```release-note
NONE
```
2017-10-18 16:35:19 -07:00
Kubernetes Submit Queue aaec4e20e8 Merge pull request #53164 from enisoc/rc-rs-conversion
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix RC/RS conversion

This fixes some round-trip information loss when representing an RC as an RS. I want to use these conversions in #49429 to eliminate the maintenance burden of duplicated RC code.

@kubernetes/sig-apps-pr-reviews
2017-10-18 15:42:10 -07:00
Kubernetes Submit Queue 900c0761e3 Merge pull request #53722 from deads2k/rbac-01-allow-star
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

allow */subresource in rbac policy rules

xref #29698
xref #38756
xref #49504
xref #38810

Allow `*/subresource` format in RBAC policy rules to support polymorphic subresources like `*/scale` for HPA.

@DirectXMan12 fyi

```release-note
RBAC PolicyRules now allow resource=`*/<subresource>` to cover `any-resource/<subresource>`.   For example, `*/scale` covers `replicationcontroller/scale`.
```
2017-10-18 14:02:05 -07:00
David Eads cd663d7ad0 split up large rest handling file 2017-10-18 16:12:14 -04:00
Anthony Yeh c1377383bb
Add fuzz test for RC/RS conversion. 2017-10-18 12:37:30 -07:00
Nikhita Raghunath 1161561ee1 Fix LastTransitionTime for NamesAccepted condition
Without this change, `LastTransitionTime` for the NamesAccepted
condition always showed up as `null`.

It makes sense to set the timestamp in `SetCRDCondition` instead of
setting it explicitly elsewhere.
2017-10-19 00:39:32 +05:30
Anthony Yeh f290819f75
Fix loss of selector during RC/RS conversion.
The `out` parameter in Convert_map_to_unversioned_LabelSelector was
being ignored.
2017-10-18 11:46:31 -07:00
Kubernetes Submit Queue 14a1a15485 Merge pull request #53947 from crassirostris/retry-webhook-net-errors
Automatic merge from submit-queue (batch tested with PRs 53958, 53947). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Always retry connection reset error in webhook

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

Audit logging uses webhook to send events to the backend and currently even a little blip in networking can cause several hundreds of events to be lost. This PR adds an additional check, that is similar to [the one in the rest package](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/request.go#L657), but ignores the fact that the request is not GET and always retries "Connection reset by peers" error.

```release-note
Webhook always retries connection reset error.
```
2017-10-18 06:44:03 -07:00
Kubernetes Submit Queue a1e786f138 Merge pull request #54059 from porridge/fix-lint-err
Automatic merge from submit-queue (batch tested with PRs 53696, 54059). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix lint warnings for useless err checks.

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

This check was recently added to golint.

**Which issue this PR fixes**

Related to #37254

**Release note**:
```release-note
NONE
```
2017-10-18 00:58:59 -07:00
Nikhita Raghunath adc34fa56e staging README: update code-generator to published
The code-generator repository has been published long back.
2017-10-17 20:54:35 +05:30
Kubernetes Submit Queue d91e97f243 Merge pull request #53037 from smarterclayton/verify_client_cert
Automatic merge from submit-queue (batch tested with PRs 53978, 54008, 53037). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Verify the bootstrap client cert before using it
2017-10-17 04:53:42 -07:00
Marcin Owsiany 49553d4a7a Fix lint warnings for useless err checks.
This check was recently added to golint.
2017-10-17 12:52:54 +02:00
Kubernetes Submit Queue 1d8f1e268f Merge pull request #47699 from supereagle/fix-typos
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix typos: remove duplicated word in comments

**What this PR does / why we need it**: Remove the duplicated word `the` in comments

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

**Special notes for your reviewer**:

```release-note
NONE
```
2017-10-17 02:35:52 -07:00
Kubernetes Submit Queue 7d59b2d338 Merge pull request #53575 from dahefanteng/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove repeated type conversion

**What this PR does / why we need it**:
remove repeated type conversion(convert String to Feature)
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
we just need make this conversion once.
**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-16 19:25:13 -07:00
David Eads e8a703b651 allow */subresource in rbac policy rules 2017-10-16 16:17:51 -04:00
David Eads 5a709021ab start generating rbac serialization for v1 2017-10-16 16:15:17 -04:00
Kubernetes Submit Queue 35a105af9f Merge pull request #53966 from fabiand/sampleApiserverNsManifest
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add sample-apiserver namespace manifest

**What this PR does / why we need it**:
Adds a manifest to also create the required namespace for the api server example.

It was previously proposed here kubernetes/sample-apiserver#11

```release-note
```
2017-10-16 08:27:56 -07:00
Kubernetes Submit Queue 1a80501fab Merge pull request #53862 from jianglingxia/jlx-quantity
Automatic merge from submit-queue (batch tested with PRs 53862, 53974). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

unused para useInfDec  in quantity_test

**What this PR does / why we need it**:
the para useInfDec  unused and some comment error,so fix 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
NONE
```
2017-10-16 07:35:28 -07:00
Clayton Coleman 5649f9a578 Move pkg/kubelet/util/csr into client-go
Everything else it depends on was already there, and now we have a
somewhat consistent code chain.
2017-10-16 16:05:48 +02:00
Clayton Coleman b3a11aa635
Have the certificate manager decide if the server is healthy
Prevent a Kubelet from shutting down when the server isn't responding to
us but we cannot get a new certificate. This allows a cluster to coast
if the master is unresponsive or a node is partitioned and their client
cert expires.
2017-10-16 14:27:03 +02:00
Clayton Coleman cbecf17727
cache.ListWatchUntil should return err.ErrWaitTimeout
Clients shouldn't have to know about watch.ErrWatchClosed, which is
typically a server side decision to close and always means "Timeout" in
this conetxt.
2017-10-16 14:27:03 +02:00
Clayton Coleman c3bea24ab6
Collapse duplicate code into pkg/util/csr
There is no reason to duplicate this code into two places.
2017-10-16 14:27:03 +02:00
Mik Vyatskov 59bacba056 Always retry network connection error in webhook
Signed-off-by: Mik Vyatskov <vmik@google.com>
2017-10-16 12:26:14 +02:00
Fabian Deutsch 14c347f931
Add sample-apiserver namespace manifest 2017-10-16 11:57:10 +02:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Kubernetes Submit Queue a523084d88 Merge pull request #52762 from jinzhejz/jinzhejz_typo
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix typo in quantity.go

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

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

**Release note**:
```release-note
None
```
2017-10-13 11:38:16 -07:00
Kubernetes Submit Queue 8cbc9d7e27 Merge pull request #53830 from juanvallejo/jvallejo/prevent-delta-fifo-store-panic
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

perform nil check before iterating over keys

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

Fixes panic due to nil pointer dereference 

Related downstream bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1377940
cc @smarterclayton
2017-10-13 09:43:13 -07:00
Kubernetes Submit Queue f1d9962fec Merge pull request #53720 from shyamjvs/test-kubemark
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Optimize random string generator to avoid multiple locks & use bit-masking

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

We recently started seeing a 50% decrease in scheduling throughput (for e.g in kubemark-500 scale job) and turns out https://github.com/kubernetes/kubernetes/pull/53135 introduced it.
The reason is [this call](2caae38d32/plugin/pkg/scheduler/algorithm/predicates/predicates.go (L272)) to create a random 32-length string.
From the code of the `rand` utility (which is being heavily used throughout the system for randomizing object names), I noticed following performance issues:
- to create an n-length string, we are making n calls to `rand.Intn()` each of which does a lock+unlock operation on the RNG.. while just 1 lock+unlock operation is enough for all
- we're choosing one character (from an alphabet of 27 chars) per each random integer.. while we can select 10 characters using a single int63 (by masking and bit-shifting) as 1 character uses just 5 bits of randomness
- the character set is defined as a global slice (mutable), so the compiler needs to fetch length of the slice on each invocation to `len()` (we're making n of those).. while we can just use a const string (immutable) which will make len directly available as a cached constant (yes, go does it!)

This PR is making the above fixes. I'll try to add some benchmarking to measure the difference (as @wojtek-t suggested).

/cc @kubernetes/sig-scalability-misc @kubernetes/sig-scheduling-bugs @kubernetes/sig-api-machinery-misc @wojtek-t @smarterclayton
2017-10-13 06:11:09 -07:00
Kubernetes Submit Queue cc49b34d29 Merge pull request #53586 from sttts/sttts-storage-shutdown
Automatic merge from submit-queue (batch tested with PRs 53249, 53586). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

apiextensions-apiserver: stop cacher on CRD update

Potentially fixes #53485
2017-10-13 05:09:43 -07:00
Kubernetes Submit Queue fd57b1c002 Merge pull request #53249 from hzxuzhonghu/envelop-encrypt
Automatic merge from submit-queue (batch tested with PRs 53249, 53586). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

rename encryptionconfig_test.go and remove unused filed in envelopeTransformer

**What this PR does / why we need it**:
useless field `cacheSize` and rename test file match original `config.go`.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-13 05:09:40 -07:00
Shyam Jeedigunta 0185e55889 Add benchmark for random string generation utility 2017-10-13 13:22:10 +02:00
Dr. Stefan Schimanski 333f49f5d1 apiextensions: fix test loop for CRD validation 2017-10-13 12:17:02 +02:00
Dr. Stefan Schimanski e23983189d apiextensions: keep CRD storage for updates outside of spec and accepted names 2017-10-13 12:14:09 +02:00
Kubernetes Submit Queue 7c75723867 Merge pull request #52383 from dixudx/quote_field_valid_string
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

quote valid strings for field validation

**What this PR does / why we need it**:
Some of the declared const vars are empty string `""`, such as

* [`NamespaceAll`, `NamespaceNone`](https://github.com/kubernetes/kubernetes/blob/master/pkg/api/types.go#L197-L200)
* [`HostPathUnset`](https://github.com/kubernetes/kubernetes/blob/master/pkg/api/types.go#L631)

When validating such supported fields, empty string will be printed without quotes, which is kind of ugly.

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

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

**Release note**:

```release-note
None
```
2017-10-12 20:25:10 -07:00
jianglingxia bad417b91e unused para in quantity_test 2017-10-13 11:03:33 +08:00
Kubernetes Submit Queue fe3b68ecc6 Merge pull request #53762 from smarterclayton/reflect_diff
Automatic merge from submit-queue (batch tested with PRs 53749, 53642, 53813, 53771, 53762). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Don't exit early in diff.ObjectReflectDiff on slices
2017-10-12 18:22:43 -07:00
Di Xu 7508afedd3 quote valid strings for field validation 2017-10-13 07:52:16 +08:00
Kubernetes Submit Queue 45fd545366 Merge pull request #53756 from ericchiang/webhook-timeout
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

generic webhook: set a default timeout for webhook requests

Add a 30 second timeout for all HTTP requests that the webhook sends
so they timeout instead of hanging forever.

closes https://github.com/kubernetes/kubernetes/issues/53698

cc @kubernetes/sig-api-machinery-pr-reviews 

```release-note
NONE
```
2017-10-12 13:52:08 -07:00
juanvallejo 1fcd410d4a
perform nil check before iterating over keys 2017-10-12 16:25:31 -04:00
Shyam Jeedigunta c279a53ca0 Optimize random string generator to avoid multiple locks & use bitmasking 2017-10-12 19:13:17 +02:00
Kubernetes Submit Queue 6901fc37d1 Merge pull request #52981 from CaoShuFeng/audit_v1beta2
Automatic merge from submit-queue (batch tested with PRs 53119, 53753, 53795, 52981). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add RequestReceivedTimestamp and StageTimestamp to audit event

fixes https://github.com/kubernetes/kubernetes/issues/52160

**Release note**:
```
Add RequestReceivedTimestamp and StageTimestamp with micro seconds to audit events.
```
2017-10-12 08:28:44 -07:00
xiangpengzhao 2a454dcea0 Mark etcd-quorum-read as deprecated. 2017-10-12 20:00:56 +08:00
Cao Shufeng b69285af7f run hack/update-all.sh 2017-10-12 11:29:41 +08:00
Cao Shufeng 817bc6954c support micro time for advanced audit 2017-10-12 11:29:36 +08:00
Clayton Coleman 178baa9ac3
Don't exit early in diff.ObjectReflectDiff on slices
We were exiting at the first mismatched index, but we want to collect
the diffs for all children. Also, we were assuming diffs existed which
was not always true (and was due to other bugs that we weren't catching
before).
2017-10-11 22:53:25 -04:00
Eric Chiang 2de3ee5c48 generic webhook: set a default timeout for webhook requests
Add a 30 second timeout for all HTTP requests that the webhook sends
so they timeout instead of hanging forever.
2017-10-11 19:07:23 -07:00
Kubernetes Submit Queue 42d22aea9f Merge pull request #53717 from liggitt/quorum
Automatic merge from submit-queue (batch tested with PRs 51677, 53690, 53025, 53717, 53664). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Change --etcd-quorum-read default to true

The tested configurations for HA etcd use quorum reads. Defaulting this off causes potential correctness issues in controllers that do live lookups when processing their work queue. Given that, we should default this on.

Quorum reads are far more performant on etcd3 than they were on etcd2

xref
https://github.com/kubernetes/kubernetes/pull/53662#discussion_r143806500
https://github.com/kubernetes/kubernetes/issues/19902
https://github.com/kubernetes/kubernetes/issues/48865

```release-note
apiserver: --etcd-quorum-read now defaults to true, to ensure correct operation with HA etcd clusters
```
2017-10-11 09:35:32 -07:00
Kubernetes Submit Queue df072ca97e Merge pull request #53025 from mtaufen/feature-gate-map
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make feature gates loadable from a map[string]bool

Command line flag API remains the same. This allows ComponentConfig             
structures (e.g. KubeletConfiguration) to express the map structure             
behind feature gates in a natural way when written as JSON or YAML.             
                                                                                
For example:                                                                    
                                                                                
KubeletConfiguration Before:
```
apiVersion: kubeletconfig/v1alpha1
kind: KubeletConfiguration
featureGates: "DynamicKubeletConfig=true,Accelerators=true"
```

KubeletConfiguration After:
```
apiVersion: kubeletconfig/v1alpha1
kind: KubeletConfiguration
featureGates:
  DynamicKubeletConfig: true
  Accelerators: true
```

Fixes: #53024

```release-note
The Kubelet's feature gates are now specified as a map when provided via a JSON or YAML KubeletConfiguration, rather than as a string of key-value pairs.
```

/cc @mikedanese @jlowdermilk @smarterclayton
2017-10-11 09:05:33 -07:00
Dr. Stefan Schimanski b125388767 apiextensions: create storage with accepted, not spec'ed names 2017-10-11 12:20:31 +02:00