Commit Graph

575 Commits (3215e8535ae8afcf850fbaac9df7ff9abe42f9e0)

Author SHA1 Message Date
deads2k 48ac4d549d change e2e scale to avoid adapter 2016-09-26 07:58:01 -04:00
Clayton Coleman 07f079216e
Make clientcmd defaulting a function of ConfigOverrides and LoadingRules
This commit moves away from using a global variable for default
configuration checking, and instead exposes a method on LoadingRules to
determine whether a particular restclient.Config should be considered
"default". This allows kubectl to provide its own defaults (the same
as before, KUBERNETES_MASTER and the static localhost:8080 values) while
allowing other clients to avoid defining them.

In-cluster config defaulting is now easier to read.
2016-09-21 01:28:06 -04:00
Kubernetes Submit Queue 87b40782c9 Merge pull request #31150 from ncdc/handle-init-container-terminated-pod-running-condition
Automatic merge from submit-queue

Check init containers in PodContainerRunning

Sometimes when an init container runs and terminates quickly, PodContainerRunning can go into a
state where the pod indicates it's still running, but the container is already terminated. Handle
that condition by returning ErrContainerTerminated when it happens.

See also #29952

@smarterclayton @fabianofranz
2016-09-19 05:43:21 -07:00
Kubernetes Submit Queue 9aca785bc8 Merge pull request #32613 from madhusudancs/fed-clientcmd-bug-31947-fix
Automatic merge from submit-queue

Fix clientcmd for a non-host cluster client running in a pod. 

This is based on @errordeveloper's PR #32438. It fixes a case where default config is invalid and original config, i.e. `mergedConfig` is empty. It also adds a test for the case where default config is invalid and original config is neither invalid nor empty.

cc @errordeveloper @kubernetes/sig-cluster-federation @pwittrock @colhom
2016-09-14 13:10:27 -07:00
Madhusudan.C.S c4acaa6717 Add a test to verify that the client config is returned when default config is invalid. 2016-09-13 15:34:56 -07:00
Madhusudan.C.S 0433fe0d72 Do not return original config, i.e. mergeConfig, when it is empty and default config is invalid. 2016-09-13 15:33:51 -07:00
Kubernetes Submit Queue ac8aae584d Merge pull request #32393 from smarterclayton/incluster_namespace
Automatic merge from submit-queue

Allow namespace to be loaded from in-cluster config

This is a follow on from the previous commit that fixed ClientConfig.
Namespace can also be defaulted from ICC, and this correctly handles
that logic. Also add two debugging lines to ensure that it is easier in
the future to uncover problems here.

Fixes #32352

@deads2k
2016-09-13 04:02:21 -07:00
deads2k f756e43e7f convert rolling updater to generated client 2016-09-12 07:38:34 -04:00
Kubernetes Submit Queue 60b63b7cda Merge pull request #31767 from asalkeld/bad-context-error
Automatic merge from submit-queue

Add a check in ConfirmUsable() to validate the contextName

**What this PR does / why we need it**:
When a context name is provided, but can't be found (miss spelling), it currently
uses the defaults. This PR will cause the command to fail, to prevent unexpected side effects
of using the wrong configuration.

**Which issue this PR fixes**
fixes #21062

**Special notes for your reviewer**:
None

**Release note**:
```release-note
Error if a contextName is provided but not found in the kubeconfig.
```
2016-09-11 02:00:34 -07:00
Kubernetes Submit Queue bc835c608a Merge pull request #31586 from brendandburns/kubectl
Automatic merge from submit-queue

When prompting for passwords, don't echo to the terminal

@deads2k 
@kubernetes/kubectl
2016-09-10 13:58:13 -07:00
Wojciech Tyczynski e240aff741 Revert "Use scale subresource" 2016-09-10 18:35:07 +02:00
Kubernetes Submit Queue a5d6bf4095 Merge pull request #31111 from fraenkel/scale_subresource
Automatic merge from submit-queue

Use scale subresource

Fixes #29698

Use scale subresource for ReplicationController, ReplicaSet and Deployment.
Couldn't do Jobs and PetSet since they live in a different group.
2016-09-10 06:26:25 -07:00
Kubernetes Submit Queue c7d1e38412 Merge pull request #30963 from plutov/master
Automatic merge from submit-queue

Example of unversioned pkg uses correct Config struct

Currently this Doc has incorrect example - https://godoc.org/k8s.io/kubernetes/pkg/client/unversioned

So when developers use it they are confused why `client` pkg has no `Config` struct, actually this is a struct from `restclient` pkg.

Also pkg name and variable name should be equal:
`client, err := client.New(config)`

Thanks,
Alex
2016-09-10 04:27:05 -07:00
Ilya Dmitrichenko a96bd93c0f Check if default config is invalid before comparing it
Changes made in #31947 cause kube-proxy to ignore `--kubeconfig`
and `--master` flags and use in-cluster configuration, which is
unusable due to the fact that VIP hasn't been created yet.
2016-09-10 09:37:41 +02:00
Clayton Coleman d1d20e5340
Allow namespace to be loaded from in-cluster config
This is a follow on from the previous commit that fixed ClientConfig.
Namespace can also be defaulted from ICC, and this correctly handles
that logic. Also add two debugging lines to ensure that it is easier in
the future to uncover problems here.
2016-09-09 17:38:24 -04:00
Kubernetes Submit Queue 7c27a2686f Merge pull request #31688 from mehdy/master
Automatic merge from submit-queue

updated client document
2016-09-07 16:25:24 -07:00
Kubernetes Submit Queue 54db8fa2e3 Merge pull request #31886 from deads2k/move-storage-class
Automatic merge from submit-queue

Move StorageClass to a storage group

We discussed the pros and cons in sig-api-machinery yesterday.  Choosing a particular group name means that clients (including our internal code) require less work and re-swizzling to handle promotions between versions.  Even if you choose a group you end up not liking, the amount of work remains the same as the incubator work case: you move the affected kind, resource, and storage.

This moves the `StorageClass` type to the `storage.k8s.io` group (named for consistency with authentication, authorization, rbac, and imagepolicy).  There are two commits, one for manaul changes and one for generated code.
2016-09-06 23:22:02 -07:00
Clayton Coleman 48b4d6d30c
Check for EmptyConfig errors when trying to use in-cluster config
By removing the default "localhost:8080" behavior several paths in
client config began returning err == ErrEmptyConfig rather than err ==
nil.  The code checking for in cluster config was wrong - the logic
should be:

1. If loading the underlying config returns a non-empty error, fail
2. If the underlying config is not equal to the default config,
   return that config (it's got user input)
3. If it is possible to use in cluster config, do so
4. Otherwise return the default config (and or default EmptyConfig
   error).
2016-09-06 17:46:50 -04:00
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
Angus Salkeld e9cad12e5f Add a check in ConfirmUsable() to validate the contextName 2016-09-01 11:35:11 +10:00
Clayton Coleman 06cbb29e9e
ClientConfig should not default to http://localhost:8080
This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.
2016-08-30 10:43:24 -04:00
mehdy fb00d77c17 updated document
as far as I dug into codes I figured it out that the config exists in `restclient` package
2016-08-30 12:46:52 +04:30
Brendan Burns a79f714b1e Make password prompting hide the string 2016-08-27 21:31:04 -07:00
Michael Fraenkel f061f74f56 Use scale subresource
- Use scale subresource for ReplicationController, ReplicaSet and Deployment.
2016-08-25 17:17:12 -04:00
Andy Goldstein 8530ede61f Check init containers in PodContainerRunning
Sometimes when an init container runs and terminates quickly, PodContainerRunning can go into a
state where the pod indicates it's still running, but the container is already terminated. Handle
that condition by returning ErrContainerTerminated when it happens.
2016-08-22 15:55:42 -04:00
Kubernetes Submit Queue 5a98379bca Merge pull request #29696 from brendandburns/kubecfg
Automatic merge from submit-queue

Add initial support for TokenFile to to the client config file.

@smarterclayton @deads2k @cjcullen @krousey 

Part of the fix for #28260
2016-08-21 11:18:21 -07:00
Kubernetes Submit Queue 7272cd09e3 Merge pull request #26541 from sttts/sttts-kubectl-exec-rc
Automatic merge from submit-queue

Return container command exit codes in kubectl run/exec

Fixes https://github.com/kubernetes/kubernetes/issues/26424
Based on https://github.com/kubernetes/kubernetes/pull/25273.

TODO:
- [x] add e2e tests
- [x] investigate `kubectl run` exit code for `--restart=Never` (compare issue #24533 and PR #25253)
- [x] document exit codes
2016-08-21 00:44:55 -07:00
Kubernetes Submit Queue db777bb9a3 Merge pull request #30940 from madhusudancs/fed-issue-30790
Automatic merge from submit-queue

Return the current kubeconfig as the starting config in ClientConfigGetter.

This fixes issue #30790.

cc @kubernetes/sig-cluster-federation
2016-08-20 19:29:31 -07:00
Kubernetes Submit Queue e9947d9ad7 Merge pull request #30813 from bprashanth/kubectl_petset
Automatic merge from submit-queue

Basic scaler/reaper for petset

Currently scaling or upgrading a petset is more complicated than it should be. Would be nice if this made code freeze on friday. I'm planning on a follow up change with generation number and e2es post freeze.
2016-08-20 10:51:07 -07:00
bindata-mockuser e792d4117d Add return code support to kubectl-exec and -run 2016-08-20 15:58:47 +02:00
Kubernetes Submit Queue d40e2296b2 Merge pull request #30630 from silasbw/short-n0
Automatic merge from submit-queue

Add a short `-n` for `kubectl --namespace`

fixes #24078

 `--namespace` is a very common flag for nearly every `kubectl` command we have. We should claim `-n` for it.
2016-08-19 14:34:13 -07:00
Aliaksandr Pliutau 41ffa9a254 Example of unversioned pkg uses correct Config struct 2016-08-19 10:57:55 +07:00
Madhusudan.C.S 2b5d689ab2 Return the current kubeconfig as the starting config in ClientConfigGetter. 2016-08-18 15:51:21 -07:00
Clayton Coleman 12a5eeea17
Introduce GroupVersioner for capturing desired target version
Convert single GV and lists of GVs into an interface that can handle
more complex scenarios (everything internal, nothing supported). Pass
the interface down into conversion.
2016-08-18 14:45:00 -04:00
bprashanth 30f3cb9d26 Scaler and reaper for petset 2016-08-17 17:37:56 -07:00
Matt Liggett d60ba3c6e2 Implement DisruptionController.
Part of #12611
2016-08-16 15:20:41 -07:00
Silas Boyd-Wickizer 39a9ec3a4f Add a short `-n` for `kubectl`'s `--namespace`
fixes #24078

--namespace is a very common flag for nearly every kubectl command we have.
We should claim -n for it.
2016-08-16 08:32:47 -07:00
Brendan Burns 50089f6c81 Initial support for TokenFile in the client config. 2016-08-15 21:59:49 -07:00
Kubernetes Submit Queue 612e3c2634 Merge pull request #30222 from hodovska/port-forward-cmd-struct
Automatic merge from submit-queue

kubectl/port-forward: complete/validate/run structure

```kubectl port-forward``` command is converted to a complete/validate/run kubectl command structure specified here: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/kubectl-conventions.md#command-conventions
In this PR is also exposed the ready and stop channel for API consumer.

Fixes #16504
2016-08-12 20:58:53 -07:00
Dominika Hodovska c5babe2396 expose ready/stop channel 2016-08-12 15:45:57 +02:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
Davanum Srinivas b15219034d Prevent panic in 'kubectl exec' when redirecting stdout
Just add some nil checks to make sure we don't trip over when
we redirect output from exec to a file.

Fixes #30290
2016-08-09 14:52:55 -04:00
Kubernetes Submit Queue 9083ee971e Merge pull request #29137 from janetkuo/scheduledjob-controller
Automatic merge from submit-queue

Scheduledjob controller

Supersedes #25952; first 7 commits come from #25816

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
```
2016-08-05 18:07:48 -07:00
Eric Tune 8675e014fb ScheduledJob controller 2016-08-05 13:34:50 -07:00
deads2k 32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
Kubernetes Submit Queue e7d01097dc Merge pull request #29971 from caesarxuchao/fix-kubectl-rolling-update-with-gc
Automatic merge from submit-queue

[GarbageCollector] Fix kubectl rolling-update to work with GC

This changes the order of the [Rename()](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532) function. After the change, Rename() first deletes the old RC and orphans its pods, then creates the new RC, which will then have a chance to adopt the orphaned pods.

This also fixes the "should support rolling-update to same image" [test](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/kubectl.go#L915) when the garbage collector is on.

Here is the detailed explanation on why the test would have failed:
`kubectl rolling-update` will [rename](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532-L546) the RC. It first creates the an identical RC (including spec.selectors) with the new name, then it deletes the existing RC. When GC is turned on, the newly created RC cannot adopt the existing pod, because it has a controllerRef pointing to the exising RC, so the new RC will create new pods and expect to see the creation. However, the new RC and the old RC have the same selector, so sometimes the old RC, instead of the new RC, has its [expectation lowered](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346-L362), the new RC's expectation will stuck forever. The e2e test then times out when executing `kubectl delete newRC`, because there is the new RC will not scale down as its expectation is not fulfilled.

A side-note, we should fix [rm.getPodController()](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346) to respect pod's controllerref, that will prevent similar bugs.

Also note that an old version `kubectl rolling-update` will not work with the GC. We cannot fix that.
2016-08-04 20:48:10 -07:00
Kubernetes Submit Queue c2340870c6 Merge pull request #29952 from fabianofranz/handle_container_terminated_pod_running_condition
Automatic merge from submit-queue

Handle container terminated but pod still running in conditions

Sometimes when you have a pod with more than one container, and the container runs and terminates really fast, `PodContainerRunning` can go into a state where the pod indicates it's still running, but the container is already terminated. Handle that condition by returning `ErrContainerTerminated` when it happens.
2016-08-04 07:13:08 -07:00
Chao Xu 96c84303bd fix kubectl rolling-update when GC is enabled 2016-08-03 15:57:03 -07:00
deads2k 60dd4a5d26 interesting changes to add tokenreviews endpoint to implement webhook 2016-08-03 08:37:45 -04:00
deads2k eb79e2c859 generated code changes 2016-08-03 08:37:45 -04:00