Commit Graph

110 Commits (84ef7a36492be616fb2c7d4f395ef1b07d0af4b2)

Author SHA1 Message Date
Michal Fojtik 0faa27e62d Use PATCH when pausing/resuming objects and CalculatePatches to get the patch 2016-10-31 13:13:59 +01:00
Kubernetes Submit Queue bc5682bbaa Merge pull request #35050 from JacobTanenbaum/resource_fixes
Automatic merge from submit-queue

fixed some issues with kubectl set resources

when using kubectl set resources it resets all resource fields that are not being set.

for example
  # kubectl set resources deployments nginx --limits=cpu=100m

followed by

  # kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

 you must specify an update to requests or limits or  (in the form of --requests/--limits)

corrected to

 you must specify an update to requests or limits (in the form of --requests/--limits)

 Implemented both the dry run and local flags.

Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112
2016-10-30 06:18:56 -07:00
Kubernetes Submit Queue 7c9c8cbf28 Merge pull request #34952 from kargakis/update-observedgeneration-for-overlapping-deployments
Automatic merge from submit-queue

Make overlapping deployments deletable

@kubernetes/deployment ptal

Fixes https://github.com/kubernetes/kubernetes/issues/34466 by 1) not adding the overlapping annotation in the working deployment, 2) updates observedGeneration for overlapping deployments, and 3) updates the kubectl deployment reaper to do non-cascading deletion for deployments with the overlapping annotation.
2016-10-29 14:50:16 -07:00
Kubernetes Submit Queue 739f78fad2 Merge pull request #33250 from ymqytw/edit_before_create
Automatic merge from submit-queue

support editing before creating resource

Support `kubectl create -f config.yaml --edit`
Support editing before creating resource from files, urls and stdin.
The behavior is similar to `kubectl edit`
It won't create anything when edit make no change.

partial: #18064

Based on: #33686 and #33973

```release-note
Support editing before creating resource from files, urls and stdin, e.g. `kubectl create -f config.yaml --edit`
It won't create anything when edit make no change.
```
2016-10-29 11:45:43 -07:00
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
Jacob Tanenbaum a77cecb957 Implemented both the dry run and local flags.
Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112
2016-10-27 14:05:46 -04:00
Jacob Tanenbaum fe3bcad128 fixed some issues with kubectl set resources
when using kubectl set resources it resets all resource fields that are not being set.

for example
  # kubectl set resources deployments nginx --limits=cpu=100m

followed by

  # kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

 you must specify an update to requests or limits or  (in the form of --requests/--limits)

corrected to

 you must specify an update to requests or limits (in the form of --requests/--limits)

changelog:
 - fixed a typo in hack/make-rules/test-cmd.sh "effecting" to "affecting"
2016-10-27 14:05:46 -04:00
ymqytw c641834bb3 support editing before creating resource 2016-10-24 09:56:37 -07:00
Michail Kargakis 12455bf5e1 hack: add test for overlapping selectors in deployments 2016-10-18 17:46:34 +02:00
Kubernetes Submit Queue 3f4c438946 Merge pull request #34836 from mikedanese/prune-1
Automatic merge from submit-queue

kubectl: apply prune should fallback to basic delete when a resource has no reaper

Fixes #34790

cc @kubernetes/kubectl @MrHohn
2016-10-15 18:38:20 -07:00
Kubernetes Submit Queue 9174429776 Merge pull request #33546 from k82cn/k8s_15834
Automatic merge from submit-queue

Updated err message when retrieving resources by name with --all-name…

fixes #15834
2016-10-15 06:50:00 -07:00
Kubernetes Submit Queue c0bd6e8ea5 Merge pull request #33958 from juanvallejo/jvallejo/add-global-timeout-flag
Automatic merge from submit-queue

Add global timeout flag

**Release note**:
```release-note
Add a new global option "--request-timeout" to the `kubectl` client
```

UPSTREAM: https://github.com/kubernetes/client-go/pull/10

This patch adds a global timeout flag (viewable with `kubectl -h`) with
a default value of `0s` (meaning no timeout).

The timeout value is added to the default http client, so that zero
values and default behavior are enforced by the client.

Adding a global timeout ensures that user-made scripts won't hang for an
indefinite amount of time while performing remote calls (right now, remote
calls are re-tried up to 10 times when each attempt fails, however, there is
no option to set a timeout in order to prevent any of these 10 attempts from
hanging indefinitely).

**Example**
```
$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --request-timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --request-timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)
```
2016-10-14 23:29:58 -07:00
Mike Danese c17a8a773d kubectl: apply prune should fallback to basic delete when a resource has no reaper 2016-10-14 15:04:38 -07:00
Klaus Ma 005b8dad14 Updated err message when retrieving resources by name with --all-namespaces. 2016-10-14 22:21:01 +08:00
juanvallejo fd087caadb Add global timeout flag
This patch adds a global timeout flag (viewable with `kubectl -h`) with
a default value of `0s` (meaning no timeout).

The timeout value is added to the default http client, so that zero
values and default behavior are enforced by the client.

**Example**
```
$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)
```
2016-10-14 09:57:40 -04:00
Jacob Tanenbaum 901bbee2fd Add 'kubectl set limit'
Add a way to set resource limits/requests on running pods

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

I squashed the commits to make rebasing easier
Change log:

- fixed a typo that caused the command to be run with kubectl set set instead of the correct kubectl set limit

- added a ResourcesWithPodTemplates to pkg/kubectl/cmd/util/factory.go
     instead of hardcoding these resources move there description all in one place

- Fixing some of the flow control in kubectl set limit

- update the help info

- changed the name of ResourcesWithPodTemplates to ResourcesWithPodSpecs to more accuratly describe what it is doing
    and changed the variable names to lower case to conform to go's variable naming convention

- changing the name of the command from 'set limit' to 'set resources'

- Adding the new file pkg/kubectl/cmd/set/set_resources.go

- changes to the test cases to reflect the change from 'kubectl set limit' to 'kubectl set resources'

- comment removed

- adding the man page to the git repository attempting to fix Jenkins tests

- adding the user guide

- fixed a few typos

- typo in hack/cmd-test.sh

- implamenting suggestions for command help text

- adding the dry-run flag

- removing the "remove" option in favor of zeroing out request/limits in order to remove them

- changed limits/requests to requests/limit

- changing ResourcesWithPodSpec

- updated generated docs and removed whitespace

- change priint on success message from "resource limits/requests updated" to "resource requirements updated"

- minor rebasing issues - 'hack/test-cmd.sh' now passes

- cmdutil.PrintSuccess added another argument

- fixing mungedocs failure

- removed whitespace from hack/make-rules/test-cmd.sh and an erroneous entry from pkg/cloudprovider/providers/openstack/MAINTAINERS.md

- fixed typo in Short: field of the cobra command

- rebased

- Creating a new factory in the ResourcesWithPodSpecs() so that the testing will pass

- changing ResourcesWithPodSpecs, it doesn't need to be a method of factory
2016-10-14 08:35:32 -04:00
deads2k f73d1ea90a make sure that the bootstrap rbac rules are getting created in test-cmd 2016-10-10 15:00:36 -04:00
Michail Kargakis 75f30ec46f kubectl: add --revision flag in rollout status 2016-10-10 15:04:46 +02:00
Kubernetes Submit Queue a99adcdf49 Merge pull request #34343 from mikedanese/prune-tests
Automatic merge from submit-queue

kubectl: add two more test of kubectl apply --prune

@pwittrock
2016-10-08 14:29:56 -07:00
Mike Danese 6d17a87809 kubectl: add two more test of kubectl apply --prune 2016-10-07 10:30:41 -07:00
Michail Kargakis 89eaa918be controller: save older revisions for Deployment's replica sets 2016-10-07 11:45:06 +02:00
Kubernetes Submit Queue 83921597ef Merge pull request #29236 from juanvallejo/jvallejo_add-configuration-missing-error-type
Automatic merge from submit-queue

Update client config invalid option errors to be more specific

This patch adds better error handling for cases where a global option (such as --context or --cluster) causes an invalid config to be returned.

```release-note
release-note-none
```
2016-10-07 01:24:49 -07:00
Mike Danese 62960aace7 add a test for kubectl apply --prune 2016-10-06 17:49:02 -07:00
juanvallejo 6f925b1f82
handle invalid client config option errors
This patch provides a more relevant error message when a client
configuration option is passed with an invalid or non-existent value.

`$ kubectl get pods --cluster="non-existent"`
```
error: No configuration file found, please login or point to an existing
file
```

`$ kubectl get pods --cluster="non-existent"`
```
error: cluster "non-existent" does not exist
```
2016-10-06 16:28:51 -04:00
Kubernetes Submit Queue d4088fc47b Merge pull request #34020 from juanvallejo/jvallejo/allow-empty-annotation-values
Automatic merge from submit-queue

Allow empty annotation values

Related downstream issue: https://github.com/openshift/origin/issues/11175

**Release note**:
```release-note
release-note-none
```

Annotations with empty values can be used, for example, in diagnostics
logging. This patch removes the client-side check for empty values in
an annotation key-value pair.

**Before**
```
$ kubectl annotate pod zookeeper-1 node-selector="" --overwrite
error: invalid annotation format: node-selector=
```

**After**
```
$ kubectl annotate pod zookeeper-1 node-selector="" --overwrite
pod "zookeper-1" annotated
```

```
$ kubectl get po/zookeeper-1 --template='{{.metadata.annotations}}'
map[... node-selector: test-label:test]
```

@fabianofranz @liggitt
2016-10-05 11:48:02 -07:00
juanvallejo a872657371
Allow empty annotation values
Annotations with empty values can be used, for example, in diagnostics
logging. This patch removes the client-side check for empty values in
an annotation key-value pair.

**Before**
```
$ kubectl annotate pod zookeeper-1 node-selector="" --overwrite
error: invalid annotation format: node-selector=
```

**After**
```
$ kubectl annotate pod zookeeper-1 node-selector="" --overwrite
pod "zookeper-1" annotated
```

```
$ kubectl get po/zookeeper-1 --template='{{.metadata.annotations}}'
map[... node-selector: test-label:test]
```
2016-10-05 13:17:08 -04:00
Kubernetes Submit Queue a7f6557f1d Merge pull request #34074 from asalkeld/annotate-local-option
Automatic merge from submit-queue

Add local option to annotate

**What this PR does / why we need it**:
Add the --local option to be both consistent with other commands and so it can be used with "set selector" and "create service".

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

**Special notes for your reviewer**:
None

**Release note**:
```release-note
Add a new option "--local" to the `kubectl annotate`
```
2016-10-05 07:09:05 -07:00
Angus Salkeld 5cb945d672 Add local option to the label command
This is to be used with the new "set selector" command.
2016-10-05 15:45:43 +10:00
Angus Salkeld b86b85dea9 Add local option to annotate 2016-10-05 14:39:56 +10:00
Kubernetes Submit Queue 6f69293240 Merge pull request #32599 from mikedanese/kubectl-selector
Automatic merge from submit-queue

allow kubectl -f to filter by selector

cc @kubernetes/kubectl

Fixes #32544
2016-10-01 01:13:09 -07:00
deads2k b577498c66 add optional env var for allowing version skew in test cmd 2016-09-30 13:37:25 -04:00
Mike Danese 6339d915a7 add a test to test-cmd.sh for apply -f with label selector 2016-09-30 00:42:35 -07:00
Davanum Srinivas e1373cf516 Extend all to more resources
Added more things from the list here:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go#L159

Update the devel/kubectl-conventions.md with the rules mentioned by
a few folks on which resources could be added to the special 'all' alias
2016-09-19 13:01:59 -04:00
Kubernetes Submit Queue 27c5e5dca7 Merge pull request #31110 from AdoHe/rollout_dry_run
Automatic merge from submit-queue

Rollout dry run

**What this PR does / why we need it**: rollout undo add dry-run implementation

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

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```
rollout undo add dry-run option
```
2016-09-11 15:05:16 -07:00
Kubernetes Submit Queue b4c09192bc Merge pull request #31841 from fraenkel/replace_force
Automatic merge from submit-queue

Replace force

fixes #28115
2016-09-11 14:27:30 -07:00
Michael Fraenkel 88e17d7478 Require force when using grace period or timeout 2016-09-08 07:45:20 -04:00
AdoHe 6a68dbdac4 rollout undo add dry-run implementation 2016-09-08 08:02:04 +08:00
deads2k f9b498e341 add group prefix matching for kubectl usage 2016-09-07 10:32:39 -04:00
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
Jeff Mendoza 95b73058d2 Removed non-md files from docs. Moved doc yamls to test/fixtures.
Most of the contents of docs/ has moved to kubernetes.github.io.
Development of the docs and accompanying files has continued there, making
the copies in this repo stale. I've removed everything but the .md files
which remain to redirect old links. The .yaml config files in the docs
were used by some tests, these have been moved to test/fixtures/doc-yaml,
and can remain there to be used by tests or other purposes.
2016-08-25 15:09:27 -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
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
Kubernetes Submit Queue f51e834d63 Merge pull request #30445 from deads2k/get-raw
Automatic merge from submit-queue

add --raw for kubectl get

Adds a `--raw` option to `kubectl get` that allow you specify your URI, but use the transport built by `kubectl`.  This is especially useful when working with secured environments that require authentication and authorization to hit non-api endpoints.  For example, `kubect get --raw /metrics` or if you want to debug a watch with a view at the exact data `kubectl get --raw '/api/v1/namespaces/one/replicationcontrollers?watch=true'`.

@kubernetes/kubectl 
@fabianofranz fyi
2016-08-19 09:29:08 -07:00
bprashanth beb2088b1a test-cmd 2016-08-17 17:37:56 -07:00
Timothy St. Clair 730fc70107 Update etcd default ports for v3, and validate tests 2016-08-17 07:49:19 -05:00
deads2k 1ed263e0e5 add --raw for kubectl get 2016-08-17 08:45:50 -04: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
Kubernetes Submit Queue 3a8b21b3a5 Merge pull request #29724 from brendandburns/thirdparty3
Automatic merge from submit-queue

Fix third party APIResource reporting

@polvi @caesarxuchao @deads2k 

This "fixes" some additional bugs in third party `APIResourceList` reporting.

This code needs a bunch of cleanup, and more tests, but sending it out for a quick smell check review in case I'm doing something stupid.

Fixes the bug referenced here:  https://github.com/kubernetes/kubernetes/pull/28414#issuecomment-235346108 and in https://github.com/kubernetes/kubernetes/issues/23831

Fixes https://github.com/kubernetes/kubernetes/issues/25570
2016-08-13 17:10:20 -07:00
Brendan Burns b3658c7b16 Fix third party APIResource reporting 2016-08-13 15:51:34 -07:00
Kubernetes Submit Queue 2ab58ea519 Merge pull request #30162 from juanvallejo/jvallejo_err-kube-run-on-invalid-image-value
Automatic merge from submit-queue

return err on `kubectl run --image` with invalid value

When running `kubectl run <configname> --image="Invalid$$%ImageValue%%__"`, a configuration is successfully created with an image name that is not a valid value for an image reference.

This patch validates that the image name is a valid image reference, and returns an error before creating a config if an invalid value is passed.

`$ kubectl run test --image="Invalid__%imagename"`
```
error: Invalid image name "Invalid__%imagename": invalid reference format
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30162)
<!-- Reviewable:end -->
2016-08-12 06:09:26 -07:00
juanvallejo af37981812 return err on kubectl run --image with invalid value 2016-08-09 15:05:44 -04:00
Ryan Hitchman 5508e49ef5 Use bash ranges "{1..3}" instead of "$(seq 1 3)". 2016-08-08 16:23:39 -07:00
deads2k 32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
deads2k 60dd4a5d26 interesting changes to add tokenreviews endpoint to implement webhook 2016-08-03 08:37:45 -04:00
Michael Fraenkel b1e7e6cf46 Service names conform to RFC 1035 2016-08-02 08:42:15 -06:00
childsb f5bd7d471e API Changes for StorageClass 2016-07-28 19:01:01 -04:00
Wojciech Tyczynski 4d0d115690 Revert "add tokenreviews endpoint to implement webhook" 2016-07-21 09:40:35 +02:00
deads2k 2c4a9f2e8d interesting changes to add tokenreviews endpoint to implement webhook 2016-07-20 15:11:56 -04:00
Mike Dame cfbf7da75b Make sure --record=false is acknowledged when passed to commands 2016-07-15 11:24:05 -04:00
Tim Hockin faeef5c4ae Use make as the main build tool
This allows us to start building real dependencies into Makefile.

Leave old hack/* scripts in place but advise to use 'make'.  There are a few
rules that call things like 'go run' or 'build/*' that I left as-is for now.
2016-07-12 21:52:00 -07:00