Commit Graph

2484 Commits (4548a07c0e2eb8751b7faf7f47642c3d30010c45)

Author SHA1 Message Date
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
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
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
Kubernetes Submit Queue 24cf4a8b5c Merge pull request #53441 from apelisse/completely-remove-swagger
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>.

kubectl: Remove swagger 1.2 entirely.

**What this PR does / why we need it**:
Remove dead code since nothing is using swagger 1.2 anymore. This doesn't change any feature, it's just removing unused code.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-10-10 20:43:27 -07:00
Kubernetes Submit Queue 23cc4dc50a Merge pull request #52949 from smarterclayton/enable_paging
Automatic merge from submit-queue (batch tested with PRs 52354, 52949, 53551). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Enable API chunking and promote to beta for 1.9

All list watchers default to using chunking.  The server by default fills pages to avoid low cardinality filters from making excessive numbers of requests.  Fix an issue with continuation tokens where a `../` could be used if the feature was enabled.

```release-note
API chunking via the `limit` and `continue` request parameters is promoted to beta in this release.  Client libraries using the Informer or ListWatch types will automatically opt in to chunking.
```
2017-10-10 15:45:29 -07:00
Antoine Pelisse d1ce36371e kubectl: Remove swagger 1.2 entirely. 2017-10-10 14:50:56 -07:00
Kubernetes Submit Queue d6b18a96dd Merge pull request #53611 from p0lyn0mial/pass_scheme_to_admission_plugins
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>.

removes k8s.io/kubernetes/pkg/api dependency from the webhook plugin.

**What this PR does / why we need it**: removes `k8s.io/kubernetes/pkg/api` dependency from `webhook` plugin. The runtime.scheme can be injected to the webhook from the plugin initializer.

**Release note**:

```
NONE
```
2017-10-10 13:53:27 -07:00
Kubernetes Submit Queue 6154a9e16c Merge pull request #53477 from caesarxuchao/genenic-initializer
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>.

Move initializer plugin to the generic apiserver

* Moves `k8s.io/kuberentes/plugin/pkg/admission/initialization` to `k8s.io/apiserver/pkg/admission/plugin/initialization`
* Moves `k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration` to `k8s.io/apiserver/pkg/admission/configuration`
* The initializer plugin used to depend on `k8s.io/kubernetes` because it does a type assertion of `api.Pod`. It tries to skip mirror pod. I converted that code to use the generic accessor pattern.
2017-10-10 09:46:00 -07:00
Michael Taufen 131b419596 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
```
2017-10-10 09:37:51 -07:00
Kubernetes Submit Queue 73d1b38604 Merge pull request #53652 from sttts/sttts-generate-internal-groups.sh-flags
Automatic merge from submit-queue (batch tested with PRs 53525, 53652). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

code-generator: fix flag check in generate-internal-groups.sh
2017-10-10 08:31:44 -07:00
Kubernetes Submit Queue aaf14d4619 Merge pull request #53525 from sttts/sttts-scheme-copier-romoval
Automatic merge from submit-queue (batch tested with PRs 53525, 53652). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

apimachinery: remove ObjectCopier interface(s)

The big commit is a mechanical, transitive removal of the copier interfaces in all structs and function calls.
2017-10-10 08:31:41 -07:00
Clayton Coleman ce0dc76901
Avoid intermediate List allocations as items added to the list
Pick a reasonable middle ground between allocating larger chunks of
memory (2048 * ~500b for pod slices) and having many small allocations
as the list is resized by preallocating capacity based on the expected
list size. At worst, we'll allocate a 1M slice for pods and only add
a single pod to it (if the selector is very specific).
2017-10-10 09:11:45 -04:00
Clayton Coleman 6a76931e2c
Use watch cache when rv=0 even when limit is set 2017-10-10 09:11:44 -04:00
Clayton Coleman ac8808b792
Promote continuation token schema to v1
Change the filtering logic to require a leading path and clean that
afterwards.
2017-10-10 09:11:44 -04:00
Clayton Coleman da7124e5e5
Fill partial pages on the server rather than forcing client to
The etcd3 storage now attempts to fill partial pages to prevent clients
having to make more round trips (latency from server to etcd is lower
than client to server). The server makes repeated requests to etcd of
the current page size, then uses the filter function to eliminate any
matches. After this change the apiserver will always return full pages,
but we leave the language in place that clients must tolerate it.

Reduces tail latency of large filtered lists, such as viewing pods
assigned to a node.
2017-10-10 09:11:44 -04:00
Clayton Coleman 113889e72d
Enable API chunking and promote to beta for 1.9
All list watchers default to using chunking.
2017-10-10 09:11:41 -04:00
Dr. Stefan Schimanski adc14ef935 code-generator: fix flag check in generate-internal-groups.sh 2017-10-10 14:29:48 +02:00
Cao Shufeng a00b8153ca fix generate-groups.sh
This script should run when user pass arguements like this:
generate-groups.sh  deepcopy "k8s.io/coredump-detector/" "k8s.io/coredump-detector/apis/" "coredump:v1alpha1"
2017-10-10 16:10:39 +08:00
Jordan Liggitt 2400185f45
Change --etcd-quorum-read default to true 2017-10-10 00:16:33 -04:00
p0lyn0mial fa96700b76 removes k8s.io/kubernetes/pkg/api dependency from the webhook plugin. 2017-10-09 22:25:03 +02:00
Kubernetes Submit Queue bd9788f8f8 Merge pull request #53567 from maleck13/code-gen-nil-pointer-fix
Automatic merge from submit-queue (batch tested with PRs 53567, 53197, 52944, 49593). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Address code-gen issue 7 nil pointer when incorrect pkg name

**What this PR does / why we need it**:
When using the code-gen tool, if the comments in the ```doc.go``` file has a misspelled pkg name, it ends with a nil pointer. This can be difficult to debug. This PR fixes that by logging an error and continuing. 
https://github.com/kubernetes/code-generator/issues/7

**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**:
I was not sure whether just exiting here would be correct behaviour as reading the code , I noticed in other places it continues if the pkg is nil.
Also perhaps I should use the ```glog.V(5).info```  ?

```release-note
`NONE`
```
2017-10-09 11:18:43 -07:00
Chao Xu bbac32c299 generated 2017-10-09 10:58:12 -07:00
Chao Xu 89a0511fcb move initializer to the generic apiserver
move k8s.io/kubernetes/plugin/pkg/admission/initialization to
k8s.io/apiserver/pkg/admission/plugin/initialization/initialization.go;
move k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration to
k8s.io/apiserver/pkg/admission/configuration.
2017-10-09 10:57:00 -07:00
Kubernetes Submit Queue e339400f6f Merge pull request #52793 from nikhita/crd-validation-conversion-tests
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>.

apiextensions: add round trip tests for CRD schema conversion

Follow up test for https://github.com/kubernetes/kubernetes/pull/52281.

Need to update go-openapi to get this - https://github.com/go-openapi/spec/pull/31 - in.

**Special notes for your reviewer**: The tests won't pass until https://github.com/kubernetes/kubernetes/pull/52281 is merged.

**Release note**:

```release-note
NONE
```

/cc @sttts
2017-10-09 10:22:41 -07:00
craig 962cbcc83e address code-gen issue https://github.com/kubernetes/code-generator/issues/7 2017-10-09 09:41:33 +01:00
Kubernetes Submit Queue 5d8046e482 Merge pull request #53308 from LiliC/remove-func
Automatic merge from submit-queue (batch tested with PRs 50447, 53308). 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/examples: remove unnecessary function

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

The `BuildConfigFromFlags` function already calls the `InClusterConfig` function.

**Special notes for your reviewer**:

If this function was added to bypass [the warning](https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/client_config.go#L529), then maybe we should instead add a comment.

/cc @sttts @nikhita
2017-10-09 00:32:13 -07:00
Dr. Stefan Schimanski ecb65a6a71 Update generated files 2017-10-07 11:28:47 +02:00
Kubernetes Submit Queue f321a16af4 Merge pull request #49654 from jcbsmpsn/move-certificate-manager
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>.

Move certificate manager to client.

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

**What this PR does / why we need it**:
Migrate the certificate_manager to a location where it can be shared.

```release-note
NONE
```
2017-10-06 15:00:07 -07:00
Kubernetes Submit Queue 6ac018af01 Merge pull request #53202 from sttts/sttts-unify-generator-mains
Automatic merge from submit-queue (batch tested with PRs 53434, 53202). 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>.

code-generator: unify generator main funcs and prepare for launching from one binary

- remove "generated by client-gen with custom arguments" message as this does not
  make sense in the times of k8s.io/code-generator
- unify generator main funcs and explicitly call pflag.AddFlags and pflag.Parse. This
  will allow to instantiate the generators also from other places.

Requires https://github.com/kubernetes/gengo/pull/80.

Closes https://github.com/kubernetes/kubernetes/issues/53522.
2017-10-06 11:13:32 -07:00
Dr. Stefan Schimanski 509df603b1 apimachinery: mechanical removal of ObjectCopier plumbing 2017-10-06 19:21:03 +02:00
Lili Cosic 5c70f0a99c apiextensions/examples: remove unnecessary function
BuildConfigFromFlags function already calls the InClusterConfig()
function. The `--master` flag was added to clarify the log warning
message from within the `BuildConfigFromFlags` function.
2017-10-06 19:07:51 +02:00
Dr. Stefan Schimanski ed586da147 apimachinery: remove Scheme.DeepCopy 2017-10-06 14:59:17 +02:00
Dr. Stefan Schimanski 19285b7357 apimachinery: remove Scheme.Copy 2017-10-06 14:24:05 +02:00
Kubernetes Submit Queue 5cc95fbf27 Merge pull request #53417 from crassirostris/audit-defaults
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>.

Adjust defaults of audit webhook backends

This PR:

- increases the default buffer size to contain at lease on the order of magnitude audit events than it's possible to have simultaneous requests (500 AFAIR)
- increase the default batch size. From our load tests .95 size of the log entry is under 2.5KB, therefore 400 entry will sum up to ~1MB request, which sounds reasonable
- increase the initial backoff size. AFAIU, if the initial value is zero, all retries will be used in under 15 seconds (with 0.2 jitter and 1.5 factor), while the backend or a proxy can be unavailable for some reason for 30 seconds and more.
- add throttling to the batching audit webhook

A PR to make these parameters configurable will follow-up

@hzxuzhonghu implemented throttling part of this PR

```release-note
Adjust batching audit webhook default parameters: increase queue size, batch size, and initial backoff.
Add throttling to the batching audit webhook. Default rate limit is 10 QPS.
```

/cc @sttts @tallclair @CaoShuFeng @ericchiang @piosz
2017-10-06 05:03:32 -07:00
Dr. Stefan Schimanski 60a0eb260c Update generated files 2017-10-06 12:36:51 +02:00
Dr. Stefan Schimanski a65232008d client-gen: stratify main.go
Remove double flag parsing and prepare for being instantiated inside a multi-generator process.
2017-10-06 10:48:05 +02:00
Dr. Stefan Schimanski c1062de2ff code-generator: unify generator main.go files 2017-10-06 10:48:05 +02:00
Janet Kuo ad9f9c277f Remove deprecated const from apps/v1beta2 and apps/v1 2017-10-05 15:01:52 -07:00
Janet Kuo fd48a4a895 Autogen 2017-10-05 15:01:52 -07:00
Mik Vyatskov 6bce120a11 Add throttling to the batching audit webhook
Signed-off-by: Mik Vyatskov <vmik@google.com>
2017-10-05 23:19:45 +02:00
Mik Vyatskov 5f4ff9f283 Adjust defaults of audit webhook backends
Signed-off-by: Mik Vyatskov <vmik@google.com>
2017-10-05 23:18:55 +02:00
Jacob Simpson 415c4d2c3a Move certificate manager to client. 2017-10-05 12:54:38 -07:00
Janet Kuo 9813a5278f Add API version apps/v1
Add a new API version apps/v1.
apps/v1 has a copy of apps/v1beta2.DaemonSet API.
2017-10-05 10:43:11 -07:00
Kubernetes Submit Queue b0eb7d884d Merge pull request #53443 from liggitt/psp-allow-escalation
Automatic merge from submit-queue (batch tested with PRs 53454, 53446, 52935, 53443, 52917). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use pointer for PSP allow escalation

Fixes #53437 

The `AllowPrivilegeEscalation` field was added to PodSpec and PodSecurityPolicySpec in 1.8.0.

In order to remain compatible with pre-1.8.0 behavior, PodSecurityPolicy objects created against a previous release must not restrict this field, which means the field must default to true in PodSecurityPolicySpec. However, the field was added as a `bool`, not a `*bool`, which means that no defaulting is possible.

We have two options:
1. Require all pre-existing PodSecurityPolicy objects that intend to allow privileged permissions to update to set this new field to true
2. Change the field to a `*bool` and default it to true.

This PR does the latter. With this change, we have the following behavior:

A 1.8.1+ client/server now has three ways to serialize:
* `nil` values are dropped from serialization (because `omitempty`), which is interpreted correctly by other 1.8.1+ clients/servers, and is interpreted as false by 1.8.0
* `false` values are serialized and interpreted correctly by all clients/servers
* `true` values are serialized and interpreted correctly by all clients/servers

A 1.8.0 client/server has two ways to serialize:
* `false` values are dropped from serialization (because `omitempty`), which is interpreted as `false` by other 1.8.0 clients/servers, but as `nil` (and therefore defaulting to true) by 1.8.1+ clients/servers
* `true` values are serialized and interpreted correctly by all clients/servers

The primary concern is the 1.8.0 server dropping the `false` value from serialization, but I consider the compatibility break with pre-1.8 behavior to be more severe, especially if we can resolve the regression in an immediate point release.

```release-note
PodSecurityPolicy: Fixes a compatibility issue that caused policies that previously allowed privileged pods to start forbidding them, due to an incorrect default value for `allowPrivilegeEscalation`. PodSecurityPolicy objects defined using a 1.8.0 client or server that intended to set `allowPrivilegeEscalation` to `false` must be reapplied after upgrading to 1.8.1.
```
2017-10-05 05:06:30 -07:00
Kubernetes Submit Queue e9a0b157d5 Merge pull request #53345 from ncdc/crd-add-fieldSelector-support
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Support field selectors for CRDs

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>



**What this PR does / why we need it**: allow field selectors to be used with custom resources

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Custom resources served through CustomResourceDefinition now support field selectors for `metadata.name` and `metadata.namespace`.
```
2017-10-04 11:47:43 -07:00