Commit Graph

5368 Commits (750881c0ab62a9f59d53582bc33826caa167aa83)

Author SHA1 Message Date
SneakyFish5 1fdb5d9722
Fix print error 2018-08-08 23:35:18 -05:00
Kenjiro Nakayama 9cb24c4680 `kubectl create {clusterrole,role}`'s `--resources` flag support asterisk to specify all resources 2018-08-09 08:40:12 +09:00
Sean Sullivan ff6113dfc8 Removes dependency on RBAC within kubernetes core 2018-08-08 13:58:35 -07:00
juanvallejo 0c4bb64304
expose default LogsForObject consumeRequest func 2018-08-06 16:23:18 -04:00
Kubernetes Submit Queue 554418735a
Merge pull request #66692 from m1kola/66456_waitcmd__error_for_selectors
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>.

Makes kubectl wait exit with status 1 and print an error message, if there is no resources matching selectors

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

It makes the `kubectl wait` command print an error message and exit with exit code 1, if there is no resource matching users's query. This can happen when user specifies selectors. Example:

```
kubectl wait deployment -l app=something-that-does-not-exist --for condition=available --timeout=5s
```

**Which issue(s) this PR fixes**:
Fixes #66456

**Special notes for your reviewer**:

This is my first contribution into the project (except one line change in docs) and don't have much experience with Go. I learned a lot while working on this (about resource finders and the `Visitor` interface and it's implementations), but it is very likely that I'm doing something wrong :)

I'm keen to continue contributing into the project (into the cli part for now), so I will really appreciate detailed feedback, if you have a chance to provide it (point me into a right direction and/or explain why it's not a good idea to do something in a certain way).

Thanks!

**Release note**:
```release-note
kubectl: the wait command now prints an error message and exits with the code 1, if there is no resources matching selectors
```
2018-08-06 10:31:57 -07:00
WanLinghao 5db028612d snip more legacy scheme uses we don't need
ref:https://github.com/kubernetes/kubernetes/pull/66926
2018-08-06 09:44:04 +08:00
David Eads 029b4388fe switching rolling update to external clients 2018-08-03 13:18:14 -04:00
Kubernetes Submit Queue dab04dc6e0
Merge pull request #66967 from deads2k/kubectl-09-naughty
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>.

stop adding internal types to external schemes

at some point someone starting internal types to external schemes in kubectl tests.  This fixes that mistake.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 

```release-note
NONE
```
2018-08-03 10:07:47 -07:00
Kubernetes Submit Queue 8a5e9ecf8f
Merge pull request #66965 from deads2k/kubectl-08-internalfactoryclient
Automatic merge from submit-queue (batch tested with PRs 61389, 66817, 66903, 66675, 66965). 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 internal client factory method

remove final uses of the internal client factory method.  https://github.com/kubernetes/kubernetes/pull/66933 does the rolling updater, so this just snips it off and prevents anyone else from ever relying on it.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 

```release-note
NONE
```
2018-08-03 07:33:21 -07:00
Kubernetes Submit Queue 43a46cc9b7
Merge pull request #66817 from charrywanganthony/version_c
Automatic merge from submit-queue (batch tested with PRs 61389, 66817, 66903, 66675, 66965). 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 deprecated shorthand flag

**Release note**:
```release-note
remove deprecated shorthand flag `-c` from `kubectl version (--client)`
```
2018-08-03 07:33:07 -07:00
David Eads 8a1eae451b stop adding internal types to external schemes 2018-08-03 09:47:04 -04:00
David Eads 8b20ee1d4e remove internal factory client 2018-08-03 07:47:05 -04:00
Kubernetes Submit Queue 6d0a86220f
Merge pull request #66926 from deads2k/kubectl-04-easy-scheme
Automatic merge from submit-queue (batch tested with PRs 62901, 66562, 66938, 66927, 66926). 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>.

 snip legacy scheme uses we don't need

the legacy scheme covers the kubectl scheme. This pull converts many of the "simple" ones we can clear. I also cleared out create entirely.

@kubernetes/sig-cli-maintainers 
/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-08-02 19:57:22 -07:00
Kubernetes Submit Queue cf986d2bbe
Merge pull request #66927 from deads2k/kubectl-05-client-go
Automatic merge from submit-queue (batch tested with PRs 62901, 66562, 66938, 66927, 66926). 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>.

snip links to internal clients

This is just an example of snipping links to the internal client from k/k.  There are four more direct links to the factory method to create the internal and order of a dozen imports.

@kubernetes/sig-cli-maintainers 
/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-08-02 19:57:18 -07:00
Kubernetes Submit Queue b904855601
Merge pull request #66870 from apelisse/dry-run-client
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>.

dry-run: Update DynamicClient to pass Create/Update options

Change dynamic client to accept Create and Update options on Create/Update/Patch methods.

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-08-02 17:00:29 -07:00
Tiago M. Vieira 4cdcaa7f79
fix usage string for the kubectl logs command
Even though the use of an inline [CONTAINER] name is still accepted,
this does not match what the documentation or man page says. This commit
aligns the usage string that is displayed when the kubectl logs command
is called with more than one container name (with the use of flag or
not).
2018-08-02 15:18:29 -04:00
David Eads 7923a9fd99 snip links to internal clients 2018-08-02 14:53:22 -04:00
David Eads 937d45a809 remove legacy scheme from create 2018-08-02 14:49:31 -04:00
Kubernetes Submit Queue 03df9aa4af
Merge pull request #66907 from deads2k/kubectl-02-fwd
Automatic merge from submit-queue (batch tested with PRs 66235, 66908, 66907). 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>.

switch kubectl portfoward to external types

switch the guts of portforward to external types.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-08-02 11:30:17 -07:00
Kubernetes Submit Queue ebc6a5d0e7
Merge pull request #66908 from deads2k/kubectl-01-history
Automatic merge from submit-queue (batch tested with PRs 66235, 66908, 66907). 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>.

switch rollout history to external

low hanging fruit.  The underlying history viewer uses a live lookup with external clients already.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-08-02 11:30:13 -07:00
David Eads dd2af1c8a4 snip legacy scheme uses we don't need 2018-08-02 14:17:17 -04:00
Antoine Pelisse 71970d6475 dry-run: Update DynamicClient to pass Create/Update options 2018-08-02 10:38:31 -07:00
David Eads 59d5298314 switch expose to externals 2018-08-02 08:54:29 -04:00
David Eads 608bf0de1f update polymorphichelpers for external types 2018-08-02 08:54:29 -04:00
David Eads 8620b736cd switch kubectl portfoward to external types 2018-08-02 08:10:03 -04:00
David Eads 0661216d9a switch rollout history to external 2018-08-02 07:57:14 -04:00
Kubernetes Submit Queue 9c58985a25
Merge pull request #66519 from juanvallejo/jvallejo/switch-attch-externals
Automatic merge from submit-queue (batch tested with PRs 65730, 66615, 66684, 66519, 66510). 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>.

update attach to use external objs

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

Updates attach command to use external versions.

cc @deads2k @soltysh
2018-08-01 15:52:16 -07:00
Kubernetes Submit Queue e322d1485d
Merge pull request #60316 from soltysh/create_job
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>.

Full blown kubectl create job

**What this PR does / why we need it**:
This is a followup to https://github.com/kubernetes/kubernetes/pull/60084 which adds full blown `create job` command

/assign @deads2k @juanvallejo 

**Release note**:

```release-note
Add kubectl create job command
```
2018-08-01 13:04:18 -07:00
juanvallejo 3a3633a32e
update logs 2018-08-01 10:44:44 -04:00
juanvallejo 9120557466
update attach to use external objs 2018-08-01 10:44:43 -04:00
Maciej Szulik 4ced88b162
Full blown kubectl create job 2018-08-01 15:04:04 +02:00
Kubernetes Submit Queue 007bf90e32
Merge pull request #66725 from juanvallejo/jvallejo/update-patch-return-code-logic
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>.

update exit code to 0 if patch not needed

**Release note**:
```release-note
The `kubectl patch` command no longer exits with exit code 1 when a redundant patch results in a no-op
```

The specific logic in the `patch` command that exited with code 1, was only doing so when there was no diff between an existing object and its patched counterpart. (In case of errors, we just return those, which eventually ends up exiting with code 1 anyway). This patch removes this block, as we should not be treating patch no-ops as errors.

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

cc @soltysh
2018-08-01 03:31:35 -07:00
Chao Wang caa8d7caed remove deprecated shorthand flag of client version 2018-08-01 09:54:54 +08:00
juanvallejo ad11a1b7a6
update exit code to 0 if patch not needed 2018-07-31 14:41:30 -04:00
Mikalai Radchuk d3445d71d0 Return an error if there is no resources matching
This makes `kubectl wait` print useful message when
there is no resources matching a query. Also it will now
exit with the exit status 1.
2018-07-31 18:15:24 +01:00
Kubernetes Submit Queue 2bee858a7b
Merge pull request #66284 from stewart-yu/stewart-sharedtype-move
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 the` k8s.io/kubernetes/pkg/util/pointer` package to` k8s.io/utils/pointer`

**What this PR does / why we need it**:
Move `k8s.io/kubernetes/pkg/util/pointer` to  `shared utils` directory, so that we can use it  easily.
Close #66010 accidentally, and can't reopen it, so the same as #66010 

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-30 19:50:36 -07:00
Kubernetes Submit Queue ce227b06de
Merge pull request #66558 from quasoft/depr-pod-flag
Automatic merge from submit-queue (batch tested with PRs 66593, 66727, 66558). 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>.

Mark --pod/-p flag of kubectl exec command as deprecated

**What this PR does / why we need it**:
Marks the `--pod` (`-p` shorthand) flag of kubectl `exec` command as deprecated.
Hides the flag from the help menu, but shows a message when command is executed with this flag.

**Which issue this PR fixes**:
Fixes:  https://github.com/kubernetes/kubectl/issues/104

This is a remake of PR https://github.com/kubernetes/kubernetes/pull/54629.

**Release note**:
```release-note
Flag --pod (-p shorthand) of kubectl exec command marked as deprecated
```
2018-07-27 18:05:06 -07:00
stewart-yu f1343af5d7 auto-generated file 2018-07-28 07:54:17 +08:00
stewart-yu 649b46ff1d fix verify about import error 2018-07-28 07:54:16 +08:00
Kubernetes Submit Queue 1833aabcf2
Merge pull request #66225 from charrywanganthony/edit-o-json
Automatic merge from submit-queue (batch tested with PRs 66225, 66648, 65799, 66630, 66619). 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 error binding of edit output format

**What this PR does / why we need it**:
`kubectl edit xxx/xxx -o json` won't print result in json format
**Release note**:
```release-note
NONE
```
2018-07-27 16:42:05 -07:00
Kubernetes Submit Queue 1dd4f8d82f
Merge pull request #66554 from charrywanganthony/watch_json
Automatic merge from submit-queue (batch tested with PRs 66554, 66616, 66695, 66681). 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 the watch status when -o=yaml|json option is specfied

**Which issue(s) this PR fixes** : 
`kubectl get pods --watch -o json` only putput once and stop, this PR fix this.

**Release note**:
```release-note
NONE
```
2018-07-27 10:09:04 -07:00
Kubernetes Submit Queue 4d5d2664c3
Merge pull request #65542 from juanvallejo/jvallejo/cleanup-convert-cmd
Automatic merge from submit-queue (batch tested with PRs 66333, 65542). 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>.

cleanup / simplify convert command

Cleans up unnecessary pieces from the convert command, simplifyiing
command logic, and readability.

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

cc @soltysh @deads2k
2018-07-27 07:24:05 -07:00
hangaoshuai 6c94d7ae32 return err when Unmarshal failed 2018-07-27 20:52:00 +08:00
stewart-yu 55251c716a update the import file for move util/pointer to k8s.io/utils 2018-07-27 19:47:02 +08:00
QuaSoft 75804c35aa Remove warning for deprecated flag usage as pflag already does that 2018-07-24 15:59:44 +03:00
QuaSoft 888119a47c Mark exec --pod/-p flag as deprecated 2018-07-24 11:59:37 +03:00
Chao Wang e954f9706e fix the watch status when -o=yaml|json option is specfied 2018-07-24 16:37:47 +08:00
juanvallejo 94fbb48dfc
switch logs to use external versions 2018-07-23 14:40:16 -04:00
Kubernetes Submit Queue 35ff6ea207
Merge pull request #66398 from deads2k/cli-04-make-logs-generic-again
Automatic merge from submit-queue (batch tested with PRs 66410, 66398, 66061, 66397, 65558). 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 logs command to be generic for all resources again

--all-containers should not have been allowed as it was because it only worked for pods.  This approach does not make sense for a polymorphic command.  Rather than roll it back, I'll take the time to make it generic.  Because of this and other pods-only options, we now have inconsistencies with the command that should be addressed separately.

@CaoShuFeng 
/assign @juanvallejo @soltysh 
@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-07-20 18:51:05 -07:00
Kubernetes Submit Queue 6c500be080
Merge pull request #66218 from atlassian/handle-errors
Automatic merge from submit-queue (batch tested with PRs 66152, 66406, 66218, 66278, 65660). 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>.

Handle errors

**What this PR does / why we need it**:
This is a followup PR for https://github.com/kubernetes/kubernetes/pull/64664 to handle errors returned from `.AddToScheme()` in places where they are not handled.

**Release note**:
```release-note
NONE
```
/kind cleanup
/sig api-machinery
/cc @sttts
2018-07-20 12:12:15 -07:00
David Eads 5ba07364ee fix logs command to be generic for all resources again 2018-07-20 15:10:44 -04:00
Jordan Liggitt dc5f615152
Send correct headers for pod printing 2018-07-19 20:55:00 -04:00
Chao Wang 71299558c1 update testcase for edit 2018-07-18 15:41:38 +08:00
Mengqi Yu 60630eb38e add tests for polymorphichelpers pkg 2018-07-18 00:37:00 -07:00
W. Trevor King 0d81e838d7 kubectl: Drop typer from DrainOptions
The property was added in c6e9ad06 (Initial node drain implementation
for #3885, 2015-10-30, #16698), but beb5ea64 (remove mapper dependency
- PrintSuccess, 2018-02-01, #59227) removed the only initializer.
2018-07-17 10:10:47 -07:00
Mikhail Mazurskiy 5cab7f9a57
Handle errors 2018-07-17 20:47:14 +10:00
juanvallejo 5e79a25e0c
add support for "success" output for edit command
Adds support for the "success" printer in the "edit" command, while
ensuring outputFormat constraints for the in-editor printer.
2018-07-16 12:06:32 -04:00
WanLinghao 4db1cc03ba clean unused function 2018-07-16 15:16:32 +08:00
Chao Wang a87b82c0ad fix error binding of edit output format 2018-07-16 14:27:20 +08:00
Kubernetes Submit Queue 2a62949899
Merge pull request #64181 from stealthybox/kubecuttle_run_help_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>.

Correct image in `kubectl help run`

**What this PR does / why we need it**:
Simple typo fix -- image for this hazelcast command example was transposed /w nginx

/sig cli
/area kubectl
/kind cleanup
/kind documentation

**Release note**:
```release-note
NONE
```
2018-07-13 17:46:55 -07:00
Kubernetes Submit Queue 43d30a143b
Merge pull request #66140 from liggitt/kubectl-current-context
Automatic merge from submit-queue (batch tested with PRs 66121, 66140, 66045). 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 modifying current context with kubectl set-context

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

Enabled setting the namespace (or any other attribute) for the current context, rather than needing to provide a name:
```
kubectl config set-context --current --namespace=some-namespace
kubectl config set-context --current --cluster=some-cluster
kubectl config set-context --current --user=some-user
```

```release-note
`kubectl config set-context` can now set attributes of the current context, like the current namespace, by passing `--current` instead of a specific context name
```
2018-07-12 23:05:05 -07:00
Kubernetes Submit Queue 704b180ce6
Merge pull request #66121 from CaoShuFeng/csr_approve
Automatic merge from submit-queue (batch tested with PRs 66121, 66140, 66045). 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 csr status message for kubectl certificate deny

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-12 23:05:01 -07:00
juanvallejo 4446a29440
cleanup / simplify convert command
Cleans up unnecessary pieces from the convert command, simplifyiing
command logic, and readability.
2018-07-12 18:12:37 -04:00
Jordan Liggitt fe53c618e8
Allow modifying current context with kubectl set-context 2018-07-12 17:19:01 -04:00
David Eads 9fe20cfd46 make delete waits match on UID 2018-07-12 14:48:13 -04:00
Cao Shufeng 259d39fade fix csr status message for kubectl certificate deny 2018-07-12 19:02:45 +08:00
Kubernetes Submit Queue 029213748a
Merge pull request #65908 from juanvallejo/jvallejo/switch-delete-strategy-background
Automatic merge from submit-queue (batch tested with PRs 64695, 65982, 65908). 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>.

switch delete strategy to background deletion

**Release note**:
```release-note
"kubectl delete" no longer waits for dependent objects to be deleted when removing parent resources
```

### Before 1.11.0

- Resources that had client-side reapers in older versions of the client had all of their dependents deleted first. The parent resource itself was deleted *last*. This allowed the command to be re-entrant and was largely an artifact of it **having** to be done that way by a client-side reaper.

### After 1.11.0 (with this PR)

- Resources that previously had client-side reapers are no longer deleted last (after their dependents). They are now instead deleted first. The garbage-collector server-side then deletes any dependents.
- This means that the `delete` command can return, and the parent object can be deleted while child objects still exist.
  - This is okay because the child resources are eventually deleted by the garbage collector server-side. 

cc @liggitt @soltysh
2018-07-10 08:55:15 -07:00
David Eads fabe703756 re-make print flags composeable for sophisticated callers 2018-07-10 08:08:01 -04:00
Kubernetes Submit Queue aab517313c
Merge pull request #63793 from hzxuzhonghu/kubectl-proxy-keepalive
Automatic merge from submit-queue (batch tested with PRs 63793, 65989). 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 kubectl proxy to set tcp keepalive

**What this PR does / why we need it**:
Allows setting keepalive period for kubectl proxy.

Fixes #63727

**Special notes for your reviewer**:

/assign @brendandburns

**Release note**:

```release-note
Introduce a new flag `--keepalive` for kubectl proxy to allow setting keep-alive period for long-running request.
```
2018-07-10 02:46:01 -07:00
Kubernetes Submit Queue 24ee75e265
Merge pull request #65880 from juanvallejo/jvallejo/fix-template-printer-rollout-cmds
Automatic merge from submit-queue (batch tested with PRs 64226, 65880). 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>.

wire PrintFlags through rollout commands

Binds PrintFlags to rollout commands.
Adds tests ensuring --template printing is supported by rollout cmds.

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

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

cc @soltysh @deads2k
2018-07-09 12:16:06 -07:00
juanvallejo ebd48f26e5
switch delete strategy to background deletion 2018-07-09 13:34:00 -04:00
Kubernetes Submit Queue e049c458ed
Merge pull request #65836 from grampajoe/extra-character
Automatic merge from submit-queue (batch tested with PRs 64664, 65836, 65917). 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 an extra character from rollout error message

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

Removes an extra character in a `kubectl rollout status` error message.

**Special notes for your reviewer**:

I thought this would be a good first contribution!

**Release note**:

```release-note
NONE
```
2018-07-09 08:07:00 -07:00
juanvallejo 2b0b605c80
wire PrintFlags through rollout commands
Binds PrintFlags to rollout commands.
Adds tests ensuring --template printing is supported by rollout cmds.
2018-07-06 17:32:42 -04:00
Kubernetes Submit Queue b6c52143be
Merge pull request #65838 from WanLinghao/clusterinfo_fix
Automatic merge from submit-queue (batch tested with PRs 65838, 65837). 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 kubectl cluster-info bug

**What this PR does / why we need it**:
   When api-server is not avaiable,` kubectl cluster-info `still prints information like: the cluster is running at ...
    This patch fixes this bug

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-06 11:03:01 -07:00
David Eads a31d2c44f4 flatten nested lists for flatten in visitor 2018-07-05 07:57:53 -04:00
Kubernetes Submit Queue 63c33f3812
Merge pull request #65543 from juanvallejo/jvallejo/improve-help-wait-cmd
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 help description and examples to wait

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

Adds --help description and examples to the `wait` command.

cc @soltysh
2018-07-05 04:31:48 -07:00
WanLinghao 9407e2bb43 When api-server is not avaiable, kubectl cluster-info still prints information like: the cluster is running at ...
This patch fixes this bug
2018-07-05 10:45:32 +08:00
Kubernetes Submit Queue 9899d37b59
Merge pull request #65686 from WanLinghao/priorityclass_fix
Automatic merge from submit-queue (batch tested with PRs 64593, 65117, 65629, 65827, 65686). 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 `kubectl create priorityclass` failure bug

**What this PR does / why we need it**:
update` kubectl create priorityclass` command's api version.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65685 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-04 18:52:22 -07:00
Joe Friedl 74eaa3b2bc kubectl: Remove an extra character from rollout error message 2018-07-04 14:24:14 -04:00
Kubernetes Submit Queue df1826c9d7
Merge pull request #65786 from juanvallejo/jvallejo/update-template-printer-check
Automatic merge from submit-queue (batch tested with PRs 65715, 65786). 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>.

update --template printer defaulting

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

Depends on https://github.com/kubernetes/kubernetes/pull/65711
The relevant commit for this PR is the last one (`
fix go-template defaulting for commands w default output format`)

cc @deads2k @soltysh
2018-07-04 06:18:08 -07:00
Kubernetes Submit Queue 5a7bdd3eec
Merge pull request #65715 from deads2k/cli-82-rbac-fail
Automatic merge from submit-queue (batch tested with PRs 65715, 65786). 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>.

fail on rbac resources of non-v1 versions in reconcile

Reconcile only supports rbac/v1 and other resources are skipped.  This is good, except that only RBAC resources should really fail.  This makes it fail.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-07-04 06:18:05 -07:00
Kubernetes Submit Queue e3fa9133af
Merge pull request #64896 from rphillips/fixes/kubectl_eviction
Automatic merge from submit-queue (batch tested with PRs 65776, 64896). 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: wait for all errors and successes on podEviction

**What this PR does / why we need it**: This fixes `kubectl drain` to wait until all errors and successes are processed, instead of returning the first error. It also tweaks the behavior of the cleanup to check to see if the pod is already terminating, and if it is to not reissue the pod terminate which leads to an error getting thrown. This fix will allow `kubectl drain` to complete successfully when a node is draining.

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

**Special notes for your reviewer**:
/cc @sjenning 

**Release note**:
```release-note
NONE
```
#### Reproduction steps
### sleep.yml
```yaml
apiVersion: v1
kind: Pod
metadata:
  name: bash
spec: 
  containers:
  - name: bash
    image: bash
    resources:
      limits:
        cpu: 500m
        memory: 500Mi
    command:
    - bash
    - -c
    - "nothing() { sleep 1; } ; trap nothing 15 ; while true; do echo \"hello\"; sleep 10; done"
  terminationGracePeriodSeconds: 3000
  restartPolicy: Never
```

```
$ kubectl create ns testing
$ kubectl create -f sleep.yml
$ kubectl delete ns testing
$ kubectl drain 127.0.0.1 --force
```
2018-07-03 18:06:10 -07:00
Kubernetes Submit Queue 82eb501782
Merge pull request #65711 from deads2k/cli-81-template-generic
Automatic merge from submit-queue (batch tested with PRs 65677, 65711, 65150, 65726). 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 template printers a recommended printer

WIP because it needs tests.  Apparently there weren't any before.

@juanvallejo open a pull to this branch adding tests for commands that need `--template` support and I'll squash them in.

@liggitt since you think it's widespread, here's an option to make it "normal"

@kubernetes/sig-cli-maintainers
2018-07-03 16:35:09 -07:00
juanvallejo 122e748e18
fix go-template defaulting for commands w default output format
Fixes defaulting done for commands that default to a specific output
format (such as yaml, json) when a --template flag is provided and no
explicit --output value is given.

Under the above case, these commands will now properly default to
honoring the --template argument given, and default their --output
format to "go-template".
2018-07-03 17:50:33 -04:00
Ryan Phillips 5b4770e083 kubectl: wait for all errors and successes on podEviction 2018-07-03 16:11:16 -05:00
Kubernetes Submit Queue 0c698a4766
Merge pull request #65482 from wgliang/master.handle-args
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 'kubectl cp' with no arguments causes a panic

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

"kubectl cp" with no arguments causes a panic

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fix 'kubectl cp' with no arguments causes a panic
```
2018-07-03 11:30:48 -07:00
juanvallejo 25a4932653 add --template tests for commands
Adds --template printing test-cmd tests for the following commands:
kubectl annotate, kubectl apply, kubectl autoscale, kubectl
convert, kubectl create, kubectl expose, kubectl get, kubectl label,
kubectl patch.
2018-07-03 13:53:06 -04:00
David Eads 70417ca150 make template printers a recommended printer 2018-07-03 07:47:17 -04:00
David Eads 52d45cfd4f move template printers to genericclioptions 2018-07-03 07:46:51 -04:00
Kubernetes Submit Queue 20453a7a4f
Merge pull request #65700 from soltysh/output_format
Automatic merge from submit-queue (batch tested with PRs 65648, 65700, 64976, 65692, 65667). 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>.

Update output format so that it matches actual accepted values

/assign @juanvallejo 

**Release note**:

```release-note
NONE
```
2018-07-02 19:46:12 -07:00
Kubernetes Submit Queue 7dcac9d2a5
Merge pull request #65648 from sttts/sttts-k8s-metrics-codegen
Automatic merge from submit-queue (batch tested with PRs 65648, 65700, 64976, 65692, 65667). 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>.

k8s.io/metrics: normalize and fix codegen script

~~Builds on https://github.com/kubernetes/kubernetes/pull/65645. Will rebase when that one merges.~~ merged
2018-07-02 19:46:09 -07:00
Guoliang Wang 254b02bcc6 fix 'kubectl cp' with no arguments causes a panic 2018-07-03 10:09:27 +08:00
Kubernetes Submit Queue 38abda6d87
Merge pull request #65688 from WanLinghao/priorityclass_description_fix
Automatic merge from submit-queue (batch tested with PRs 65348, 65599, 65635, 65688, 65691). 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 a typo error in description

**What this PR does / why we need it**:
fix a typo error in description
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-02 16:52:15 -07:00
Kubernetes Submit Queue 1b758107fc
Merge pull request #65329 from deads2k/cli-76-builder-defer
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). 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 builder tolerant of restmapper failures when it doesn't need answer

@kubernetes/sig-cli-maintainers 

The restmapper, category expander, and client are not required for local lookups.  Make them late binding functions instead of building and gathering errors early.

/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-07-02 11:06:19 -07:00
Kubernetes Submit Queue a3b479af26
Merge pull request #65524 from interma/log_message_kubectl_helpers
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). 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>.

Unify log messages in pkg/kubectl/cmd/util/helpers.go

**What this PR does / why we need it**:
Unify a flag fatal message from "err accessing ..." to "**error** accessing ...", follow the word of other messages in _pkg/kubectl/cmd/util/helpers.go_. 

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

**Special notes for your reviewer**:
Very glad to open my first PR for kubernetes, thanks.

**Release note**:

```release-note
NONE
```
2018-07-02 11:06:11 -07:00
Kubernetes Submit Queue a9be7b0233
Merge pull request #65299 from WanLinghao/get_log_fix
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). 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 a log param error

**What this PR does / why we need it**:
As the patch shows, it fix a small log param error in pkg/kubectl/cmd/get/get.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-02 11:06:07 -07:00
David Eads 58136ee568 fail on rbac resources of non-v1 versions in reconcile 2018-07-02 13:07:16 -04:00
Kubernetes Submit Queue 7786bd8c9a
Merge pull request #64654 from atlassian/missing-error-handling
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 missing error handling in schema-related code

**What this PR does / why we need it**:
Adds missing error handling to a few places.

**Which issue(s) this PR fixes**
Updates #51457. Still more work to do to fix the issue - client generation code needs to be updated (addressed in https://github.com/kubernetes/kubernetes/pull/64664).

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

/kind bug
/sig api-machinery
2018-07-02 07:14:34 -07:00
Maciej Szulik 972f1444c5
Update output format so that it matches actual accepted values 2018-07-02 13:35:31 +02:00
Dr. Stefan Schimanski d79cf25497 Update external k8s.io/metrics imports 2018-07-02 10:44:18 +02:00
WanLinghao 2664470343 fix `kubectl create priorityclass` failure bug 2018-07-02 15:03:22 +08:00
WanLinghao 33e2b8a699 fix a typo error 2018-07-02 14:55:49 +08:00
Kubernetes Submit Queue 1c2b2de690
Merge pull request #65380 from janetkuo/delete-ds-12
Automatic merge from submit-queue (batch tested with PRs 65518, 65624, 65380, 65390, 65586). 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 kubectl delete hack that handles DaemonSet deletion

**What this PR does / why we need it**: follow up #64847

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


**Special notes for your reviewer**: 
/cc @liggitt @soltysh 

**Release note**:

```release-note
NONE
```
2018-06-29 18:30:12 -07:00
David Eads bc10b25465 make builder tolerant of restmapper failures when it doesn't need the answer 2018-06-29 11:07:36 -04:00
Jordan Liggitt 5cea147cd3
deprecate openapi printing in kubectl in favor of server-side printing 2018-06-28 19:41:05 -04:00
Jordan Liggitt 613b302b98
Fix bug printing openapi columns 2018-06-28 19:33:22 -04:00
Kubernetes Submit Queue 9255bf50f1
Merge pull request #65434 from yue9944882/bugfix-show-kind-for-crd
Automatic merge from submit-queue (batch tested with PRs 64575, 65120, 65463, 65434, 65522). 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>.

Set flag show-kind when getting multiple types

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

Set "--show-kind" flag if requesting multiple resource types.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-28 02:20:23 -07:00
yue9944882 c5c88006ef show kind for multiple resource types
review: simplify and trim codes

refactor ToPrinter and pass show kind flag

remove tests together with removed function
2018-06-28 11:22:09 +08:00
juanvallejo 54ddddaa2d
add help description and examples to wait 2018-06-27 14:53:07 -04:00
interma 7a130caa33 unify log messages 2018-06-27 15:46:35 +08:00
Janet Kuo 538ed3b847 Remove kubectl delete hack that handles DaemonSet deletion 2018-06-26 18:16:55 -07:00
David Eads aee798bbf3 kubectl convert should not double wrap output in nested lists 2018-06-26 11:50:37 -04:00
xuzhonghu 204d994aca Enable kubectl proxy to set tcp keepalive 2018-06-25 11:03:05 +08:00
Josh Soref e272e273b0 Remove deprecated interactive flag
fixes #61739
2018-06-24 18:44:37 -04:00
Mikhail Mazurskiy bfe313d5f3
Add missing error handling in schema-related code 2018-06-23 21:06:32 +10:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue a3fd45281a
Merge pull request #65370 from deads2k/cli-78-delete-verb
Automatic merge from submit-queue (batch tested with PRs 65377, 63837, 65370, 65294, 65376). 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>.

delete should tolerate a failed wait because of missing verbs

The power and ability to delete does not imply the power and ability to watch.  We correctly handled missing power (authz), but failed to account for ability (method not supported)

@kubernetes/sig-cli-maintainers 
@soltysh 

```release-note
Tolerate missing watch permission when deleting a resource
```
2018-06-22 16:16:11 -07:00
Kubernetes Submit Queue c3046182ec
Merge pull request #65377 from juanvallejo/jvallejo/restore-old-get-template-behavior
Automatic merge from submit-queue (batch tested with PRs 65377, 63837, 65370, 65294, 65376). 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>.

restore pre-1.11 behavior of `kubectl get --template=...`

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

Restores old behavior to the `--template` flag in `get.go`.
In old releases, providing a `--template` flag value and no `--output` value implicitly assigned a default value ("go-template") to `--output`, printing using the provided template argument.

Example:

```bash
# this should print using GoTemplate printer, but currently does not
$ kubectl get pod foo --template="{{ .metadata.name }}"
```

cc @deads2k @soltysh
2018-06-22 16:16:04 -07:00
juanvallejo 508145e529
special-case template printing in get.go 2018-06-22 14:58:27 -04:00
Kubernetes Submit Queue eb5a26f801
Merge pull request #65367 from deads2k/cli-77-delete
Automatic merge from submit-queue (batch tested with PRs 65339, 65343, 65324, 65335, 65367). 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 sure delete waiting doesn't re-evaluate the resource lists

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

```release-note
Prevents a `kubectl delete` hang when deleting controller managed lists
```

@kubernetes/sig-cli-maintainers
2018-06-22 10:31:24 -07:00
David Eads 2c514b5b1d delete should tolerate a failed wait because of missing verbs 2018-06-22 09:08:51 -04:00
David Eads 0e3f921457 make sure delete waiting doesn't re-evaluate the resource lists 2018-06-22 08:54:00 -04:00
Kubernetes Submit Queue 3a7c3d387c
Merge pull request #65326 from deads2k/cli-75-fix-printer-check
Automatic merge from submit-queue (batch tested with PRs 65290, 65326, 65289, 65334, 64860). 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 printer check to tolerate vendoring

After you've vendored code, the package includes a vendor dir.  This updates the code to tolerate that.

/assign @soltysh @juanvallejo 


```release-note
NONE
```
2018-06-22 04:43:06 -07:00
Kubernetes Submit Queue 570760dbe2
Merge pull request #65128 from brendandburns/kubectl
Automatic merge from submit-queue (batch tested with PRs 65116, 61718, 65140, 65128, 65099). 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>.

Detect a missing key error and print a cleaner message.

Closes https://github.com/kubernetes/kubernetes/issues/63247

@kubernetes/sig-cli-bugs
2018-06-21 13:59:15 -07:00
Kubernetes Submit Queue 02dba36128
Merge pull request #65019 from mirake/fix-typo-toto
Automatic merge from submit-queue (batch tested with PRs 65265, 64822, 65026, 65019, 65077). 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>.

Typo fix: toto -> to
2018-06-21 11:25:16 -07:00
David Eads 6dd9d1fff7 fix printer check to tolerate vendoring 2018-06-21 13:33:59 -04:00
Kubernetes Submit Queue 1cbb61f8a2
Merge pull request #64938 from brendandburns/todo2
Automatic merge from submit-queue (batch tested with PRs 64895, 64938, 63700, 65050, 64957). 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 an old TODO.

The ImagePullPolicy is immediately overwritten by the call to `updatePodSpec` below the initialization, so it's not needed where it is.
2018-06-21 04:15:08 -07:00
WanLinghao f243663519 fix a log param error 2018-06-21 15:31:19 +08:00
Xianglin Gao 7398219549 improve kubectl completion help
Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
2018-06-21 14:42:33 +08:00
Kubernetes Submit Queue 7720c40cb9
Merge pull request #64773 from MasayaAoyama/add-port-foward-examples
Automatic merge from submit-queue (batch tested with PRs 58690, 64773, 64880, 64915, 64831). 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 port-forward examples for sevice

add port-forward examples for sevice

```
$  kubectl port-forward --help

........
Examples:
  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
  kubectl port-forward pod/mypod 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
deployment
  kubectl port-forward deployment/mydeployment 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
service
  kubectl port-forward service/myservice 5000 6000

  # Listen on port 8888 locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod 8888:5000

  # Listen on a random port locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod :5000
........
```



**What this PR does / why we need it**:
add port-forward examples for sevice

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

**Special notes for your reviewer**:

**Release note**:

```release-note
add port-forward examples for sevice
```
2018-06-20 14:21:14 -07:00
Kubernetes Submit Queue debc5387fe
Merge pull request #63747 from wgliang/master.test.kubectl
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>.

use subtest for table units (pkg/kubectl)

**What this PR does / why we need it**:
Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Many table-driven tests in pkg/kubectl are not using this feature.

/kind cleanup
/area kubectl

Further reading: [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)


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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-20 12:39:21 -07:00
Kubernetes Submit Queue 8a1e83050d
Merge pull request #64389 from yue9944882/top-nodes-print-missing-metrics
Automatic merge from submit-queue (batch tested with PRs 64882, 64692, 64389, 60626, 64840). 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>.

print nodes for those metrics is somehow unreachable

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

When we use `kubectl top nodes`, some nodes will be ignored when their metrics cannot be fetched from metrics serve. It might be misleading for users.

This PR helps print the missing nodes like:

```
NAME                CPU(cores)   CPU%      MEMORY(bytes)   MEMORY%  
missing-nodes       -            -         -               -
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes missing nodes lines when kubectl top nodes
```
2018-06-20 10:03:27 -07:00
Kubernetes Submit Queue d9272f8cba
Merge pull request #56358 from liggitt/rbac-alternate-authorizer
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). 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>.

Switch RBAC escalation check to use active authorizer

Closes #43409

```release-note
All configured authorizers are now checked to determine if an RBAC role or clusterrole escalation (setting permissions the user does not currently have via RBAC) is allowed.
```
2018-06-20 05:48:23 -07:00
Kubernetes Submit Queue 2fa32e717b
Merge pull request #64504 from wgliang/master.fix-format
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). 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>.

Errorf format %q has arg b.labelSelector of wrong type *string

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

Errorf format %q has arg b.labelSelector of wrong type *string

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-20 05:48:15 -07:00
Kubernetes Submit Queue 5e31112d69
Merge pull request #64541 from mrogers950/additive-flag
Automatic merge from submit-queue (batch tested with PRs 63580, 63744, 64541, 64502, 64100). 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 more kubectl auth reconcile flags

```release-note
The --remove-extra-subjects and --remove-extra-permissions flags have been enabled for kubectl auth reconcile
```
/assign @deads2k 
cc @enj @juanvallejo
2018-06-20 01:27:36 -07:00
Kubernetes Submit Queue e1cc1fce2a
Merge pull request #64378 from wrdls/evict-timeout
Automatic merge from submit-queue (batch tested with PRs 64252, 64307, 64163, 64378, 64179). 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 kubectl drain --timeout option when eviction is used

**What this PR does / why we need it**:
Timeout option of kubectl drain command is currently broken when using eviction to delete pods.

A new timer is made on each for loop iteration which means it gets reset each time a pod is evicted.

**Release note**:
```release-note
Fix kubectl drain --timeout option when eviction is used.
```

@kubernetes/sig-cli-pr-reviews
2018-06-19 21:45:17 -07:00
Kubernetes Submit Queue c46a667fac
Merge pull request #63698 from rajatjindal/fix-eviction-errormsg
Automatic merge from submit-queue (batch tested with PRs 65230, 57355, 59174, 63698, 63659). 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 msg when getting toomanyrequest error from evict pod

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

When Pod Disruption Budget prevents eviction of pods, the error msg is not exposed to the user

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

Fixes https://github.com/kubernetes/kops/issues/5066

**Special notes for your reviewer**:

Multiple people reported hung cluster update due to this issue, its confusing for them as the error msg is not exposed. 

**Release note**:

```release-note
NONE
```
2018-06-19 20:19:21 -07:00
Brendan Burns e3d2242388 Detect a missing key error and print a cleaner message. 2018-06-14 21:52:51 -07:00
Kubernetes Submit Queue b05a61e299
Merge pull request #65030 from deads2k/cli-74-experimental
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>.

mark kubectl wait as experimental

Per @smarterclayton comment in https://github.com/kubernetes/kubernetes/pull/64034

/assign @smarterclayton
2018-06-12 16:12:52 -07:00
David Eads 4a180331a9 mark kubectl wait as experimental 2018-06-12 15:51:43 -04:00
Kubernetes Submit Queue 7e41ab4ed3
Merge pull request #64768 from krzysied/scale_retries
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>.

Adding scale error retries

**What this PR does / why we need it**:
ScaleWithRetries will retry all retryable errors, not only conflict error.
ref #63030

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-12 09:31:46 -07:00
ruicao 95c232ee07 Typo fix: toto -> to 2018-06-12 23:12:39 +08:00
Krzysztof Siedlecki 8a3c2dcc6d Adding scale error retries 2018-06-12 11:23:16 +02:00
Brendan Burns 84dd19eb23 Remove an old TODO. 2018-06-11 13:04:32 -07:00
Rajat Jindal 08b92fff03 add msg when getting toomanyrequest error from evict pod 2018-06-08 07:01:14 -07:00
Jordan Liggitt 1034efd439
Allow non-RBAC authorizers to participate in role/clusterrole escalation checks 2018-06-06 15:31:05 -04:00
Janet Kuo 710d524b98 Add TODO for removing kubectl DaemonSet deletion hack 2018-06-06 11:11:35 -07:00
Janet Kuo fedd5d6206 Revert "Remove hack in kubectl delete that handles DaemonSet deletion"
This reverts commit 10a12ddb34.
2018-06-06 11:01:35 -07:00
Kubernetes Submit Queue 296bc64924
Merge pull request #64797 from janetkuo/ds-deletion
Automatic merge from submit-queue (batch tested with PRs 64749, 64797). 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>.

Handle deleted DaemonSet properly

**What this PR does / why we need it**:
After kubectl reapers are removed (#63979) and foreground deletion are used, DaemonSet controller may race with garbage collector when it tries to update DaemonSet status of the DaemonSet being deleted. 

Here's what happened:
1. Someone/something performs a foreground deletion on a DaemonSet
1. DaemonSet finalizer and DeletionTimestamp are both set
1. DaemonSet history objects (ControllerRevisions) and pods are being deleted by garbage collector; meanwhile, DaemonSet controller tries to update DaemonSet status. 
    * Updating DaemonSet status requires constructing DaemonSet history objects, to figure out current revision and which pods do/don't belong to current revision
1. When updating DaemonSet status, DaemonSet controller tries to create a DaemonSet history object that matches current DaemonSet spec
1. Garbage collector then tries to delete that DaemonSet history object. And repeat. 

Because we can't make DaemonSet pods be deleted before DaemonSet history objects (DaemonSet history objects don't own DaemonSet pods!), we cannot reliably calculate DaemonSet status without history objects anyways. Therefore, we don't update DaemonSet status for DaemonSet being deleted. 

Note that the reason why the kubectl delete hack works is because it forces DaemonSet pods to be removed before history objects. 

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-06 10:08:16 -07:00
Kubernetes Submit Queue bf422b7b04
Merge pull request #64371 from CaoShuFeng/invalid_o
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 kubectl -o

Fix kubectl -o error message:
Before this change:
```
kubectl get pods -o foo
error: unable to match a printer suitable for the output format "" and the options specified: &get.PrintFlags{JSONYamlPrintFlags:(*genericclioptions.JSONYamlPrintFlags)(0x23aa610), NamePrintFlags:(*genericclioptions.NamePrintFlags)(0xc42058b4e0), TemplateFlags:(*printers.KubeTemplatePrintFlags)(0xc4206765e0), CustomColumnsFlags:(*printers.CustomColumnsPrintFlags)(0xc420676620), HumanReadableFlags:(*get.HumanPrintFlags)(0xc4204eb180), NoHeaders:(*bool)(0xc4206fefbc), OutputFormat:(*string)(0xc42058b4d0)}
```

After this change:
```
Kubectl get pods -o foo
error: unable to match a printer suitable for the output format "foo", allowed formats are: json,yaml,name,template,go-template,go-template-file,templatefile,jsonpath,jsonpath-file,custom-columns-file,custom-columns,wide
```



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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
kubectl will list all allowed print formats when an invalid format is passed.
```
2018-06-06 04:15:56 -07:00
Janet Kuo 10a12ddb34 Remove hack in kubectl delete that handles DaemonSet deletion 2018-06-05 17:03:54 -07:00
MasayaAoyama bd3534c6d3 add port-forward examples for sevice
add port-forward examples for sevice

```
$  kubectl port-forward --help

........
Examples:
  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
  kubectl port-forward pod/mypod 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
deployment
  kubectl port-forward deployment/mydeployment 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
service
  kubectl port-forward service/myservice 5000 6000

  # Listen on port 8888 locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod 8888:5000

  # Listen on a random port locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod :5000
........
```

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

**What this PR does / why we need it**:
add port-forward examples for sevice

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

**Special notes for your reviewer**:

**Release note**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
add port-forward examples for sevice
```
2018-06-06 00:04:44 +09:00
Kubernetes Submit Queue fa20f87f1f
Merge pull request #59579 from fbac/kubectl-cani-exitcode
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 exit code 1 on not allowed to kubectl auth can-i

What this PR does / why we need it:
kubectl auth can-i verb resource always returns 0 status, even if the user can't <verb> <resource>

With this commit, kubectl will return exit code 1 when a verb is not allowed. It doesn't affect quiet option.

Release note:
```release-note
Fix kubectl auth can-i exit code. It will return 1 if the user is not allowed and 0 if it's allowed.
```
2018-06-05 07:01:06 -07:00
Kubernetes Submit Queue b81a192a84
Merge pull request #64608 from dixudx/config_view_context
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>.

apply global flag "context" for kubectl config view

**What this PR does / why we need it**:
`--context` is a global flag, which should be applied to `kubectl config view` as well when minifying.

Currently this command is only available for `current-context`. With this PR, it will be easier for users to view other non current contexts when minifying.

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

**Special notes for your reviewer**:
/cc soltysh juanvallejo 
 
**Release note**:

```release-note
apply global flag "context" for kubectl config view --minify
```
2018-06-05 06:05:49 -07:00
Cao Shufeng 995c5a07ea fix kubectl -o
Fix kubectl -o error message:
Before this change:
```shell
kubectl get pods -o foo
error: unable to match a printer suitable for the output format "" and the options specified: &get.PrintFlags{JSONYamlPrintFlags:(*genericclioptions.JSONYamlPrintFlags)(0x23aa610), NamePrintFlags:(*genericclioptions.NamePrintFlags)(0xc42058b4e0), TemplateFlags:(*printers.KubeTemplatePrintFlags)(0xc4206765e0), CustomColumnsFlags:(*printers.CustomColumnsPrintFlags)(0xc420676620), HumanReadableFlags:(*get.HumanPrintFlags)(0xc4204eb180), NoHeaders:(*bool)(0xc4206fefbc), OutputFormat:(*string)(0xc42058b4d0)}
```

After this change:
```shell
Kubectl get pods -o foo
error: unable to match a printer suitable for the output format "aaa", allowed formats are: custom-columns,custom-columns-file,go-template,go-template-file,json,jsonpath,jsonpath-file,name,template,templatefile,wide,yaml
```
2018-06-05 19:49:07 +08:00
bruceauyeung 4a43310275
kubectl cp support colons-in-filename 2018-06-05 10:16:40 +02:00
Kubernetes Submit Queue d373eaa4f3
Merge pull request #63724 from ravisantoshgudimetla/priority-e2e-beta
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>.

Modify e2e tests to use priorityClass beta client version & switch priorityClass to beta

**What this PR does / why we need it**:
/cc @bsalamat @aveshagarwal @liggitt 

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

**Special notes for your reviewer**:
Once #57963 merges, this could go in.

**Release note**:

```release-note
Modify e2e tests to use priorityClass beta version & switch priorityClass feature to beta
```
2018-06-04 23:07:34 -07:00
Kubernetes Submit Queue 6acfda8a85
Merge pull request #64573 from juanvallejo/jvallejo/remove-extraneous-path-shortcuts
Automatic merge from submit-queue (batch tested with PRs 64613, 64596, 64573, 64154, 64639). 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 extra "../" when copying from pod to local

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

Copying via `kubectl cp` from a pod to local will no longer panic if any received tar headers contain an extra "../". This can happen when specifying a remote location beyond "/" - for example:

```
# I am attempting to go backwards beyond "/"
$ kubectl cp mypod:/one/two/../../../etc/hosts ./
```

The above command results in a tar header containing an extra "../" in its name (../etc/hosts), causing a panic [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cp.go#L388).

Related downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1584555

cc @soltysh
2018-06-02 06:30:16 -07:00
Kubernetes Submit Queue c3bb41ad4b
Merge pull request #64596 from apelisse/openapi-some-cleanup
Automatic merge from submit-queue (batch tested with PRs 64613, 64596, 64573, 64154, 64639). 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>.

Openapi some cleanup

Clean-up some OpenAPI code, mostly test related (there are two implementations of "Fake").
This is going for master, but I'll probably also cherry-pick/create a similar PR for feature-serverside-apply branch since we'll need that to move some code around.

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-02 06:30:13 -07:00
Di Xu acabdcb96a apply global flag "context" for kubectl config view 2018-06-02 13:31:58 +08:00
Antoine Pelisse 000510d9b7 Replace openapi Fake with kube-openapi version
There are two version of this fake class, let's just use that one
version.
2018-06-01 09:50:05 -07:00
Antoine Pelisse 178a8f87f3 openapi: Remove FakeClient from testing library
And make a simplified version of it where needed.
2018-05-31 13:44:08 -07:00
juanvallejo dca6912c54
remove extra "../" when copying from pod to local 2018-05-31 16:22:24 -04:00
Matt Rogers 9f3b97572a Add more kubectl auth reconcile flags
Adds --remove-extra-permissions and --remove-extra-subjects

Signed-off-by: Matt Rogers <mrogers@redhat.com>
2018-05-31 12:16:49 -04:00
Guoliang Wang 761cf41427 Move pkg/scheduler/schedulercache -> pkg/scheduler/cache 2018-05-31 22:55:34 +08:00
Kubernetes Submit Queue 595059bb65
Merge pull request #62991 from tomoe/cronjob-prune
Automatic merge from submit-queue (batch tested with PRs 64281, 62991). 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>.

Whitelist CronJob for kubectl apply --prune

**What this PR does / why we need it**:
Support CronJob for kubectl apply --prune

**Special notes for your reviewer**: N/A

**Release note**:

```release-note
kubectl apply --prune supports CronJob resource. 
```
2018-05-30 13:24:09 -07:00
Kubernetes Submit Queue 65573739fe
Merge pull request #64516 from soltysh/fix_error
Automatic merge from submit-queue (batch tested with PRs 64318, 64269, 64438, 64516, 64311). 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 error message to be consistent with others

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

**Release note**:
```release-note
NONE
```
2018-05-30 11:25:25 -07:00
Kubernetes Submit Queue 990892184f
Merge pull request #64438 from dixudx/cli_rollout_name
Automatic merge from submit-queue (batch tested with PRs 64318, 64269, 64438, 64516, 64311). 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>.

include rollout object name in cli message

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

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

**Special notes for your reviewer**:
/cc soltysh 
 
**Release note**:

```release-note
None
```
2018-05-30 11:25:21 -07:00
Kubernetes Submit Queue 75517f60b9
Merge pull request #64458 from mrogers950/reconcile-dryrun-additive
Automatic merge from submit-queue (batch tested with PRs 64322, 64210, 64458, 64232, 64370). 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 dry-run flag to auth reconcile

```release-note
The --dry-run flag has been enabled for kubectl auth reconcile
```
/assign @juanvallejo 
cc @enj
2018-05-30 10:09:11 -07:00
Kubernetes Submit Queue 6b2172741d
Merge pull request #64453 from deads2k/cli-73-resourcebuidlerflags
Automatic merge from submit-queue (batch tested with PRs 63328, 64316, 64444, 64449, 64453). 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 resource builder flags API

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

This pull expands the utility of the resource builder flags and demonstrates a second use-case with `kubectl set selector`.

@kubernetes/sig-cli-maintainers 
/assign @juanvallejo 
/assign @soltysh 

```release-note
NONE
```
2018-05-30 08:42:29 -07:00
Kubernetes Submit Queue 1123e5dd82
Merge pull request #64449 from deads2k/cli-72-scrub
Automatic merge from submit-queue (batch tested with PRs 63328, 64316, 64444, 64449, 64453). 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>.

cleanup some dead kubectl code and narrow scope of helpers

Found a lot of dead code in kubectl factory that we should scrub out


/assign @soltysh 
/assign @juanvallejo 


```release-note
NONE
```
2018-05-30 08:42:24 -07:00
Kubernetes Submit Queue 1e0973db3f
Merge pull request #64444 from deads2k/cli-71-delete-change
Automatic merge from submit-queue (batch tested with PRs 63328, 64316, 64444, 64449, 64453). 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 the delete result being used

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

@nilebox pretty sure this will fix you.  Do you have an easy test to add to test-cmd?


@kubernetes/sig-cli-bugs 
/kind bug
/assign @nilebox 
/assign @soltysh 

```release-note
NONE
```
2018-05-30 08:42:20 -07:00
Maciej Szulik e7e1918b11
Fix error message to be consistent with others 2018-05-30 16:41:50 +02:00
Guoliang Wang 76059f874f Errorf format %q has arg b.labelSelector of wrong type *string 2018-05-30 17:51:17 +08:00
yue9944882 64ec40092d review: s/<unknown>/-/ 2018-05-30 12:14:11 +08:00
Matt Rogers 20cd94de17 Add dry-run to auth reconcile
Signed-off-by: Matt Rogers <mrogers@redhat.com>
2018-05-29 16:28:46 -04:00
David Eads 4b836d77d5 update set selector to use resource builder flags 2018-05-29 12:47:19 -04:00
David Eads 207e9d1d90 cleanup some dead kubectl code and narrow scope of helpers 2018-05-29 12:44:53 -04:00
Monis Khan 631124cde4
Correctly apply request transforms with flattened resource builder
This change moves the NewClientWithOptions call into
Builder.getClient.  Since getClient is the only way for Builder and
its visitors to create a RESTClient, we can reasonably guarantee
that the request transforms will be honored.  Previously, it was
possible for a call to NewFlattenListVisitor to return resource Info
objects whose Client field did not honor the request transforms.

Signed-off-by: Monis Khan <mkhan@redhat.com>
2018-05-29 12:22:57 -04:00
leigh schrandt 1f12b1cb3d Correct image in `kubectl help run` 2018-05-29 10:15:48 -06:00
David Eads 9c5bdd4b5c add resource builder flags 2018-05-29 10:46:54 -04:00
David Eads cb09607536 fix the delete result being used 2018-05-29 08:34:47 -04:00
Kubernetes Submit Queue 07e6410cf7
Merge pull request #64375 from nilebox/delete-wait-cleanup
Automatic merge from submit-queue (batch tested with PRs 64300, 64375). 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>.

Declare kubectl wait flag in a way consistent with other deletion flags

**What this PR does / why we need it**:
A follow up PR for #64034 and #63979 that makes declaring wait flag consistent with the other flags.

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

**Special notes for your reviewer**:

**Release note**:

```release-note

```
2018-05-29 04:22:10 -07:00
Di Xu 1b1c2d1264 include rollout object name in cli message 2018-05-29 18:07:41 +08:00
Kubernetes Submit Queue 4a7a18653c
Merge pull request #63885 from soltysh/get_unmarshal
Automatic merge from submit-queue (batch tested with PRs 64392, 63885). 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 unnecessary roundtripping in get.go

/assign @deads2k @juanvallejo 

**Release note**:
```release-note
NONE
```
2018-05-29 00:28:14 -07:00
Nail Islamov 6f1b178ed7
Declare wait flag in way consistent with other deletion flags 2018-05-29 08:19:06 +10:00
David Eads c85e69aeb9
remove unnecessary factory delegation for RESTClientGetter method 2018-05-28 15:12:41 +02:00
yue9944882 dc2184f69f print nodes for those metrics is somehow unreachable 2018-05-28 17:12:37 +08:00
juanvallejo b4af3a4ffb
move filename flags to genericclioptions 2018-05-28 11:09:51 +02:00
juanvallejo d463bbddb1
move resource builder flags to genericclioptions 2018-05-28 11:08:58 +02:00
Kubernetes Submit Queue b9e46f5422
Merge pull request #64374 from deads2k/scale-client
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 scaleClient from factory

rebase https://github.com/kubernetes/kubernetes/pull/64287

```release-note
NONE
```
2018-05-27 13:03:21 -07:00
Ward Loos e1e0591364 Don't reset global timeout on each for loop iteration 2018-05-27 20:26:37 +02:00
Maciej Szulik 7495ab5229 Remove Generators from Factory 2018-05-27 11:14:05 -04:00
juanvallejo 3895887f5e move scaleClient from factory 2018-05-27 11:07:36 -04:00
Guoliang Wang bae074ef38 use subtest for table units (pkg/kubectl) 2018-05-27 10:04:55 +08:00
David Eads 4815ec409f collapse into one factory 2018-05-26 18:47:44 -04:00
Kubernetes Submit Queue 5f578f3385
Merge pull request #63979 from soltysh/drop_reapers
Automatic merge from submit-queue (batch tested with PRs 63859, 63979). 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>.

Drop reapers

/assign @deads2k @juanvallejo 

**Release note**:
```release-note
kubectl delete does not use reapers for removing objects anymore, but relies on server-side GC entirely
```
2018-05-26 00:32:11 -07:00
Maciej Szulik b8b4c7c81b
Handle DaemonSet removal the old way 2018-05-25 22:18:10 +02:00
Maciej Szulik 383872615d
Remove kubectl reapers 2018-05-25 22:18:05 +02:00
Kubernetes Submit Queue a176a8b1b7
Merge pull request #64134 from wgliang/master.remove-from-factory2
Automatic merge from submit-queue (batch tested with PRs 63232, 64257, 64183, 64266, 64134). 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 SuggestedPodTemplateResources from factory to set_resources

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

Move SuggestedPodTemplateResources from factory to set_resources

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

**Special notes for your reviewer**:

/cc @juanvallejo
**Release note**:

```release-note
NONE
```
2018-05-25 08:24:25 -07:00
Kubernetes Submit Queue f33aed89d1
Merge pull request #64183 from WanLinghao/ctl_set_subject_fix
Automatic merge from submit-queue (batch tested with PRs 63232, 64257, 64183, 64266, 64134). 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 kubectl set subject --all option invalid bug

**What this PR does / why we need it**:
Fix the kubectl set subject --all option invalid bug and add test cases for it
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #64182

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-25 08:24:19 -07:00
Kubernetes Submit Queue 7a7ab200ee
Merge pull request #64242 from WanLinghao/ctl_print_fix
Automatic merge from submit-queue (batch tested with PRs 63417, 64249, 64242, 64128, 64275). 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 bugs that break processing when printing errors occur in kubectl

**What this PR does / why we need it**:
The process should continue when error happens, this patch fix the problem
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-24 20:49:15 -07:00
Guoliang Wang 3bc8b09e78 Move SuggestedPodTemplateResources from factory to set_resources 2018-05-25 11:00:01 +08:00
Kubernetes Submit Queue ac58ee4ca5
Merge pull request #64233 from juanvallejo/jvallejo/move-describer-out-of-factory
Automatic merge from submit-queue (batch tested with PRs 63319, 64248, 64250, 63890, 64233). 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 Describer from factory

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

Moves `Describer` out of the object_mapping_factory

cc @soltysh @deads2k
2018-05-24 19:46:21 -07:00
Kubernetes Submit Queue 9de1db7c0a
Merge pull request #63890 from mgugino-upstream-stage/kubectl-cp-add-tests
Automatic merge from submit-queue (batch tested with PRs 63319, 64248, 64250, 63890, 64233). 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>.

Additional test coverage for kubectl/cmd/cp

This commit adds some additional test coverage
for the kubectl cp command.

**Release note**:

```release-note
NONE
```
2018-05-24 19:46:18 -07:00
Kubernetes Submit Queue 5c226acc29
Merge pull request #64127 from WanLinghao/use_go_library
Automatic merge from submit-queue (batch tested with PRs 64127, 63895, 64066, 64215, 64202). 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>.

convert Duration into seconds by go library function

**What this PR does / why we need it**:
Here we try convert time.Duration  into int64 seconds. I think it's better to use golang library function,
https://golang.org/pkg/time/#Duration.Round

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-24 10:45:11 -07:00
David Eads 6d117383fc fix describer tests 2018-05-24 10:50:49 -04:00
juanvallejo cf29a30258 move Describer from factory 2018-05-24 09:43:28 -04:00
Kubernetes Submit Queue bebc5c1c4f
Merge pull request #64132 from wgliang/master.remove-from-factory1
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 unrelated methods from the factory to helper

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

Move unrelated methods from the factory to helper

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


**Special notes for your reviewer**:

/cc @juanvallejo

**Release note**:

```release-note
NONE
```
2018-05-24 05:39:08 -07:00
Guoliang Wang cf86cb77eb Move unrelated methods from the factory to helper 2018-05-24 11:42:26 +08:00
Kubernetes Submit Queue 195914d02a
Merge pull request #64013 from hzxuzhonghu/rm-duplicate
Automatic merge from submit-queue (batch tested with PRs 64013, 63896, 64139, 57527, 62102). 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 uses its own pkg/kubectl/util/logs

kubectl uses its own logs instead of  `staging/src/k8s.io/apiserver/pkg/util/logs`

**Release note**:

```release-note
NONE
```
2018-05-23 19:44:12 -07:00
WanLinghao b020a4ba8c fix bugs that break processing when printing errors occur in kubectl 2018-05-24 09:57:25 +08:00
WanLinghao ddbd9d20cb fix kubectl set subject --all option invalid bug 2018-05-24 09:17:06 +08:00
Kubernetes Submit Queue 5fe35cdbf9
Merge pull request #61419 from enisoc/apps-v1-deploy
Automatic merge from submit-queue (batch tested with PRs 62756, 63862, 61419, 64015, 64063). 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 apps/v1 Deployment/ReplicaSet in controller and kubectl

This updates the Deployment controller and integration/e2e tests to use apps/v1, as part of #55714.

This also requires updating any other components that use the `deployment/util` package, most notably `kubectl`. That means client versions 1.11 and above will only work with server versions 1.9 and above. This is well within our client-server version skew policy of +/-1 minor version.

However, this PR *only* updates the parts of `kubectl` that used `deployment/util`. So although kubectl now requires apps/v1, it still also depends on extensions/v1beta1. Migrating other parts of kubectl to apps/v1 is beyond the scope of this PR, which was just to change the Deployment controller and fix all the fallout.

```release-note
kubectl: This client version requires the `apps/v1` APIs, so it will not work against a cluster version older than v1.9.0. Note that kubectl only guarantees compatibility with clusters that are +/-1 minor version away.
```
2018-05-23 18:14:13 -07:00
Kubernetes Submit Queue 420071d86e
Merge pull request #60636 from PhilipGough/keys-from-cm-patch
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 env from resource with keys & updated tests

**What this PR does / why we need it**:
This change allows users to pull environment from specific keys in secrets and configmaps using the `kubectl set env` command. User can provide a list of comma-separated keys with the `--keys` flag.

This can be useful when a number of applications want to share a configuration object but don't want to pollute a resource with unused environment

Improves test coverage of set env command

**Release note**:

```
Allow kubectl set env to specify which keys to import from a resource
```
2018-05-23 15:51:01 -07:00
Kubernetes Submit Queue b143093a62
Merge pull request #64111 from juanvallejo/jvallejo/move-more-helpers
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 CanBeExposed helper from factory_client_access

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

Moves additional helpers from the "factory_client_access". Continues work from https://github.com/kubernetes/kubernetes/pull/63984 and https://github.com/kubernetes/kubernetes/pull/63884

Moves CanBeExposed from factory_client_access.

cc @soltysh
2018-05-23 13:50:02 -07:00
Kubernetes Submit Queue 6e1727a865
Merge pull request #64114 from juanvallejo/jvallejo/remove-command-method-from-factory
Automatic merge from submit-queue (batch tested with PRs 59851, 64114, 63912, 64156, 64191). 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 f.Command out of the factory

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

Moves the "f.Command" method out of factory_client_access

cc @soltysh
2018-05-23 09:06:11 -07:00
juanvallejo b6db623799 move rollbacker from the factory 2018-05-23 10:44:01 -04:00
juanvallejo fb0794976a move Pauser and Resumer from the factory 2018-05-23 10:27:20 -04:00
juanvallejo 5f5e3a59c0 move more CanBeExposed from factory_client_access 2018-05-23 10:27:20 -04:00
Nail Islamov 3b5afd8809
Use DeleteOptions.PropagationPolicy instead of OrphanDependents (deprecated) in kubectl 2018-05-23 16:59:53 +10:00
Kubernetes Submit Queue 5fee050734
Merge pull request #64072 from CaoShuFeng/show_kind
Automatic merge from submit-queue (batch tested with PRs 64034, 64072, 64146, 64059, 64161). 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 kubectl get --show-kind

This pull request fix `kubectl get --show-kind`
Before this change:
```json
$ kubectl get pods --show-kind
NAME                    READY     STATUS      RESTARTS   AGE
pi-with-timeout-52sjs   0/1       Completed   0          1d
pi-with-timeout-f5pb5   0/1       Completed   0          1d
```
After this change:
```
$ kubectl get pods --show-kind
NAME                        READY     STATUS      RESTARTS   AGE
pod/pi-with-timeout-52sjs   0/1       Completed   0          1d
pod/pi-with-timeout-f5pb5   0/1       Completed   0          1d
```


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

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

**Special notes for your reviewer**:
/assign @soltysh 
**Release note**:

```release-note
NONE
```
2018-05-22 19:20:15 -07:00
Kubernetes Submit Queue f9c8898116
Merge pull request #64034 from deads2k/cli-62-wait
Automatic merge from submit-queue (batch tested with PRs 64034, 64072, 64146, 64059, 64161). 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 kubectl wait

Adds a `kubectl wait --for=[delete|condition=condition-name] resource/string` command.  This allows generic waiting on well behaved conditions and for a resource or set of resources to be deleted.

This was requested for delete to do foreground deletion

WIP because I need to add test cases.


@kubernetes/sig-cli-maintainers this is using a separation of concerns made possible by the genericclioptions to make an easily unit testable command.
@smarterclayton 

```release-note
adds a kubectl wait command
```
2018-05-22 19:20:12 -07:00
Kubernetes Submit Queue c5bd053a6f
Merge pull request #64116 from deads2k/cli-64-portsforobj
Automatic merge from submit-queue (batch tested with PRs 63914, 63887, 64116, 64026, 62933). 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 portsforobject from factory

Removes another non-factory method out.

/assign @juanvallejo

```release-note
NONE
```
2018-05-22 17:36:15 -07:00
Kubernetes Submit Queue cecbbad128
Merge pull request #63914 from superbrothers/completion-init-containers
Automatic merge from submit-queue (batch tested with PRs 63914, 63887, 64116, 64026, 62933). 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 initContainers into completion suggestions for kubectl logs/attach

**What this PR does / why we need it**: This PR improves autocomplete of kubectl logs/attach to add initContainers into completion suggestions in addition to containers.

```
$ cat <<EOL | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
spec:
  initContainers:
  - name: init-myservice
    image: busybox
    command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
  - name: init-mydb
    image: busybox
    command: ['sh', '-c', 'until nslookup mydb; do echo waiting for mydb; sleep 2; done;']
  containers:
  - name: myapp-container
    image: busybox
    command: ['sh', '-c', 'echo The app is running! && sleep 3600']
EOL
$ kubectl logs myapp-pod <tab><tab>
init-mydb        init-myservice   myapp-container
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-22 17:36:09 -07:00
Anthony Yeh 1c531fc970
kubectl: Use apps/v1 Deployment/ReplicaSet.
This is necessary since kubectl shares code with the controllers,
and the controllers have been updated to use apps/v1.
2018-05-22 13:43:06 -07:00
juanvallejo 0d3e85608f move f.Command out of the factory 2018-05-22 13:31:01 -04:00
Kubernetes Submit Queue 2ff0bc2b8a
Merge pull request #63967 from deads2k/rbac-06-external
Automatic merge from submit-queue (batch tested with PRs 62025, 63851, 64077, 63967, 63991). 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>.

switch rbac to external

The overall trajectory of the project is towards external types.  Having all helpers agree on the version they operate on makes life much easier.  We've already written one RBAC controller (role aggregation) and more may follow.  `v1` has been around for a while now and we know that any future changes have to reliably roundtrip through it.  This pull switches all the core helpers over to use the external types.

@kubernetes/sig-auth-pr-reviews 

```release-note
`kubectl auth reconcile` only works with rbac.v1
```
2018-05-22 08:40:26 -07:00
Kubernetes Submit Queue 220d16edc0
Merge pull request #64077 from CaoShuFeng/get_test
Automatic merge from submit-queue (batch tested with PRs 62025, 63851, 64077, 63967, 63991). 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 one duplicated unit test

Unit test `TestGetAllListObjects` is exactly the same with unit test `TestGetListObjects`.



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

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

**Special notes for your reviewer**:
/assign @soltysh 
**Release note**:
```release-note
NONE
```
2018-05-22 08:40:23 -07:00
Kubernetes Submit Queue 007e936c6d
Merge pull request #63851 from WanLinghao/ctl_create_aggegated_rules
Automatic merge from submit-queue (batch tested with PRs 62025, 63851, 64077, 63967, 63991). 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 kubectl could create clusterrole with aggregation rules

**What this PR does / why we need it**:
The clusterrole aggregation rule features are available since v1.9:
https://kubernetes.io/docs/admin/authorization/rbac/#aggregated-clusterroles
This patch makes kubectl could create clusterrole with aggregation rules.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-22 08:40:20 -07:00
Kubernetes Submit Queue 48b5fd9182
Merge pull request #62025 from hanxiaoshuai/bugfix0402
Automatic merge from submit-queue (batch tested with PRs 62025, 63851, 64077, 63967, 63991). 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>.

check error when parse field failed

**What this PR does / why we need it**:
check error when parse field failed
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-22 08:40:16 -07:00
David Eads 043f66b86e remove portsforobject from factory 2018-05-22 09:09:55 -04:00
David Eads 49258593c3 add a discarding printer for testing and delegation 2018-05-22 08:47:42 -04:00
David Eads 76794643c5 add wait 2018-05-22 08:47:42 -04:00
David Eads 092714ea0f switch rbac to external 2018-05-22 08:17:05 -04:00
PhilipGough 027d15e58c
Allow env from resource with keys & updated tests 2018-05-22 09:04:45 +01:00
Kubernetes Submit Queue a0036fcae1
Merge pull request #64113 from juanvallejo/jvallejo/remove-uneeded-factory-methods
Automatic merge from submit-queue (batch tested with PRs 63151, 63795, 63553, 64068, 64113). 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 LabelsForObject and ResolveImage from factory

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

Removes the `ResolveImage` and `LabelsForObject` methods from factory_client_access, which are not needed.

cc @soltysh
2018-05-21 21:41:24 -07:00
xuzhonghu 46d8cf23ef kubectl use its own logs 2018-05-22 11:35:38 +08:00
WanLinghao 7026f23cd2 convert Duration into seconds by go library function 2018-05-22 10:50:47 +08:00
Cao Shufeng a1bba62202 fix kubectl get --show-kind 2018-05-22 10:41:27 +08:00
Kubernetes Submit Queue 8cccc022b0
Merge pull request #64118 from deads2k/cli-65-podspec
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 updatepodspecforobject out of factory

Updating a podspec is a polymorphic helper, but it isn't a factory method.

@kubernetes/sig-cli-maintainers 
/assign @juanvallejo 

```release-note
NONE
```
2018-05-21 18:42:37 -07:00
David Eads 087140aee9 move updatepodspecforobject out of factory 2018-05-21 17:56:33 -04:00
juanvallejo 8fc0bfd287 remove LabelsForObject and ResolveImage from factory 2018-05-21 16:30:46 -04:00
juanvallejo d1603c9560 move PrintOptions to genericclioptions 2018-05-21 14:59:41 -04:00
Cao Shufeng 188b2bfabd remove one duplicated unit test 2018-05-21 10:33:49 +08:00
Kubernetes Submit Queue bdac43b635
Merge pull request #63984 from juanvallejo/jvallejo/move-more-helpers-from-factory
Automatic merge from submit-queue (batch tested with PRs 63770, 63776, 64001, 64028, 63984). 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 additional helpers from the factory

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

~~Builds on https://github.com/kubernetes/kubernetes/pull/63927~~

cc @deads2k @soltysh
2018-05-19 02:11:39 -07:00
Kubernetes Submit Queue 25c36876a2
Merge pull request #64028 from soltysh/job_scaler
Automatic merge from submit-queue (batch tested with PRs 63770, 63776, 64001, 64028, 63984). 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>.

Tolarate negative values when calculating job scale progress

**What this PR does / why we need it**:
It might happen that the job controller will complete a job, but the status will still contain information about active pods which during scale down operation will be giving false (non 0) value in [this calculation](1b950d1e8e/pkg/kubectl/cmd/scalejob/scalejob.go (L147)). To prevent that situation we should tolerate non-zero values there. 

/assign @liggitt 

**Release note**:
```release-note
NONE
```
2018-05-19 02:11:36 -07:00
Kubernetes Submit Queue 8a40e5f77f
Merge pull request #64001 from juanvallejo/jvallejo/sort-on-generic-output
Automatic merge from submit-queue (batch tested with PRs 63770, 63776, 64001, 64028, 63984). 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>.

sort on non-tabular output

**Release note**:

```release-note
NONE
```

Enables sorting objects when printing as json, yaml, etc.

cc @soltysh
2018-05-19 02:11:33 -07:00
juanvallejo c87cd9c0f6 sort on non-tabular output 2018-05-18 14:27:16 -04:00
Kubernetes Submit Queue 08a094ca2e
Merge pull request #63569 from hanxiaoshuai/bugfix0509
Automatic merge from submit-queue (batch tested with PRs 63569, 63918, 63980, 63295, 63989). 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 a small mistake in function getFieldMeta

**What this PR does / why we need it**:
fix a small mistake in function getFieldMeta
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
```
if e, found := ext["x-kubernetes-patch-strategy"]; found {
	strategy, ok := e.(string)
	if !ok {
		return apply.FieldMetaImpl{}, fmt.Errorf("Expected string for x-kubernetes-patch-strategy by got %T", s)
	}
}
```
According the judgment above, I think we should print the type of e.
**Release note**:

```release-note
NONE
```
2018-05-18 09:54:11 -07:00
juanvallejo f3a46cf626 move additional methods from factory 2018-05-18 11:49:02 -04:00
Maciej Szulik 6eb69dfff7
Tolarate negative values when calculating job scale progress 2018-05-18 15:35:37 +02:00
WanLinghao 5e9e3afb2e kubectl: add aggregation rule support to clusterrole 2018-05-18 19:44:23 +08:00
David Eads 420dd9bf66 move type setting into an optional layer above normal printing 2018-05-17 17:22:12 -04:00
juanvallejo 0164605d31 remove versioned printer 2018-05-17 17:20:54 -04:00
Kubernetes Submit Queue 221909540d
Merge pull request #63966 from mfojtik/cli-01-fix-flatten
Automatic merge from submit-queue (batch tested with PRs 63871, 63927, 63966, 63957, 63844). 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: fix Flatten() when used without Latest()

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

If `Flatten()` is used on resource builder the list is not flattened unless the `Latest()` is used in the chain.
We should support `Flatten()` without Latest() as well. For example:

```
$ oc apply -l foo=bar -f /tmp/list.yaml
```
 will fail with:
```
F0517 13:45:07.831195   31795 helpers.go:119] error: object does not implement the Object interfaces
```

**Release note**:
```release-note
NONE
```
2018-05-17 13:40:22 -07:00
David Eads eabfcfaa2b start splitting polymorphic functions out of the factory 2018-05-17 08:55:31 -04:00
David Eads 0db40da909 update factory interface to overlap with lower RESTClientGetter 2018-05-17 08:27:53 -04:00
Michal Fojtik 390b60f103
kubectl: fix Flatten() when used without Latest() 2018-05-17 14:01:42 +02:00
Kubernetes Submit Queue a20964ac43
Merge pull request #63514 from juanvallejo/jvallejo/move-config-flags-genericclioptions
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 config flags to pkg/kubectl/genericclioptions

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

Moves ConfigFlags to `pkg/kubectl/genericclioptions`
~~Depends on https://github.com/kubernetes/kubernetes/pull/63550~~

cc @soltysh @deads2k
2018-05-16 17:40:30 -07:00
Kubernetes Submit Queue 7d9725e9d0
Merge pull request #61227 from apelisse/fix-diff
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>.

diff: Fix broken `Local()` logic

Local and Live functions where doing and returning the same thing,
giving empty results by default. Fix the local function by copying the
objects before fetching the live version.



**What this PR does / why we need it**: Diff prints empty output by default. Fixes it.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubernetes/issues/61145

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-16 13:21:47 -07:00
Antoine Pelisse f2b48a90df diff: Fix broken `Local()` logic
Local and Live functions where doing and returning the same thing,
giving empty results by default. Fix the local function by copying the
objects before fetching the live version.
2018-05-16 10:27:56 -07:00
Kubernetes Submit Queue 44dd0c2431
Merge pull request #63416 from smarterclayton/retry_approve
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>.

Retry certificate approval on conflict errors

We already check preconditions. We were seeing a non-trivial number of conflicts when using the command from automation.

Fixes openshift/origin#19430

@mikedanese @mfojtik
2018-05-16 10:21:44 -07:00
Michael Gugino 442b3fcf00 Additional test coverage for kubectl/cmd/cp
This commit adds some additional test coverage
for the kubectl cp command.
2018-05-16 11:32:14 -04:00
juanvallejo 876629f690 move ConfigFlags to pkg/kubectl/genericclioptions 2018-05-16 11:31:48 -04:00
Kazuki Suda ca26a8b375 Add initContainers into completion suggestions for kubectl logs/attach 2018-05-16 18:27:14 +09:00
Kubernetes Submit Queue 63e9b438d8
Merge pull request #63884 from deads2k/cli-56-factorypruning
Automatic merge from submit-queue (batch tested with PRs 63314, 63884, 63799, 63521, 62242). 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 single use, non-polymorphic helpers from factory

Not all helpers in the factory need to be located there.  This strips several out.

```release-note
NONE
```
2018-05-15 19:55:09 -07:00
Kubernetes Submit Queue c20d7ed989
Merge pull request #63644 from dixudx/cleanup_apiresources
Automatic merge from submit-queue (batch tested with PRs 63589, 63644, 63861, 63872, 63847). 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>.

cleanup kubectl apiresources

**What this PR does / why we need it**:
#42873 introduce this new subcommand.

This PR does
* binding flags to struct
* some code cleanups

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

**Special notes for your reviewer**:
/cc soltysh juanvallejo 

**Release note**:

```release-note
None
```
2018-05-15 17:09:11 -07:00
Maciej Szulik 582128a837
Remove unnecessary roundtripping in get.go 2018-05-15 22:15:23 +02:00
David Eads 4b36c15872 remove single use, non-polymorphic helpers from factory 2018-05-15 15:05:49 -04:00
juanvallejo 57f308ae60 restore old cached client behavior 2018-05-15 10:37:53 -04:00
juanvallejo 4059355743 move cached_discovery to client-go/discovery 2018-05-15 10:20:56 -04:00
Kubernetes Submit Queue d2952c0b2e
Merge pull request #63803 from deads2k/cli-58-set-versioned
Automatic merge from submit-queue (batch tested with PRs 63272, 63782, 63715, 63811, 63803). 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>.

switch to versioned objects only for set

Only used versioned types in the `kubectl set` commands.  This has long been the goal and we finally make it so here.

@liggitt @soltysh as promised in earlier pulls when I asked you to go with it while I unwound the debt.  This frees the entire package.



```release-note
NONE
```
2018-05-15 05:08:20 -07:00
Di Xu f2337f0caa cleanup kubectl apiresources 2018-05-15 11:26:56 +08:00
ravisantoshgudimetla f3441a5c20 Update e2e to use priorityClass beta 2018-05-14 18:13:41 -04:00
Kubernetes Submit Queue 141e4ee0ca
Merge pull request #63769 from liggitt/kubectl-taint-internal-object
Automatic merge from submit-queue (batch tested with PRs 55511, 63372, 63400, 63100, 63769). 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>.

print result object from kubectl taint correctly

fixes #63767 

```release-note
NONE
```
2018-05-14 14:35:24 -07:00
Jordan Liggitt 746bca241f
print result object from kubectl taint correctly 2018-05-14 14:21:52 -04:00
Clayton Coleman 3b6bd9be25
Retry certificate approval on conflict errors
We already check preconditions.
2018-05-14 12:44:53 -04:00
David Eads 3af9e75950 switch to versioned objects only for set 2018-05-14 11:40:11 -04:00
Kubernetes Submit Queue ff7abf2705
Merge pull request #63649 from dixudx/kubectl_flags_binding
Automatic merge from submit-queue (batch tested with PRs 63761, 63794, 63649). 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 missing flag value bindings in kubectl

**What this PR does / why we need it**:
When working #63644, I find there are still some flag not bound correctly.

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

**Special notes for your reviewer**:
/cc soltysh deads2k 
/cc kubernetes/sig-cli-api-reviews 
**Release note**:

```release-note
None
```
2018-05-14 07:59:11 -07:00
Di Xu e8ef744493 fix missing flag value bindings in kubectl 2018-05-14 14:38:54 +08:00
Ian Y. Choi 856110a21c Adds initial Korean translations for kubectl 2018-05-12 11:16:49 +09:00
Kubernetes Submit Queue 92ba95c39c
Merge pull request #63446 from deads2k/client-08-remove-old
Automatic merge from submit-queue (batch tested with PRs 63367, 63718, 63446, 63723, 63720). 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>.

finish new dynamic client and deprecate old dynamic client

Builds on a couple other pulls.  This completes the transition to the new dynamic client.

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

```release-note
The old dynamic client has been replaced by a new one.  The previous dynamic client will exist for one release in `client-go/deprecated-dynamic`.  Switch as soon as possible.
```
2018-05-11 14:49:16 -07:00
juanvallejo b5f6d834fc fail printing on internal obj 2018-05-11 14:54:37 -04:00
David Eads fd044d152e fix dynamic client name 2018-05-11 13:12:09 -04:00
Borja Aranda 9fa269a5e5 Fix kubectl auth can-i exit errcode 2018-05-11 16:41:21 +02:00
David Eads d8924bc1c9 move old dynamic client to deprecated-client 2018-05-11 08:00:46 -04:00
David Eads 1fd4149ed4 update describer to use dynamic client 2018-05-11 07:59:08 -04:00
Kubernetes Submit Queue 6203b621ba
Merge pull request #62244 from CaoShuFeng/raw
Automatic merge from submit-queue (batch tested with PRs 62244, 63685). 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 "kubectl create --raw"

Before this change:
```
$ kubectl create -f  pod.json --raw=https://172.16.29.130:443/api/v1/namespaces/default/pods  --as=tom --as-group=aaaaa
Error from server (Forbidden): unknown
```

After this change:
```
$ kubectl create -f pod.json --raw=https://172.16.29.130:443/api/v1/namespaces/default/pods  --as=tom --as-group=aaaaa
Error from server (Forbidden): pods is forbidden: User "tom" cannot create pods in the namespace "default"
```

/assign @soltysh 
**Release note**:

```release-note
NONE
```
2018-05-10 16:30:07 -07:00
Kubernetes Submit Queue 143d3b8824
Merge pull request #63561 from juanvallejo/jvallejo/make-opinionated-print-flags-constructor
Automatic merge from submit-queue (batch tested with PRs 63669, 63511, 63561, 63289). 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 legacyscheme dep from printFlags

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

Breaks PrintFlags dependency on legacyscheme
Prerequisite to https://github.com/kubernetes/kubernetes/pull/63402

cc @deads2k @soltysh
2018-05-10 14:25:16 -07:00
Kubernetes Submit Queue 4868d7775a
Merge pull request #63511 from juanvallejo/jvallejo/cmd-cleanup
Automatic merge from submit-queue (batch tested with PRs 63669, 63511, 63561, 63289). 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>.

cleanup TODOs from PrintFlags wiring

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

Address TODOs from PrintFlags wiring

cc @soltysh @deads2k
2018-05-10 14:25:13 -07:00
juanvallejo 40e52bf07d remove legacyscheme dep from printFlags 2018-05-10 14:51:12 -04:00
David Eads 16d6a6c52f move resource builder to generic options 2018-05-10 14:15:12 -04:00
juanvallejo 7b1b107ea4 cleanup TODO comments from PrintFlags wiring 2018-05-10 14:03:06 -04:00
David Eads 76d744efe9 remove kube/kube deps from resourcebuilder 2018-05-10 12:50:28 -04:00
David Eads 080d6a4b0d wrap restclientgetter with match version option 2018-05-10 09:43:22 -04:00
David Eads 1f5357034b construct resource.Builder from kubeconfig flags 2018-05-10 09:42:15 -04:00
Kubernetes Submit Queue ca92b73a65
Merge pull request #63602 from deads2k/cli-54-categories
Automatic merge from submit-queue (batch tested with PRs 59284, 63602). 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>.

 category expansion can only come from the server

A couple release ago we moved category expansion to the server instead of hardcoding it in the client.  Similar to restmappings, there is no valid client-side expansion anymore, so this removes the code that hardcoded the list and moves the category expansion to the same package as our discovery based restmappers.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-05-09 13:51:13 -07:00
Kubernetes Submit Queue d89471c4b5
Merge pull request #59284 from Addepar/fix-empty-null-patch
Automatic merge from submit-queue (batch tested with PRs 59284, 63602). 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>.

Exclude keys containing empty patches in the final patch

**What this PR does / why we need it**: 
This minimizes the 3-way JSON merge patch generated when calculating the patch necessary to send to the server. It does this by removing empty maps created from deleting keys in the keepOrDeleteNullInObj method.

This is not only a slight performance improvement (less PATCH requests) but also necessary when working with custom resources that have RBAC restrictions.

**Which issue(s) this PR fixes**: N/A

**Special notes for your reviewer**: N/A

**Release note**:

```release-note
NONE
```
2018-05-09 13:51:09 -07:00
David Eads ad87219b2c category expansion can only come from the server 2018-05-09 15:05:58 -04:00
David Eads 37f6cb7230 move category expansion types to restmapper package 2018-05-09 15:03:09 -04:00
Kubernetes Submit Queue 23a9136d4e
Merge pull request #63599 from deads2k/cli-53-restmapper
Automatic merge from submit-queue (batch tested with PRs 63597, 63599). 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>.

push ToRESTMapper down a layer

The RESTMapper is needed to drive some use-cases for a dynamic client and takes a little bit of wiring (nested restmappers).  This pull pushes that into information derived from the kubeconfig flags to allow easy re-use.

@kubernetes/sig-cli-maintainers 
/assign @juanvallejo 
/assign @soltysh 

assigned to original creators.


```release-note
NONE
```
2018-05-09 11:26:12 -07:00
David Eads 3cb7d25959 push ToRESTMapper down a layer 2018-05-09 11:18:26 -04:00
Jordan Liggitt d037b0893f
Run resource discovery in parallel 2018-05-08 23:24:34 -04:00
hangaoshuai c01f6a1e68 fix a small mistake in function getFieldMeta 2018-05-09 11:14:57 +08:00
David Eads c5445d3c56 simplify api registration 2018-05-08 18:33:50 -04:00
David Eads 7b4f97aca3 generated 2018-05-08 18:32:44 -04:00
Kubernetes Submit Queue e70c4331a9
Merge pull request #60371 from superbrothers/__kubectl_cp-1
Automatic merge from submit-queue (batch tested with PRs 63526, 60371, 63444). 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 completion for kubectl cp

**What this PR does / why we need it**: With this PR, kubectl cp supports completion. I tested this PR in bash and zsh.

```
$ kubectl cp kube-system/<tab>
kube-system/kube-state-metrics-769566fdfb-4v52s:   kube-system/kubernetes-dashboard-6b6ddbd46-t5bv9:  kube-system/prometheus-694594c45b-qk5lq:
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes/kubectl#5

**Special notes for your reviewer**: @cblecker

**Release note**:

```release-note
`kubectl cp` supports completion.
```
2018-05-08 15:24:08 -07:00
Kubernetes Submit Queue a67ccaeab1
Merge pull request #63536 from deads2k/cli-51-streams
Automatic merge from submit-queue (batch tested with PRs 63070, 63536). 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 IOStreams for cli commands

Scrubs the last commands to use IOStreams for consistency and testability.

@kubernetes/sig-cli-maintainers 
/assign @juanvallejo 

```release-note
NONE
```
2018-05-08 14:14:20 -07:00
Kubernetes Submit Queue c27335fe3e
Merge pull request #63507 from deads2k/cli-50-tidyup
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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 client based restmappers to client-go

Moves the client-based restmappers to client-go where everyone who needs them can have access.


```release-note
the shortcuts which were moved server-side in at least 1.9 have been removed from being hardcoded in kubectl
```

@kubernetes/sig-cli-maintainers @kubernetes/sig-api-machinery-pr-reviews
2018-05-08 13:16:23 -07:00
Kubernetes Submit Queue f9fd3c89e7
Merge pull request #63490 from deads2k/cli-48-delete
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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>.

default the ignorenotfound for delete when selecting objects

When selecting resources and then deleting them (as opposed to specifically indicating a resource to delete) we should default to not failing if something disappeared partway through.  This is quite common when label selecting deletes and GC runs before you get to a dependent object.

I also took the liberty of doing complete work in complete instead of validate.

```release-note
`kubectl delete` with selection criteria defaults to ignoring not found errors
```

@kubernetes/sig-cli-maintainers
2018-05-08 13:16:14 -07:00
Kubernetes Submit Queue 9091c26d72
Merge pull request #63291 from WanLinghao/set_const_clean
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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>.

	clean unused variables

**What this PR does / why we need it**:
clean unused variables on set.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-08 13:16:11 -07:00
David Eads facd04be43 use IOStreams for cli commands 2018-05-08 09:02:34 -04:00
David Eads dd97a7bc59 move client based restmappers to client-go 2018-05-08 08:11:56 -04:00
David Eads 682e028516 stop pretending that we have statically known shortcuts 2018-05-08 08:11:56 -04:00
juanvallejo a74b28d961 rm GetStandardPrinter 2018-05-07 15:37:55 -04:00
juanvallejo 5a34e4f594 remove printer helpers 2018-05-07 15:37:55 -04:00
David Eads 4ae3f882be default the ignorenotfound for delete when selecting objects 2018-05-07 12:38:18 -04:00
juanvallejo 3ca222b2d9 wire config flags through factory 2018-05-04 17:02:20 -04:00
juanvallejo 46e827a8a5 begin building a config flags struct 2018-05-04 16:16:20 -04:00
Kubernetes Submit Queue 5f5d4fd450
Merge pull request #63439 from liggitt/from-file
Automatic merge from submit-queue (batch tested with PRs 63315, 63383, 63318, 63439). 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>.

compute configmap/secret key correctly cross-platform

fixes #61710

```release-note
`kubectl create [secret | configmap] --from-file` now works on Windows with fully-qualified paths
```
2018-05-04 12:41:15 -07:00
Kubernetes Submit Queue 238fda9e52
Merge pull request #63318 from deads2k/cli-40-mapperfunc
Automatic merge from submit-queue (batch tested with PRs 63315, 63383, 63318, 63439). 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>.

drive resourcebuilder from kubeconfig, allow scheme specification

This updates the resource builder to work based on a kubeconfig to allow future chaining of flags.  It also allow specification of the scheme you want for your actual decoding.


@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-05-04 12:41:12 -07:00
Kubernetes Submit Queue 484f62a568
Merge pull request #63333 from deads2k/api-14-snip
Automatic merge from submit-queue (batch tested with PRs 63421, 63432, 63333). 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>.

update tests to be specific about the versions they are testing

When setting up tests, you want to rely on your own scheme.  This eliminates coupling to floating versions which gives unnecessary flexibility in most cases and prevents testing all the versions you need.

@liggitt  scrubs unnecessary deps.

```release-note
NONE
```
2018-05-04 10:52:10 -07:00
Kubernetes Submit Queue 3945a241aa
Merge pull request #63432 from deads2k/cli-46-printerinterface
Automatic merge from submit-queue (batch tested with PRs 63421, 63432, 63333). 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>.

 slim printer interface down to printing

The printer interface only needs to know how to print.  This reduces it's interface to scope it to printing.

@kubernetes/sig-cli-maintainers 
@soltysh @juanvallejo  you've been active in the area

/assign @juanvallejo 

```release-note
NONE
```
2018-05-04 10:52:07 -07:00
David Eads a53a72e238 udpate some examples to use external types 2018-05-04 13:02:49 -04:00
David Eads b8aa7baa7d simplify resource builder usage 2018-05-04 13:02:49 -04:00
Jordan Liggitt 17e62d91af
compute configmap/secret key correctly cross-platform 2018-05-04 12:00:50 -04:00
David Eads e1fca70506 slim down printer interface 2018-05-04 11:15:35 -04:00
Jordan Liggitt 0dd652cffd
Fix bash completion with --all-namespaces 2018-05-04 09:57:57 -04:00
Jordan Liggitt 4dfd26a4f2
Switch kubectl resource completion to discovery 2018-05-04 09:57:36 -04:00
Jordan Liggitt 918df97a0f
Allow api-resources to return cached data 2018-05-04 00:06:39 -04:00
Jordan Liggitt 74b7cec0c6
Make ServerPreferred[Namespaced]Resources logic and caches consistent 2018-05-04 00:06:39 -04:00
Kubernetes Submit Queue b52ebfa28e
Merge pull request #63312 from deads2k/cli-44-encoder
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 unnecessary encoder

Followups to https://github.com/kubernetes/kubernetes/pull/63105
2018-05-03 16:11:17 -07:00
Kubernetes Submit Queue eaa3aa382a
Merge pull request #63398 from deads2k/cli-45-conversion
Automatic merge from submit-queue (batch tested with PRs 63258, 63398, 63403). 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 unnessary kubectl conversions

Working with unstructured types means that conversion can be eliminated.  This pulls  it from places I noticed.

/assign @juanvallejo 

@kubernetes/sig-cli-misc 

```release-note
NONE
```
2018-05-03 12:48:13 -07:00
Kubernetes Submit Queue a29b4607df
Merge pull request #63258 from deads2k/cli-42-simplify-buidler
Automatic merge from submit-queue (batch tested with PRs 63258, 63398, 63403). 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>.

stop using Info.Mappings when they may not be present

On a resource builder, you cannot logically have a RESTMapping or a Client if you're running a local action.  Reliance on the `info.Client` and `info.Mapping` is a bug we need to fix.  This updates the docs and eliminates unnecessary reliance.  Other hits I found didn't have `--local` options, so we're safe or had them and and were already broken.  I think we'll be able to help them after making our creation flow obvious.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-05-03 12:48:10 -07:00
Kubernetes Submit Queue a16c348acf
Merge pull request #56137 from containscafeine/remove-punctuation-from-error
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 punctuation from the end of an error string

```release-note
NONE
```
2018-05-03 06:37:57 -07:00
David Eads abe9e0d25b stop using Info.Mappings when they may not be present 2018-05-03 08:12:05 -04:00
David Eads a9a99681e4 remove unnessary kubectl conversions 2018-05-03 08:06:53 -04:00
Kubernetes Submit Queue fb85e69b9b
Merge pull request #63376 from liggitt/another-mapper-err
Automatic merge from submit-queue (batch tested with PRs 63073, 63376). 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 reuse resource builder in describe

fixes #63363 

```release-note
NONE
```
2018-05-03 01:49:06 -07:00
Kubernetes Submit Queue b5f61ac129
Merge pull request #62657 from matthyx/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>.

Update all script shebangs to use /usr/bin/env interpreter instead of /bin/interpreter

This is required to support systems where bash doesn't reside in /bin (such as NixOS, or the *BSD family) and allow users to specify a different interpreter version through $PATH manipulation.
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
```release-note
Use /usr/bin/env in all script shebangs to increase portability.
```
2018-05-02 19:44:32 -07:00
Kubernetes Submit Queue 03eb9f687f
Merge pull request #62060 from WanLinghao/namespace_miss_fix
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 namespace miss bug

**What this PR does / why we need it**:
This  patch fixes  the namespace miss problems.
I am not sure if this is the correct way it should be fixed.
Just offer a solution.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62059

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-02 18:04:06 -07:00
Jordan Liggitt ccd820d680
don't reuse resource builder in describe 2018-05-02 16:53:26 -04:00
WanLinghao a2c029f6c3 1.fix kubectl get * --all-namespaces
namespace miss error
	2.also add a test case
	modified:   pkg/kubectl/cmd/get/get.go
	modified:   hack/make-rules/test-cmd-util.sh
2018-05-02 11:27:22 +08:00
David Eads 9a48066749 update restmapping to indicate fully qualified resource 2018-05-01 16:34:49 -04:00
Kubernetes Submit Queue dc7f074213
Merge pull request #63309 from deads2k/server-13-rootscopedkind
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 rootscopedkinds from groupmeta

builds on https://github.com/kubernetes/kubernetes/pull/63206

Since, a RESTMapping can only be determined based on a connection to a server, the only thing that needs to know the namespaced-ness of a resource is the code doing the registration.  Everything else is derived from that source of truth.  This removes the other dangling references and collapses down onto the existing namespaced-ness methods in the strategies backing the stores.

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

```release-note
NONE
```
2018-05-01 13:10:49 -07:00
Kubernetes Submit Queue ed4739b36b
Merge pull request #63330 from deads2k/api-13-sparse
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 test for sparse version encoding/decoding

This adds tests that make sure the sparse version encoding and encoding work as callers will expect, with the correct version being picked from the list.  I wrote two tests, one a theoretical test not dependent on any API and another practical test using cronjobs which are currently sparse in the registry.

@liggitt turns out that because we find exact matches, sparse versions ought to work out fine.
@smarterclayton I hate that the versioner matches on type.  I'll update that separately I think.


```release-note
NONE
```
2018-05-01 12:11:35 -07:00
Kubernetes Submit Queue d39ff8e651
Merge pull request #60717 from liggitt/field-selector
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 field selector support to delete, label, annotate

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

Builds out field selector support for more bulk commands

**Release note**:
```release-note
kubectl now supports --field-selector for `delete`, `label`, and `annotate`
```
2018-05-01 11:20:24 -07:00
David Eads 94e3d94d67 update tests to be specific about the versions they are testing instead of floating 2018-05-01 13:18:41 -04:00
David Eads 8ae62517da remove rootscopedkinds from groupmeta 2018-05-01 13:08:23 -04:00
Kubernetes Submit Queue 3f05fa21d7
Merge pull request #63299 from liggitt/kubectl-get-help
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 version/group usage and example to kubectl get

Fixes #63286 

```release-note
NONE
```
2018-05-01 08:57:54 -07:00
Kubernetes Submit Queue f03f83a20a
Merge pull request #63206 from deads2k/api-11-restmapper
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 incorrect static restmapper from type registry

A RESTMapping can only be determined by inspecting a server since discovery is the authoritative source of mapping decisions.  This removes a deceptive method from the type registry and makes the old logic available for existing tests in a separate, clearly labeled package.

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

```release-note
NONE
```
2018-05-01 08:10:37 -07:00
David Eads f9b32d762a add test for sparse version encoding/decoding 2018-05-01 09:34:06 -04:00
Kubernetes Submit Queue b46dad61c8
Merge pull request #63177 from smarterclayton/dependencies
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 should not have a direct code dependency on controllers

The dependency linkage brings in the scheduler and a lot of unrelated
code. Instead, selectively copy methods that operate on public APIs.

@liggitt
2018-05-01 05:06:35 -07:00
David Eads 1e5372b620 get the resource.Info out of the conversion business 2018-05-01 07:58:42 -04:00
David Eads 1cb797e355 acknowledge that creation of a restmapper can fail and that we cannot have a default 2018-05-01 07:52:51 -04:00
David Eads ef0d1ab819 remove incorrect static restmapper 2018-05-01 07:51:17 -04:00
David Eads 04384481cd remove unnecessary encoder 2018-04-30 14:55:15 -04:00
Maciej Szulik b7d4f15965
Remove Factory from more Run commands 2018-04-30 19:58:54 +02:00
Jordan Liggitt 32e6775a71
Add version/group usage and example to kubectl get 2018-04-30 11:11:53 -04:00
WanLinghao 771882bbba clean unused variables 2018-04-30 16:39:12 +08:00
Kubernetes Submit Queue d6967f358e
Merge pull request #63254 from liggitt/api-resources
Automatic merge from submit-queue (batch tested with PRs 60890, 63244, 60741, 63254). 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 name output and verb filtering to api-resources

This allows `kubectl api-resources -o name` to be used as input to `kubectl get ...`

to see all resources still existing in a given namespace:

Example:
```sh
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -o name -n foo
```

Release note:
```release-note
`kubectl api-resources` now supports filtering to resources supporting specific verbs, and can output fully qualified resource names suitable for combining with commands like `kubectl get`
```
2018-04-27 17:43:13 -07:00
juanvallejo f432ebe262
finish wiring PrintFlags 2018-04-27 21:41:03 +02:00
Kubernetes Submit Queue 7884cc5453
Merge pull request #63250 from deads2k/cli-39-typer
Automatic merge from submit-queue (batch tested with PRs 63251, 59166, 63250, 63180, 63169). 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>.

divide statically known typer from dynamically derived restmapper

The CLI factory conflated a statically known typer and a dynamically derived restmapper. This produced confusion and unnecessary indirection.  This pull separates dynamically known from statically known.

A future pull will continue the separation of in the builder to indicate the points of variability for clients, which should logically be limited to a negotiated serializer for decoding and an object typer.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 
/assign @juanvallejo 


```release-note
NONE
```
2018-04-27 10:45:13 -07:00
Jordan Liggitt deeb6b2a99
Add name output and verb filtering to api-resources 2018-04-27 12:36:28 -04:00
Kubernetes Submit Queue 6b9cf21d9f
Merge pull request #63203 from deads2k/api-07-versioninterface
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 versioning interface

Builds on prior restmapping/converter separation to completely remove the versioning interface which isn't needed.

intersection of @kubernetes/sig-api-machinery-pr-reviews and @kubernetes/sig-cli-maintainers  again

```release-note
NONE
```
2018-04-27 09:15:13 -07:00
David Eads 5432ef5c45 divide statically known typer from dynamically derive restmapper 2018-04-27 11:15:05 -04:00
David Eads 6fbcbc994f remove unnecessarily flexibiliy to simplify the resource builder 2018-04-27 09:27:51 -04:00
David Eads 61fdd880b2 stop anonymously including types in resource struct so we can track usage 2018-04-27 08:32:56 -04:00
David Eads e2fc5cf259 remove versioning interface 2018-04-27 07:56:42 -04:00
David Eads b8177bb9af tighten .Info for kubectl to avoid unpredictable conversion 2018-04-26 12:47:25 -04:00
David Eads 6900f8856f rest mappings cannot logically be object converters 2018-04-26 12:47:25 -04:00
Kubernetes Submit Queue d4b678036f
Merge pull request #63200 from deads2k/api-09-duplicate
Automatic merge from submit-queue (batch tested with PRs 62911, 63200). 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>.

stop duplicating preferred version order 

`GroupMeta` includes two fields for a preferred groupVersion, `.GroupVersion` and `.GroupVersion[0]`.  This collapses onto the latter.

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

lots of ripples, but eliminate of duplication is good.
/assign @sttts 
/assign @cheftako 


```release-note
NONE
```
2018-04-26 09:43:06 -07:00
Kubernetes Submit Queue 8122aa41b5
Merge pull request #62911 from juanvallejo/jvallejo/remove-hardcoded-list-of-resources
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 hardcoded list of resources

**Release note**:

```release-note
NONE
```

Removes the hardcoded list of resources in cmdutil.ValidResourceTypeList (which was not being kept up to date) and instead suggests using the `kubectl api-resources` command in order to retrieve a discovery-based list of supported resources.

I prefer this approach over updating `cmdutil.ValidResourceTypeList` to be based on discovery in order to avoid potential calls to the server while building the help output of commands.

cc @soltysh
2018-04-26 09:17:46 -07:00
Kubernetes Submit Queue dd5f030b02
Merge pull request #63165 from deads2k/api-08-kubeapiversion
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 KUBE_API_VERSIONS

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

KUBE_API_VERSIONS is an attempt to control the available serialization of types. It pre-dates the idea that we'll have separate schemes, so it's not a thing that makes sense anymore.

Server-side we've had a very clear message about breaks in the logs for a year "KUBE_API_VERSIONS is only for testing. Things will break.".

Client-side it became progressively more broken as we moved to generic types for CRUD more than a year ago. What is registered doesn't matter when everything is unstructured.

We should remove this piece of legacy since it doesn't behave predictable server-side or client-side.

@smarterclayton @lavalamp
@kubernetes/sig-api-machinery-bugs 

```release-note
KUBE_API_VERSIONS is no longer respected.  It was used for testing, but runtime-config is the proper flag to set.
```
2018-04-26 08:22:36 -07:00
David Eads a89291a5de stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
juanvallejo e11b66a732 update describe command opts struct 2018-04-26 09:42:26 -04:00
juanvallejo 6d3652eded remove hardcoded list of resources 2018-04-26 09:31:58 -04:00
David Eads a68c57155e remove KUBE_API_VERSIONS 2018-04-26 08:27:49 -04:00
Kubernetes Submit Queue acbccfba84
Merge pull request #62820 from juanvallejo/jvallejo/wire-more-print-flags
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>.

wire printflags through additional cmds

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

Adds PrintFlag pattern to more commands.

cc @deads2k @soltysh
2018-04-26 02:20:34 -07:00
Clayton Coleman 1a1e8344a5
kubectl should not have a direct code dependency on controllers
The dependency linkage brings in the scheduler and a lot of unrelated
code. Instead, selectively copy methods that operate on public APIs.
2018-04-26 00:18:54 -04:00
juanvallejo ac6ca38dd7 report outputFormat in PrintFlags err 2018-04-25 16:35:56 -04:00
juanvallejo 27bd4ded04 wire printflags through additional cmds 2018-04-25 16:07:32 -04:00
juanvallejo 191a48f4c3 wire PrintFlags through get cmd 2018-04-25 15:02:48 -04:00
juanvallejo df6a7ea654 move "get" cmd pieces to cmd/get 2018-04-25 14:58:12 -04:00
Kubernetes Submit Queue 29630b5124
Merge pull request #63141 from deads2k/cli-36-io-2
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). 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>.

update all set and get  commands for iostreams

Sweeping more commands for the iostream pattern.   Trying to keep things about 300 lines each.  Delete is going to be big


/assign @juanvallejo 

```release-note
NONE
```
2018-04-25 11:53:24 -07:00
Kubernetes Submit Queue df489968b7
Merge pull request #62877 from deads2k/cli-34-describer
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). 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 describers more generic from the CLI

I've made this change very small so the intent and explanation make sense to people.

Clients are not generic.  Client**Configs** are generic.  We faced this distinction in the apiserver and it took us a little to hurdle it.  When you try to provide a generic example or function, you need to provide Client**Config**, not a kube clientset.  The reason is that the code you're calling may have generated their own clientset, may want to use a dynamic one, or may want to a simple restclient.  As we seek to make `kubectl` primitives more generally applicable, this is an example we'll want to follow.  I suspect we'll be making more changes along these veins as we tease out the generic pieces of `kubectl ` to make a friendly CLI library.


@kubernetes/sig-cli-maintainers 

/hold

Holding for a few days to make sure that people have time to read and digest.

```release-note
NONE
```
2018-04-25 11:53:21 -07:00
Kubernetes Submit Queue 97287177ee
Merge pull request #63075 from deads2k/api-05-eliminate-indirection
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). 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>.

eliminate indirection from type registration

Some years back there was a partial attempt to revamp api type registration, but the effort was never completed and this was before we started splitting schemes. With separate schemes, the idea of partial registration no longer makes sense.  This pull starts removing cruft from the registration process and pulls out a layer of indirection that isn't needed.

@kubernetes/sig-api-machinery-pr-reviews 
@lavalamp @cheftako @sttts @smarterclayton 

Rebase cost is fairly high, so I'd like to avoid this lingering.

/assign @sttts 
/assign @cheftako 

```release-note
NONE
```
2018-04-25 11:53:14 -07:00
Kubernetes Submit Queue 5e08ae0bf2
Merge pull request #61285 from soltysh/issue23276
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>.

Deprecate kubectl rolling-update

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

/assign @juanvallejo @tnozicka 

**Release note**:
```release-note
Deprecate kubectl rolling-update 
```
2018-04-25 09:47:27 -07:00
David Eads e7fbbe0e3c eliminate indirection from type registration 2018-04-25 09:02:31 -04:00
David Eads 3632037e60 add easy to use dynamic client 2018-04-25 08:55:26 -04:00
David Eads 8c1b687356 update more commands for iostreams 2018-04-25 08:45:15 -04:00
Kubernetes Submit Queue 6fbca94fae
Merge pull request #63010 from deads2k/api-04-metadataaccessor
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 confusing flexibility for metadata interpretation

Metadata accessors are coded in.  This means that we don't need to inject flexibility, the flexibility is already present based on what your code relies up.  This removes the per-individual resource injection which simplifies all calling code.

intersection of @kubernetes/sig-api-machinery-pr-reviews @kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-04-24 17:59:12 -07:00
Jordan Liggitt 8a3125bb99
Add field selector support to delete, label, annotate 2018-04-24 16:18:04 -04:00
Marek Siarkowicz f0b5e2d7c5 Remove examples directory 2018-04-24 19:45:43 +01:00
David Eads 0710f72c65 remove confusing flexibility for metadata interpretation 2018-04-23 13:31:55 -04:00
Tomoe Sugihara 0f3e1dcfc2 Whitelist CronJob for kubectl apply --prune 2018-04-23 15:38:20 +09:00
Kubernetes Submit Queue 467ce8d8f3
Merge pull request #62880 from deads2k/cli-35-io
Automatic merge from submit-queue (batch tested with PRs 61324, 62880, 62765). 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>.

provide standard iostream struct for commands

Commands usually need some kind of iostream.  For consistency, delegation, and testability this pull introduces a standard struct to embed in every set of command options.  It also starts the plumbing so that the benefits of standardization for all three of those cases become clear.

@kubernetes/sig-cli-maintainers 
@soltysh @juanvallejo 

```release-note
NONE
```
2018-04-20 17:23:20 -07:00
Kubernetes Submit Queue f2c8ef7571
Merge pull request #50899 from WanLinghao/rollout_pause
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 test file for pkg/kubectl/cmd/rollout/rollout_pause.go file

new:   pkg/kubectl/cmd/rollout/rollout_pause_test.go
        modified: pkg/kubectl/cmd/rollout/BUILD


**What this PR does / why we need 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
```
2018-04-20 15:05:37 -07:00
Kubernetes Submit Queue 03160fde5a
Merge pull request #62876 from deads2k/cli-33-discovery
Automatic merge from submit-queue (batch tested with PRs 62876, 62733, 62827). 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 discovery injection from factory

We added this shim when cached discovery was a contentious thing to give ourselves flexibility.  It is no longer contentious and this removes a layer of complexity we no longer need.

@kubernetes/sig-cli-maintainers 
@soltysh @juanvallejo 

```release-note
NONE
```
2018-04-20 13:39:07 -07:00
David Eads 8ef56776b9 provide standard iostream struct for commands 2018-04-20 12:54:11 -04:00
Maciej Szulik d82f452b85
Filter unavailable commands in help 2018-04-20 16:52:26 +02:00
Maciej Szulik 50bbe57811
Deprecate kubectl rolling-update 2018-04-20 16:43:20 +02:00
David Eads 4f90f9aa8b remove uneeded discovery flexibility 2018-04-20 07:21:51 -04:00
juanvallejo d9f2657647
aggregate objs before printing in apply cmd 2018-04-19 19:39:10 -04:00
Kubernetes Submit Queue 019c805ff2
Merge pull request #62858 from deads2k/cli-32-more-record-02
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.

 final record flag cleanup

This ties off the remainder of the record flag uses.  Trying to merge different types of patches is fraught, so I added a way to get a merge patch (not a strategic patch) back from the annotation update.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 
/assign @juanvallejo 

```release-note
NONE
```
2018-04-19 15:54:25 -07:00
Kubernetes Submit Queue ea069dcddc
Merge pull request #62487 from juanvallejo/jvallejo/wire-print-flags-apply.go
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.

wire print flags through apply cmd

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

Depends on https://github.com/kubernetes/kubernetes/pull/62300
Adds PrintFlags to `apply` command.

cc @soltysh @deads2k
2018-04-19 15:54:22 -07:00
Kubernetes Submit Queue 4642d5e619
Merge pull request #62855 from deads2k/cli-30-clientcache
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.

simplify the client cache

We created the client cache back when we negotiated versions to create a config and a client.  Now we don't, so this is just debt.  This removes all the obvious places.  I'll open a separate WIP to try to kill the rest.

@kubernetes/sig-cli-maintainers 
@soltysh 

```release-note
NONE
```
2018-04-19 15:54:19 -07:00
David Eads 66a95a8f3e make describers more generic from the CLI 2018-04-19 16:22:42 -04:00
David Eads ecd9a6be2e final record flag cleanup 2018-04-19 14:56:00 -04:00
David Eads df3439c2d9 simplify the client cache 2018-04-19 13:10:13 -04:00
juanvallejo 89b72743e3
wire print flags through apply cmd 2018-04-19 12:55:55 -04:00
David Hao 48ef7645df Exclude keys containing empty patches in the final patch 2018-04-19 12:38:23 -04:00
Kubernetes Submit Queue 8e9eb4fcef
Merge pull request #62848 from deads2k/cli-29-more-record
Automatic merge from submit-queue (batch tested with PRs 62632, 62789, 62512, 62848). 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 recordFlags to manage recording

This updates the set commands to use the recordflags and updates the commands we're touching to follow the pattern that is emerging.  A method for New*Options, a valid default value for a recorder there, using the value `o` everywhere to refer to options, naming the struct `<commandName>Options`.

@kubernetes/sig-cli-maintainers 
@soltysh @juanvallejo continues the effort

```release-note
NONE
```
2018-04-19 08:58:20 -07:00
Kubernetes Submit Queue 07c64d1d73
Merge pull request #62512 from dixudx/cli_gvk_list
Automatic merge from submit-queue (batch tested with PRs 62632, 62789, 62512, 62848). 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 stops rendering List as suffix kind name for CRD resources

**What this PR does / why we need it**:
`List` should not be treated as suffix when validating CRD objects.
Removing this validation won't break anything.

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

**Special notes for your reviewer**:
/assign liggitt deads2k 
/cc nikhita soltysh 

**Release note**:

```release-note
kubectl stops rendering List as suffix kind name for CRD resources
```
2018-04-19 08:58:16 -07:00
Di Xu 82cc3b5d59 kubectl stops rendering List as suffix kind name for CRD resources 2018-04-19 21:21:03 +08:00
David Eads 484d81ab01 use recordFlags 2018-04-19 08:50:01 -04:00
David Eads f01e16bb3e remove flags deprecated in 1.5 2018-04-19 08:08:44 -04:00
Matthias Bertschy 9b15af19b2 Update all script to use /usr/bin/env bash in shebang 2018-04-19 13:20:13 +02:00
hangaoshuai bdc509131c check error when parse field failed 2018-04-19 10:02:28 +08:00
Kubernetes Submit Queue efadf7b9e7
Merge pull request #61877 from mikedanese/depeid
Automatic merge from submit-queue (batch tested with PRs 62481, 62643, 61877, 62515). 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 deprecated ExternalID

This field has been deprecated since 1.1. After we remove it we can remove "self delete" from the node's permission set.

@kubernetes/api-reviewers 
@kubernetes/sig-auth-pr-reviews 

fixes https://github.com/kubernetes/kubernetes/issues/61966
part of https://github.com/kubernetes/community/pull/911

```release-note
Kubelets will no longer set `externalID` in their node spec.
```
2018-04-18 17:53:16 -07:00
Kubernetes Submit Queue b9ed99604d
Merge pull request #62794 from deads2k/cli-27-recordflags
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 up and use record flags

This pull starts a genericclioptions package with a dependency enforcer to ensure that we have no kube/kube links.  It makes the recordflags nil-able and still behave as expected.  And it also updates several commands to use the record flags.

@kubernetes/sig-cli-maintainers @soltysh @juanvallejo 

```release-note
NONE
```
2018-04-18 16:35:19 -07:00
Kubernetes Submit Queue c52c2e545d
Merge pull request #62569 from juanvallejo/jvallejo/wire-print-flags-run-cmd
Automatic merge from submit-queue (batch tested with PRs 62694, 62569, 62646, 61633, 62433). 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>.

wire printflags through run cmd

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

Adds PrintFlags to `run` command.

cc @soltysh @deads2k
2018-04-18 14:44:13 -07:00
Kubernetes Submit Queue c36e66dd66
Merge pull request #48244 from xilabao/add-validation-when-create-directory
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 validation in kubectl create if no file in directory

**What this PR does / why we need it**:
if no yaml or json file in a directory
```
# ./cluster/kubectl.sh create -f ../0/1 --dry-run
pod "nginx" created (dry run)

# ./cluster/kubectl.sh create -f ../0
error: You must provide one or more resources by argument or filename.
Example resource specifications include:
   '-f rsrc.yaml'
   '--filename=rsrc.json'
   '<resource> <name>'
   '<resource>'
```
expected:
```
# ./cluster/kubectl.sh create -f ../0
error: error reading [../0]: please make sure the file extension is [.json .yaml .yml]
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-18 11:08:55 -07:00
David Eads e2a5c39b23 use record flags 2018-04-18 13:56:59 -04:00
David Eads b523c915e4 fix up record flags 2018-04-18 13:56:59 -04:00
Mike Danese f427531179 boring 2018-04-18 09:55:57 -07:00
juanvallejo 0aec803a9c
wire pritnflags through run cmd 2018-04-18 11:35:34 -04:00
Kubernetes Submit Queue 87caa938b7
Merge pull request #62744 from liggitt/describe-cronjob
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). 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 kubectl describe cronjob

CronJob describer was attempting to use the internal batch clientset, which speaks to the batch/v1 API group. CronJobs do not exist in that API group.
2018-04-18 07:58:19 -07:00
Kubernetes Submit Queue 4bccf6a7aa
Merge pull request #60201 from sttts/sttts-unstructured-convert-to-version
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). 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: normal conversion code path for Unstructured in ConvertToVersion

Preparation for https://github.com/kubernetes/kubernetes/pull/60113
2018-04-18 07:58:15 -07:00
Kubernetes Submit Queue b7c215beef
Merge pull request #62584 from liggitt/get-openapi
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 x-kubernetes-print-column print handling opt-in

Server-side printing is enabled by default in 1.11 and will support CRD and extension API servers, as well as built-in kube types

Fixes https://github.com/kubernetes/kubectl/issues/306
2018-04-18 06:18:09 -07:00
Kubernetes Submit Queue a5958c4e39
Merge pull request #62300 from juanvallejo/jvallejo/wire-print-flags-delete-cmd
Automatic merge from submit-queue (batch tested with PRs 62748, 60536, 62300, 62661, 62731). 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>.

Wire PrintFlags through delete, replace, run commands

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

Wires PrintFlags through the `delete`, `replace`, and `run` commands.
All three commands grouped in this patch as they depend on DeleteOptions.

~~Tagged as WIP for now, as I still need to update tests.~~

cc @soltysh @deads2k
2018-04-17 19:53:18 -07:00
Kubernetes Submit Queue aba9d41ec0
Merge pull request #62664 from juanvallejo/jvallejo/add-record-flags-struct
Automatic merge from submit-queue (batch tested with PRs 62436, 62499, 62664, 62685, 62660). 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>.

begin adding record flags struct

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

Begins wiring RecordFlags through the apply command.

cc @soltysh @deads2k
2018-04-17 17:31:16 -07:00
Jordan Liggitt d07c417b18
Fix kubectl describe cronjob 2018-04-17 14:47:55 -04:00
Cao Shufeng 82d101a6fa fix "kubectl create --raw" 2018-04-17 14:25:20 +08:00
juanvallejo 813a854b99
begin adding record flags struct 2018-04-16 16:53:23 -04:00
juanvallejo 285d696157
add delete flags 2018-04-16 16:48:39 -04:00
juanvallejo ecaddbfc36
update delete, replace, run cmds 2018-04-16 16:48:39 -04:00
Jordan Liggitt e43f1f65e5
Make x-kubernetes-print-column print handling opt-in 2018-04-14 11:56:08 -04:00
Kubernetes Submit Queue 1ef0153e02
Merge pull request #62181 from juanvallejo/jvallejo/wire-print-flags-create-cmds
Automatic merge from submit-queue (batch tested with PRs 61306, 60270, 62496, 62181, 62234). 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>.

wire printflags through create commands

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

~~Depends on https://github.com/kubernetes/kubernetes/pull/62139~~
~~Depends on https://github.com/kubernetes/kubernetes/pull/62341~~

Begins wiring PrintFlags through create subcommands.
Opening now to begin gathering feedback.

cc @soltysh @deads2k
2018-04-13 15:03:13 -07:00
juanvallejo 8a7b2fdda3
begin wiring printopts through complete commands 2018-04-13 11:50:54 -04:00
Kubernetes Submit Queue 2bfa8a943d
Merge pull request #62482 from juanvallejo/jvallejo/cleanup-resources-cmd-run
Automatic merge from submit-queue (batch tested with PRs 62467, 62482, 62211). 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>.

Ensure resources created by `run --rm` are cleaned up

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

Resources created by `kubectl run --rm ...` are now cleaned up, even in the event of an error.
Relevant downstream issue: https://github.com/openshift/origin/issues/13276

cc @soltysh
2018-04-13 07:25:17 -07:00
Kubernetes Submit Queue 7243ac9091
Merge pull request #62341 from soltysh/move_create
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 all create subcommands to its own subdirectory

**What this PR does / why we need it**:
Similarly to `kubectl set` subcommands move al `create` subcommands to its own subdirectory given that there are that many of them. 

/assign @juanvallejo 

**Release note**:

```release-note
NONE
```
2018-04-12 21:07:13 -07:00
Maciej Szulik d12a8a8d48
Move all create subcommands to its own subdirectory 2018-04-12 23:47:31 +02:00
David Eads 01609036c2 use standard interface functions for printers 2018-04-12 16:02:30 -04:00
juanvallejo e87d6301a1
cleanup resources created by run --rm 2018-04-12 13:58:03 -04:00
Kubernetes Submit Queue 3aef3fd840
Merge pull request #62461 from deads2k/cli-23-disco
Automatic merge from submit-queue (batch tested with PRs 62273, 62461). 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 higher burst for discovery

Discovery makes a lot of consecutive (maybe someday parallel) calls.  One for every group and another for every version.  Add a few CRDs and it's pretty easy to get to 50 calls. 

This targets the burst on kubectl's discovery client only.
2018-04-12 06:38:16 -07:00
David Eads b3dad83c2a allow higher burst 2018-04-12 07:56:16 -04:00
Ayush Pateria a8c63b61ad Add basic generator for apps/v1 deployment 2018-04-11 00:44:29 +05:30
WanLinghao 110bd2e7ad add UT test for rollout_pause.go file
modified:   pkg/kubectl/cmd/rollout/BUILD
	new file:   pkg/kubectl/cmd/rollout/rollout_pause_test.go
	modified:   build/visible_to/BUILD
2018-04-10 18:25:05 +08:00
Kenjiro Nakayama 5303f78de8 Create container name after dropped ":" and "@" both separately
When image has ":" after "@", kubectl create deployment fails due to
invalid container name.

This patch changes to create the container name after drooping ":" and
"@" both separately.
2018-04-08 21:50:15 +09:00
Kubernetes Submit Queue dfd6f581b5
Merge pull request #62196 from liggitt/create-dry-run
Automatic merge from submit-queue (batch tested with PRs 60900, 62215, 62196). 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 need for server connections for dry-run create

when running create commands in --dry-run mode, we don't need a server connection or restmapper information

```release-note
NONE
```
2018-04-06 21:30:12 -07:00
Kubernetes Submit Queue a15c46f4b8
Merge pull request #62215 from soltysh/fix_example
Automatic merge from submit-queue (batch tested with PRs 60900, 62215, 62196). 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 create job usage

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes the issue mentioned by @MrBlaise in https://github.com/kubernetes/kubernetes/pull/60084#issuecomment-378505504

/assign @juanvallejo 

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-04-06 21:30:09 -07:00
Kubernetes Submit Queue ee8c6d99b6
Merge pull request #62214 from soltysh/remove_factory_duplication
Automatic merge from submit-queue (batch tested with PRs 62208, 62114, 62144, 60460, 62214). 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>.

Get namespace and selectors for attach and logs in a common function

**Special notes for your reviewer**:
I've squashed the two places we need to update to be able to get selector and namespace for resource when getting logs or attaching to it. 

/assign @juanvallejo @deads2k 

**Release note**:
```release-note
NONE
```
2018-04-06 17:06:20 -07:00
Kubernetes Submit Queue 115f80a9b9
Merge pull request #62144 from juanvallejo/jvallejo/wire-print-flags-set-cmds
Automatic merge from submit-queue (batch tested with PRs 62208, 62114, 62144, 60460, 62214). 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>.

wire printflags through set commands

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

~~Depends on https://github.com/kubernetes/kubernetes/pull/62139
Opening now to test with CI~~

Wires PrintFlags through all `kubectl set` commands.

cc @soltysh @deads2k
2018-04-06 17:06:12 -07:00
Kubernetes Submit Queue cba403024f
Merge pull request #62114 from deads2k/cli-22-jobs
Automatic merge from submit-queue (batch tested with PRs 62208, 62114, 62144, 60460, 62214). 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 job scaler, continued

Builds on https://github.com/kubernetes/kubernetes/pull/61912 (original commit is there for credit/blame)

This keeps all the updates to the scaler building and all the test and reaper cleanup.  It just keeps a fake job scaler around for a different command path and the reaper.

/assign @p0lyn0mial 
/assign @soltysh 

```release-note
NONE
```
2018-04-06 17:06:09 -07:00
Maciej Szulik 370bdba4cf
Fix create job usage 2018-04-06 23:31:53 +02:00
Maciej Szulik 461e583f66
Get namespace and selectors for attach and logs in a common function 2018-04-06 23:14:39 +02:00
juanvallejo 2a202cf49a
update PrintFlags#Complete to receive string template 2018-04-06 16:44:40 -04:00
juanvallejo b8dc20646c
wire printflags through set cmds 2018-04-06 10:48:36 -04:00
Jordan Liggitt 37903834de
Remove need for server connections for dry-run create 2018-04-06 10:33:32 -04:00
Michal Fojtik 40d8a4bf60
Fix getting logs from daemonset 2018-04-06 13:31:59 +02:00
Dr. Stefan Schimanski 0fdd3d04d2 Update bazel 2018-04-06 11:08:09 +02:00
Dr. Stefan Schimanski 0fc2c48444 kubectl: add JSON fallback codec to cope with more strict stock versioning codec 2018-04-06 11:08:09 +02:00
Kubernetes Submit Queue 07d1a8cb0c
Merge pull request #61216 from hanxiaoshuai/fixtodo0315
Automatic merge from submit-queue (batch tested with PRs 59285, 61216). 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 unit test for func parsePorts and validate

**What this PR does / why we need it**:
add unit test for func parsePorts and validate
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-05 19:49:09 -07:00
Kubernetes Submit Queue 08f931d84a
Merge pull request #59285 from Addepar/fix-apply-logging
Automatic merge from submit-queue (batch tested with PRs 59285, 61216). 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>.

Do not log unchanged message if a format other than 'name' is specified

**What this PR does / why we need it**:
When specifying an output format, the "unchanged" message screws up the output format.

**Which issue(s) this PR fixes**:
Fixes #58836

**Special notes for your reviewer**: N/A

**Release note**:

```release-note
NONE
```
2018-04-05 19:49:06 -07:00
juanvallejo 4b4b6c879a
begin wiring printflags through set cmds 2018-04-05 16:34:51 -04:00
David Eads 1fec6980b6 segregate job scaling from everything else 2018-04-05 10:24:34 -04:00
p0lyn0mial 3b00b4a86f removes job scaler 2018-04-04 08:23:21 -04:00
Kubernetes Submit Queue 263897a31c
Merge pull request #58420 from kragniz/valid-resource-printing
Automatic merge from submit-queue (batch tested with PRs 58420, 60483). 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: make error with resource list prettier

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

Previously, running commands like `kubectl get` with no further
arguments would print a list of valid resource types with an error
messages formatted like so:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.

This commit adds extra spacing so it now looks pretty:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')

    error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.





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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-04 05:03:05 -07:00
Kubernetes Submit Queue 98e89770c6
Merge pull request #61506 from juanvallejo/jvallejo/add-humanreadable-flags
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>.

wire through humanreadable print flags

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

~~Work in progress... Opening PR now to gather feedback as this is implemented.~~

Begin implementing pieces needed to retrieve humanreadable printers from a set of flags.
Proposal: https://docs.google.com/document/d/19ZZFVe9oD1KQmk5uExggRWtRl_hKGfYnBXvHZJlgEro/edit#heading=h.pnvbfi14v4zz

cc @soltysh @deads2k @pwittrock
2018-04-03 22:01:47 -07:00
Kubernetes Submit Queue 229d2df48a
Merge pull request #42873 from xilabao/add-apiresources-command
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 kubectl api-resources command

**What this PR does / why we need it**:
As the RBAC role need to be related to resources. I think we can use the command to get the supported resources. 

```
# ./cluster/kubectl.sh api-resources   
NAME                                  SHORTNAMES   APIGROUP                       NAMESPACED   KIND
bindings                                                                          true         Binding
componentstatuses                     cs                                          false        ComponentStatus
configmaps                            cm                                          true         ConfigMap
endpoints                             ep                                          true         Endpoints
events                                ev                                          true         Event
limitranges                           limits                                      true         LimitRange
namespaces                            ns                                          false        Namespace
nodes                                 no                                          false        Node
persistentvolumeclaims                pvc                                         true         PersistentVolumeClaim
persistentvolumes                     pv                                          false        PersistentVolume
pods                                  po                                          true         Pod
podtemplates                                                                      true         PodTemplate
replicationcontrollers                rc                                          true         ReplicationController
resourcequotas                        quota                                       true         ResourceQuota
secrets                                                                           true         Secret
serviceaccounts                       sa                                          true         ServiceAccount
services                              svc                                         true         Service
externaladmissionhookconfigurations                admissionregistration.k8s.io   false        ExternalAdmissionHookConfiguration
initializerconfigurations                          admissionregistration.k8s.io   false        InitializerConfiguration
customresourcedefinitions             crd          apiextensions.k8s.io           false        CustomResourceDefinition
apiservices                                        apiregistration.k8s.io         false        APIService
controllerrevisions                                apps                           true         ControllerRevision
daemonsets                            ds           apps                           true         DaemonSet
deployments                           deploy       apps                           true         Deployment
replicasets                           rs           apps                           true         ReplicaSet
statefulsets                          sts          apps                           true         StatefulSet
tokenreviews                                       authentication.k8s.io          false        TokenReview
localsubjectaccessreviews                          authorization.k8s.io           true         LocalSubjectAccessReview
selfsubjectaccessreviews                           authorization.k8s.io           false        SelfSubjectAccessReview
subjectaccessreviews                               authorization.k8s.io           false        SubjectAccessReview
horizontalpodautoscalers              hpa          autoscaling                    true         HorizontalPodAutoscaler
jobs                                               batch                          true         Job
certificatesigningrequests            csr          certificates.k8s.io            false        CertificateSigningRequest
daemonsets                            ds           extensions                     true         DaemonSet
deployments                           deploy       extensions                     true         Deployment
ingresses                             ing          extensions                     true         Ingress
networkpolicies                       netpol       extensions                     true         NetworkPolicy
podsecuritypolicies                   psp          extensions                     false        PodSecurityPolicy
replicasets                           rs           extensions                     true         ReplicaSet
networkpolicies                       netpol       networking.k8s.io              true         NetworkPolicy
poddisruptionbudgets                  pdb          policy                         true         PodDisruptionBudget
clusterrolebindings                                rbac.authorization.k8s.io      false        ClusterRoleBinding
clusterroles                                       rbac.authorization.k8s.io      false        ClusterRole
rolebindings                                       rbac.authorization.k8s.io      true         RoleBinding
roles                                              rbac.authorization.k8s.io      true         Role
podpresets                                         settings.k8s.io                true         PodPreset
storageclasses                        sc           storage.k8s.io                 false        StorageClass
```
**Which issue this PR fixes**: fixes https://github.com/kubernetes/kubernetes/issues/42932

**Special notes for your reviewer**:

**Release note**:

```release-note
add kubectl api-resources command to discovery of resources
```
2018-04-03 14:35:09 -07:00
juanvallejo a3a430ce01
wire through humanreadable flags 2018-04-03 13:59:35 -04:00
Christoph Blecker 857aac9ae4
Update gofmt for go1.10 2018-04-02 17:44:04 -07:00
Kubernetes Submit Queue c46738a3f0
Merge pull request #60073 from justaugustus/int-to-int32ptr
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>.

Use `pkg/util/pointer` functions instead of self-written versions

**What this PR does / why we need it**:
Replaces instances of module-written `int(32|64)? --> *int(32|64)?` functions with functions from k8s.io/kubernetes/pkg/util/pointer

**Special notes for your reviewer**:

Here's the grep used, based on the comments in:
* https://github.com/kubernetes/kubernetes/pull/59924#issuecomment-366119396
* https://github.com/kubernetes/kubernetes/issues/59971#issue-297766556

```bash
$ git grep -E 'func\ [^ (]+\([^ ]+\ int(32|64)?\)\ \*int(32|64)?' !(vendor|staging) | grep -v pkg/util/pointer

pkg/apis/apps/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/apps/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/apps/v1beta2/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/v2beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/autoscaling/validation/validation_test.go:func newInt32(val int32) *int32 {
pkg/apis/batch/v1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/batch/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/apis/core/v1/defaults_test.go:func newInt(val int32) *int32 {
pkg/apis/core/validation/validation_test.go:func newInt32(val int) *int32 {
pkg/apis/extensions/v1beta1/defaults_test.go:func newInt32(val int32) *int32 {
pkg/controller/deployment/sync_test.go:func intOrStrP(val int) *intstr.IntOrString {
pkg/kubectl/autoscale_test.go:func newInt32(value int) *int32 {
plugin/pkg/admission/security/podsecuritypolicy/admission_test.go:func userIDPtr(i int) *int64 {
plugin/pkg/admission/security/podsecuritypolicy/admission_test.go:func groupIDPtr(i int) *int64 {
test/e2e/apps/deployment.go:func intOrStrP(num int) *intstr.IntOrString {
test/e2e/auth/pod_security_policy.go:func intPtr(i int64) *int64 {
test/integration/deployment/util.go:func intOrStrP(num int) *intstr.IntOrString {
```

**Release note**:

```release-note
NONE
```
/kind cleanup
/cc @php-coder 
/assign @tallclair
2018-04-02 16:22:28 -07:00
Kubernetes Submit Queue d3bed1e5c9
Merge pull request #61985 from liggitt/show-kind
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>.

Restore show-kind function when printing multiple kinds

Fixes #61979 

* Makes the human readable printer work off the options given to it for displaying kind
* Simplifies get.go to pass showkind/kind options into the printer rather than doing conditional fixup afterward

```release-note
kubectl: restore the ability to show resource kinds when displaying multiple objects
```
2018-04-01 20:07:56 -07:00
Jordan Liggitt 3b8a570437
Restore show-kind function when printing multiple kinds 2018-04-01 00:24:25 -04:00
Clayton Coleman c7b37767ba
Make certificate approve/deny no-op if CSR is already approved
Approval for CSRs is only needed once. If the CSR is already approved or
denied we can skip updating it. Add a `--force` flag that allows the
existing behavior for when a user has a specific need to update the CSR.

This is backwards compatible with the intended use of the conditions,
although it's possible some users are depending on the status being
updated. It makes bulk approval as an admin much faster for scripting.
2018-03-31 00:05:06 -04:00
Kubernetes Submit Queue 8f7eb4e6ac
Merge pull request #61713 from mountkin/fix-cli-run-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>.

kubectl: fix a panic when createGeneratedObject failed

**What this PR does / why we need it**:
This PR fixed two bugs in the `kubectl run` command.
The first commit fixed a panic that can be reproduced with the following two commands:
```bash
kubectl run --image=alpine hello -- sleep 1d
kubectl run --image=alpine --stdin --tty --attach hello -- /bin/sh
```
When the panic happens, the stack trace is as the following: 
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x12f92e6]

goroutine 1 [running]:
k8s.io/kubernetes/pkg/kubectl/cmd.RunRun(0x1890d20, 0xc4207f6210, 0x184e700, 0xc42000c010, 0x184e720, 0xc42000c018, 0x184e720, 0xc42000c020, 0xc42052ef00, 0xc42054f980, ...)
	/home/star/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/run.go:328 +0x10b6
k8s.io/kubernetes/pkg/kubectl/cmd.NewCmdRun.func1(0xc42052ef00, 0xc42054f980, 0x2, 0x8)
	/home/star/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/run.go:105 +0x144
...
```
The reason for the panic is that the original code didn't handle the error returned by `createGeneratedObject` correctly. See https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/run.go#L281
If the function `createGeneratedObject` fails, the returned `runObject` will be `nil`.  At https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/run.go#L328 a nil pointer dereference will happen.

The second problem this PR fixed is a resource leak if both `--rm` and `--expose` flags are provided. The original code used a map (https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/run.go#L280) to trace the created objects. But at https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/run.go#L296 the code will overwrite the previously created object with the same key. So at https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/run.go#L348 only the service will be deleted. The deployment will be left behind.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind bug
/sig cli
2018-03-30 13:19:31 -07:00
Kubernetes Submit Queue 9ec2860124
Merge pull request #60565 from WanLinghao/kubectl_cp_slash
Automatic merge from submit-queue (batch tested with PRs 60990, 60947, 45275, 60565, 61091). 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 cp command bug fix

**What this PR does / why we need it**:
	when copy file from host to pod like this:	
        1.kubectl copy /tmp/test-file test-pod:/
	2.kubectl copy /tmp/test-file test-pod:
	example 1 will fail, example 2 will cause a panic.
	This patch fix bugs above.


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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-30 11:53:13 -07:00
Kubernetes Submit Queue cea4284677
Merge pull request #45275 from CaoShuFeng/log-l
Automatic merge from submit-queue (batch tested with PRs 60990, 60947, 45275, 60565, 61091). 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 multi-container pod for "kubectl logs"

kubectl logs -l will print logs for pods with the same label, however it doesn't support pods with multi containers. This change adds support to it with --all-containers.

Ussage:
$ kubectl logs my-pod --all-containers
$ kubectl logs -laa=bb --all-containers
$ kubectl logs my-pod my-container --all-containers (err: container should not combined with --all-containers)

**Release note**:

```
add --all-containers option to "kubectl log"
```

Fixes:
https://github.com/kubernetes/kubectl/issues/371
2018-03-30 11:53:10 -07:00
Kubernetes Submit Queue f165ad7cd2
Merge pull request #60947 from fanzhangio/replace
Automatic merge from submit-queue (batch tested with PRs 60990, 60947, 45275, 60565, 61091). 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 conflict detection feature to apply strategy

- Add DetectConflictor interface on Element level. Implemented it for particular elements.
- If Options.FailOnConflict is enabled, Merge will detect conflict by invoking doConflictDecect for particular element,
  returning ConflictError with details.
- Add tests, including use case examples and illustration. For example: list, map, and complicated combination.

**What this PR does / why we need it**:
Apply is being rewritten under pkg/kubectl/apply/strategy based on visitor pattern. The new merge and replace code should check for conflicts between the recorded value and the remote value, and optionally return an error if they do not match with the field and details. A conflict is if the same field is specified in BOTH the recorded and the remote values of an object, but does not match.

**Which issue(s) this PR fixes**:
Fixes #60945 
https://github.com/kubernetes/kubectl/issues/97

**Release note**:

```release-note
NONE
```
2018-03-30 11:53:07 -07:00
Kubernetes Submit Queue a13dee2337
Merge pull request #60990 from bmcstdio/bcustodio/kubectl-edit
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>.

Ensure reasons end up as comments in kubectl edit.

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

This PR helps making sure that all text in the header of the file is prefixed with `#` when using `kubectl edit` to fix schema validation errors. The problem is best described with an example:

*Before:*

```yaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# mycrd "example-cr" was not valid:
# * []: Invalid value: map[string]interface {}{"apiVersion":"example.com/v1alpha1", "kind":"MyCRD", "metadata":map[string]interface {}{"clusterName":"", "creationTimestamp":"2018-03-09T16:16:41Z", "name":"example-cr", "namespace":"default", "resourceVersion":"12399", "selfLink":"", "uid":"4089f5bd-23b5-11e8-a33f-42010aa40081", "generation":0}, "spec":map[string]interface {}{"size":-1}}: validation failure list:
spec.size in body should be greater than or equal to 1
#
apiVersion: example.com/v1alpha1
kind: MyCRD
```

This obviously won't be accepted as input, the user having to manually add a `#` to the line in the header.

*After:*

```yaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# mycrd "example-cr" was not valid:
# * []: Invalid value: map[string]interface {}{"apiVersion":"example.com/v1alpha1", "kind":"MyCRD", "metadata":map[string]interface {}{"clusterName":"", "creationTimestamp":"2018-03-09T16:16:41Z", "name":"example-cr", "namespace":"default", "resourceVersion":"12399", "selfLink":"", "uid":"4089f5bd-23b5-11e8-a33f-42010aa40081", "generation":0}, "spec":map[string]interface {}{"size":-1}}: validation failure list:
# spec.size in body should be greater than or equal to 1
#
apiVersion: example.com/v1alpha1
kind: MyCRD
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
(None that I am aware of)

**Special notes for your reviewer**:
(None)

**Release note**:

```release-note
Ensure reasons end up as comments in `kubectl edit`.
```
2018-03-30 11:23:29 -07:00
Kubernetes Submit Queue 30a8f7d1bd
Merge pull request #61574 from zjj2wry/kubectl-config-view-raw
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 kubectl config view --raw example help user use

**What this PR does / why we need it**:
ref https://github.com/kubernetes/kubernetes/issues/61573

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


**Special notes for your reviewer**:
cc @liggitt @soltysh @juanvallejo 
**Release note**:

```release-note
NONE
```
2018-03-28 19:57:55 -07:00
Kubernetes Submit Queue 9c19c4e338
Merge pull request #61477 from soltysh/server_print_default
Automatic merge from submit-queue (batch tested with PRs 61842, 61477, 61777). 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>.

Turn server-print on by default in kubectl

**What this PR does / why we need it**:
#55637 introduced `-experimental-server-print` that enabled users to opt-in to user server-side printing. This is a followup which enables this functionality by default, with the ability to fallback not to do it with `--server-print=false`. 

/assign @smarterclayton @juanvallejo 

**Release note**:
```release-note
Enable server-side print in kubectl by default, with the ability to turn it off with --server-print=false
```
2018-03-28 15:57:09 -07:00
Kubernetes Submit Queue 831198edbc
Merge pull request #61808 from liggitt/dry-run-printing
Automatic merge from submit-queue (batch tested with PRs 61790, 61808, 60339, 61615, 61757). 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>.

Ensure -o yaml populates kind/apiVersion

Fixes #61780 

```release-note
kubectl: fixes issue with `-o yaml` and `-o json` omitting kind and apiVersion when used with `--dry-run`
```
2018-03-28 09:39:12 -07:00
Kubernetes Submit Queue dea3c0a610
Merge pull request #61790 from deads2k/cli-21-scaler
Automatic merge from submit-queue (batch tested with PRs 61790, 61808, 60339, 61615, 61757). 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 reapers tolerate 404s on scaling down

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

This fixes the scale client to return the actual API error, not a wrapped one.  It also updates scalers to do the same.  Then it fixes the reapers to tolerate 404s, since that means they achieved their objective.

/assign @janetkuo 
/assign @p0lyn0mial 

```release-note
NONE
```
2018-03-28 09:39:08 -07:00
David Eads 1272fda299 make reapers tolerate 404s on scaling down 2018-03-28 08:25:21 -04:00
Kubernetes Submit Queue e00a60283f
Merge pull request #61146 from dims/add-missing-binary-field-to-configmap-hash
Automatic merge from submit-queue (batch tested with PRs 60465, 61773, 61371, 61146). 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 missing binaryData field to the ConfigMap Hash

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

In 7e158fb4f6, we added a BinaryData
to ConfigMap, but totally forgot to add it to the hash method.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-28 01:34:54 -07:00
Shijiang Wei c0e0dafa4b avoid resource leak when both `--rm` and `--expose` are specified
Before this patch, the deployment `leak-test` won't be removed
after the following command exits.
kubectl run --image=nginx:alpine --stdin --attach \
  --rm --expose --port 80 leak-test -- sh
This patch ensures both the deployment and the service are all removed.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2018-03-28 11:34:08 +08:00
Jordan Liggitt a174d7a2de
Ensure -o yaml populates kind/apiVersion 2018-03-27 23:27:40 -04:00
Shijiang Wei 2f485ec84b kubectl: fix a panic when createGeneratedObject failed
Reproduce:
kubectl run --image=alpine hello -- sleep 1d
kubectl run --image=alpine --stdin --tty --attach hello -- /bin/sh

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2018-03-28 11:26:00 +08:00
WanLinghao e96794e689 when copy file from host to pod like this:
1.kubectl copy /tmp/test-file test-pod:/
	2.kubectl copy /tmp/test-file test-pod:
	example 1 will fail, example 2 will cause a panic.
	This patch fix bugs above.
2018-03-28 10:37:29 +08:00
Kubernetes Submit Queue 2b03013307
Merge pull request #61692 from CaoShuFeng/output-version
Automatic merge from submit-queue (batch tested with PRs 61452, 61727, 61462, 61692, 61738). 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>.

clean up output-version

ref: https://github.com/kubernetes/kubernetes/pull/41576

**Release note**:
```release-note
NONE
```
2018-03-27 09:47:18 -07:00
Kubernetes Submit Queue 13378f4643
Merge pull request #61462 from WanLinghao/kubectl_return_obj_fix
Automatic merge from submit-queue (batch tested with PRs 61452, 61727, 61462, 61692, 61738). 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 print object should be updated error

**What this PR does / why we need it**:
	Print object should be updated.
  After this patch, it goes the same as create.go
0254399884/pkg/kubectl/cmd/create.go (L346)
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-27 09:47:15 -07:00
Stephen Augustus c3a50cd266 Update bazel rules 2018-03-27 09:54:04 -05:00
Stephen Augustus 09aa0b9c1d pkg/util/pointer: Update `int` pointer functions
* Implement `Int64Ptr` function
* Replace per module functions of `int(32|64)?` --> `*int(32|64)?`
* Update bazel rules
2018-03-27 10:30:01 -04:00
Kubernetes Submit Queue 76ffe9e832
Merge pull request #58787 from Lion-Wei/kubectl-3
Automatic merge from submit-queue (batch tested with PRs 60499, 61715, 61688, 61300, 58787). 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 kubectl apply error message

**What this PR does / why we need it**:
Fix messy code in kubectl apply error message. 

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes/kubectl#197

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
/sig cli
2018-03-27 04:08:15 -07:00
Kubernetes Submit Queue d885863793
Merge pull request #60499 from superbrothers/last-applied
Automatic merge from submit-queue (batch tested with PRs 60499, 61715, 61688, 61300, 58787). 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 completion for kubectl apply view/edit-last-applied

**What this PR does / why we need it**: With this PR, `kubectl apply view/edit-last-applied` support completion.
```
$ kubectl apply view-last-applied <tab>
certificatesigningrequest  configmap           daemonset   event                    job            node                   pod                  podtemplate            rolebinding  serviceaccount  storageclass
clusterrolebinding         controllerrevision  deployment  horizontalpodautoscaler  namespace      persistentvolume       poddisruptionbudget  replicaset             secret       statefulset     
componentstatus            cronjob             endpoints   ingress                  networkpolicy  persistentvolumeclaim  podsecuritypolicy    replicationcontroller  service      status
$ kubectl apply view-last-applied deployment nginx<tab>
nginx   nginx2
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
`kubectl apply view/edit-last-applied support completion.
```
2018-03-27 04:08:04 -07:00
Cao Shufeng a06f0077bd Support multi-container pod for "kubectl logs"
kubectl logs -l will print logs for pods with the same label, however
it doesn't support pods with multi containers. This change adds support
to it with --all-containers.

Ussage:
$ kubectl logs my-pod --all-containers
$ kubectl logs -laa=bb --all-containers
$ kubectl logs my-pod my-container --all-containers (err: --all-containers=true should not be specifiled with container name my-container)
2018-03-27 11:44:31 +08:00
p0lyn0mial 1f1d24005a removes custom scalers from kubectl 2018-03-26 19:33:42 +02:00
Kubernetes Submit Queue c64494a0cb
Merge pull request #61442 from anfernee/simple-fixes
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 comments and small fixes

**What this PR does / why we need it**: Fix some comments, and remove trivial duplicates. 

**Release note**:
```release-note
None
```
2018-03-26 06:35:41 -07:00
Kubernetes Submit Queue 3a2fe7b8f9
Merge pull request #61523 from dixudx/formatter_escape_percent_sign
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>.

escape literal percent sign when formatting

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

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

**Special notes for your reviewer**:
/assign @janetkuo @liggitt 
/cc @kubernetes/sig-cli-bugs 

**Release note**:

```release-note
escape literal percent sign when formatting
```
2018-03-26 03:52:16 -07:00
Maciej Szulik 94d8b93239
Turn server-print on by default in kubectl 2018-03-26 12:30:12 +02:00
Cao Shufeng 51224740f5 clean up output-version 2018-03-26 15:40:40 +08:00
Kubernetes Submit Queue fba61b050a
Merge pull request #60675 from timoreimann/support-dry-run-in-kubectl-patch
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 support for --dry-run to kubectl patch.

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

Add support for the `--dry-run` flag to `kubectl patch`. This is helpful to be able to preview patches prior to applying them.

**Which issue(s) this PR fixes**:
Refs #11488

**Special notes for your reviewer**:

This PR carries #45712.

**Release note**:
```release-note
`kubectl patch` now supports `--dry-run`.
```
2018-03-25 12:24:08 -07:00
Kazuki Suda 1989aa5023 Support completion for kubectl apply view/edit-last-applied 2018-03-24 14:42:02 +09:00
fanzhangio 0299a2403f Add conflict detection feature to apply strategy
- Add DetectConflictor interface on Element level. Implemented it for particular elements.
- If Options.FailOnConflict is enabled, Merge will detect conflict by invoking doConflictDecect for particular element,
  returning ConflictError with details.
- Add tests, including use case examples and illustration. For example: list, map, and complicated combination.
2018-03-23 01:56:20 -07:00
Di Xu d0dbd94db0 escape literal percent sign when formatting 2018-03-23 12:59:50 +08:00
zhengjiajin 457a7e76d9 add kubectl config view --raw example help user use 2018-03-23 09:51:47 +08:00
Kubernetes Submit Queue 3798b1f842
Merge pull request #61378 from charrywanganthony/delete_force
Automatic merge from submit-queue (batch tested with PRs 61378, 60915, 61499, 61507, 61478). 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>.

`--force` only takes effect when `--grace-period=0`

`kubectl delete` should warn when `force` is specified without `--grace-period=0`

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


**Release note**:
```release-note
NONE
```
2018-03-22 07:15:15 -07:00
Kubernetes Submit Queue 114d481183
Merge pull request #60793 from charrywanganthony/inert_flag_showall
Automatic merge from submit-queue (batch tested with PRs 60793, 61181, 61267, 61252, 61334). 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>.

--show-all is inert in v1.11

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

`--show-all` is inert in v1.11
ref: #60210

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

**Release note**:

```release-note
`--show-all` (which only affected pods and only for human readable/non-API printers) is inert in v1.11, and will be removed in a future release.
```
2018-03-21 20:23:07 -07:00
Kubernetes Submit Queue 32858f98b3
Merge pull request #60806 from juanvallejo/jvallejo/add-from-literal-from-value-flags
Automatic merge from submit-queue (batch tested with PRs 60632, 60806, 59471, 61251, 61013). 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 --from-literal --from-file docker-reg secret

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

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

Adds `--from-file` and `--from-literal` flag support to `kubectl create secret docker-registry`.
These flags have the same behavior as their counterparts in `kubectl create secret generic`.

cc @bparees @soltysh
2018-03-21 16:01:11 -07:00
Kubernetes Submit Queue b8433123b2
Merge pull request #61219 from WanLinghao/description_fix
Automatic merge from submit-queue (batch tested with PRs 61487, 58353, 61078, 61219, 60792). 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 a small error in description

**What this PR does / why we need it**:
The example in create job subcommand lacks job-name, this patch fixes this
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-21 14:15:17 -07:00
Kubernetes Submit Queue 5286806a52
Merge pull request #58353 from juanvallejo/jvallejo/usability-fix-label
Automatic merge from submit-queue (batch tested with PRs 61487, 58353, 61078, 61219, 60792). 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>.

distinguish which labels belong to resource

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

Usability improvement for `kubectl label ... --list` when listing labels for more than one resource.
Append resource kind/name before its set of labels.

**Before**
```
$ kubectl label dc myapp test-deployment-config label1=test --list
app=myapp
label1=test
label1=test
```

**After**
```
$ kubectl label dc myapp test-deployment-config label1=test --list
Listing labels for DeploymentConfig/myapp:
  label1=test
  app=myapp
Listing labels for DeploymentConfig/test-deployment-config:
  label1=test
```
2018-03-21 14:15:10 -07:00
Kubernetes Submit Queue e40ffd7197
Merge pull request #59172 from fisherxu/removeyear
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 YEAR field of all generated files and fix kubernetes boilerplate checker

**What this PR does / why we need it**:
Remove YEAR field of all generated files and fix kubernetes boilerplate checker
xref: [remove YEAR fileds in gengo #91](https://github.com/kubernetes/gengo/pull/91)

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes [#gengo/issues/24](https://github.com/kubernetes/gengo/issues/24)

**Special notes for your reviewer**:
/cc @thockin @lavalamp @sttts 

**Release note**:

```release-note
NONE
```
2018-03-21 12:44:37 -07:00
Timo Reimann b9c1fc6f3c Support --dry-run in kubectl patch command. 2018-03-21 19:06:44 +01:00
juanvallejo ae51a45d70
add --from-file flag to docker-registry secret 2018-03-21 11:13:11 -04:00
Kubernetes Submit Queue 808545a8aa
Merge pull request #60602 from bendrucker/docker-registry-email-optional
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 docker-email from required args for "create secret docker-registry"

Completes https://github.com/kubernetes/kubernetes/pull/42191

While that removed `docker-email` as required from the generator, the CLI still asserts the presence of the argument resulting in "error: flag docker-email is required" when `--docker-email` is omitted from a `kubectl create secret docker-registry` call.

Comments on the original issue (https://github.com/kubernetes/kubernetes/issues/41727) note that this change is still needed to accomplish the original intent.
2018-03-21 07:34:21 -07:00
Kubernetes Submit Queue 3b04de4be3
Merge pull request #60826 from WanLinghao/job_dry_run
Automatic merge from submit-queue (batch tested with PRs 61087, 61075, 61213, 61149, 60826). 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 support for --dry-run to kubectl create job

**What this PR does / why we need it**:
Create job subcommand lacks dry-run flag, this patch fix this.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-21 06:41:38 -07:00
tianshapjq 112c76488d clean code 2018-03-21 16:41:40 +08:00
Chao Wang 4e6a430bce `--force` only takes effect when `--grace-period=0` 2018-03-21 16:28:52 +08:00
WanLinghao 83a148310d Print object should be updated which may cause potential bug.
This patch fix this.
	modified:   pkg/kubectl/cmd/create_clusterrole.go
	modified:   pkg/kubectl/cmd/create_role.go
2018-03-21 15:34:50 +08:00
Kubernetes Submit Queue 23844fe0f4
Merge pull request #57871 from CaoShuFeng/delete_test
Automatic merge from submit-queue (batch tested with PRs 57871, 61094, 60459, 61089, 61105). 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 invalid comments in unit tests

**Release note**:

```release-note
NONE
```
2018-03-20 23:34:30 -07:00
WanLinghao a3424872bd this patch do tow things:
1.add dry-run flag for create job subcommand
	2.add cmd-util test for create job subcommand
	modified:   pkg/kubectl/cmd/create_job.go
	modified:   hack/make-rules/test-cmd-util.sh
2018-03-21 10:41:17 +08:00
Kubernetes Submit Queue 3e5596321e
Merge pull request #60919 from dixudx/file_visit_error_info
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>.

include file name in the error when visiting files

**What this PR does / why we need it**:
/kind bug
/sig cli

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

**Special notes for your reviewer**:
/cc @kubernetes/sig-cli-api-reviews 
**Release note**:

```release-note
include file name in the error when visiting files
```
2018-03-20 19:34:23 -07:00
Kubernetes Submit Queue 4159be8a5a
Merge pull request #60360 from dixudx/kubectl_apply_flag_value_bind
Automatic merge from submit-queue (batch tested with PRs 61003, 61031, 60360, 58349, 60922). 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>.

flag value bindings for kubectl apply commands

**What this PR does / why we need it**:
/kind cleanup
/sig cli

xxxOptions did not get bound as default value for some flags.
This PR cleans those flag bindings for `kubectl apply` commands.

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

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

**Release note**:

```release-note
None
```
2018-03-20 18:34:32 -07:00
Kubernetes Submit Queue 16081cca2b
Merge pull request #61031 from zjj2wry/kubectl_create_role
Automatic merge from submit-queue (batch tested with PRs 61003, 61031, 60360, 58349, 60922). 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>.

resource-name not present in the URL for list,watch,deletecollection

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

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

**Special notes for your reviewer**:
cc @deads2k @liggitt 
/sig cli
/sig auth

**Release note**:

```release-note
NONE
```
2018-03-20 18:34:29 -07:00
Chao Wang 71a1970bf6 --show-all is inert in v1.11 2018-03-21 09:13:21 +08:00
Yongkun Anfernee Gui 0ce78700ae Fix comments and some small fixes 2018-03-20 15:59:23 -07:00
Kubernetes Submit Queue e8388e035b
Merge pull request #60357 from dixudx/kubectl_a2e_flags_bind
Automatic merge from submit-queue (batch tested with PRs 60574, 60666, 60831, 60877, 60357). 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>.

flag value bindings for kubectl attach/convert/delete/drain/edit/exec commands

**What this PR does / why we need it**:
xxxOptions did not get bound as default value for flags.
This PR cleans those flag bindings for `kubectl  attach/convert/delete/drain/edit/exec` commands.

/kind cleanup

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

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

**Release note**:

```release-note
None
```
2018-03-20 08:34:47 -07:00
Kubernetes Submit Queue 3d726a28bd
Merge pull request #60363 from dixudx/kubectl_set_create_flags_bind
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>.

flag value bindings for kubectl create/get/set commands

**What this PR does / why we need it**:
/kind cleanup
/sig cli

xxxOptions did not get bound as default value for some flags.
This PR cleans those flag bindings for `create/get/set` commands.

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

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

**Release note**:

```release-note
None
```
2018-03-20 02:34:22 -07:00
Kubernetes Submit Queue a41483a8f5
Merge pull request #60353 from WanLinghao/printer_clean
Automatic merge from submit-queue (batch tested with PRs 60189, 59542, 59931, 60621, 60353). 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>.

clean testprinter

**What this PR does / why we need it**:
testPrinter became useless after patch #60117 
This patch clean it 

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-20 00:42:20 -07:00
Kubernetes Submit Queue 8962c78577
Merge pull request #60621 from WanLinghao/kubectl_flags_bind_miss
Automatic merge from submit-queue (batch tested with PRs 60189, 59542, 59931, 60621, 60353). 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>.

supplement for the fix of kubectl default value binding

**What this PR does / why we need it**:
Issue https://github.com/kubernetes/kubernetes/issues/60366
lists a bunch of PRs that fix kubectl default value binding problems.
This patch supplement a missed file.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #60366

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-20 00:42:15 -07:00
Kubernetes Submit Queue b43f18d43b
Merge pull request #61204 from janetkuo/ep-doc
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>.

Document that endpoints is only plural in resource aliases

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-19 20:34:53 -07:00
hangaoshuai c26293b848 fix failed verify misspell err 2018-03-20 11:16:51 +08:00
Lion-Wei e2dedc76a8 fix kubectl apply error message 2018-03-17 15:08:26 +08:00
Brendan Burns d196afabc4 Fix a bug where malformed paths don't get written to the destination dir. 2018-03-16 12:19:31 -07:00
hangaoshuai 3fe980f8ed add unit test for func parsePorts and validate 2018-03-16 09:54:52 +08:00
WanLinghao 8653c5ece2 fix a small error in description
modified:   pkg/kubectl/cmd/create_job.go
2018-03-15 16:51:15 +08:00
Janet Kuo b5b76d8187 Document that endpoints is only plural in resource aliases 2018-03-14 16:02:51 -07:00
Davanum Srinivas 4cbdbae6e0 Add missing binaryData field to the ConfigMap Hash
In 7e158fb4f6, we added a BinaryData
to ConfigMap, but totally forgot to add it to the hash method.
2018-03-13 22:08:06 -04:00
juanvallejo 3dc952e761
fix kubectl_filedir completion 2018-03-13 16:21:30 -04:00
juanvallejo d1cb6e36f2
distinguish which labels belong to resource 2018-03-12 11:10:27 -04:00
zhengjiajin 17c9d1fa14 resource-name not present in the URL for list,watch,deletecollection 2018-03-12 16:29:18 +08:00
WanLinghao aec1240ca7 fix show-all option description
modified:   pkg/kubectl/cmd/util/printing.go
2018-03-12 10:34:08 +08:00
Bruno Miguel Custodio 6889dc82ef
Ensure reasons end up as comments in kubectl edit.
Signed-off-by: Bruno Miguel Custodio <brunomcustodio@gmail.com>
2018-03-10 13:08:50 +00:00
Cao Shufeng edce292a1f Remove invalid comments in unit tests 2018-03-10 15:08:12 +08:00
Kubernetes Submit Queue df36379670
Merge pull request #60950 from juanvallejo/jvallejo/use-temp-kubeconfig-file-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>.

use temp kubeconfig for fake factory

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

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

cc @deads2k @ixdy
2018-03-09 15:00:21 -08:00
juanvallejo 8d35f94d51
use temp kubeconfig for fake factory 2018-03-09 15:53:19 -05:00