Commit Graph

346 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
Phillip Wittrock aca62a1741 Address PR comments 2017-08-16 14:22:32 -07:00
Phillip Wittrock e97a18b435 Support for using a client-go client from kubectl 2017-08-13 12:52:29 -07:00
jianglingxia 9e8d4b4188 Renamed packge name to apiv1 2017-07-29 16:47:14 +08:00
Kubernetes Submit Queue bc3c5bc0d6 Merge pull request #49146 from apelisse/openapi-new-structure
Automatic merge from submit-queue (batch tested with PRs 49665, 49689, 49495, 49146, 48934)

openapi: refactor into more generic structure

**What this PR does / why we need it**:
Refactor the openapi schema to be a more generic structure that can be
"visited" to get more specific types. Will be used by validation.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-07-27 21:45:36 -07:00
shashidharatd dbbcb568d4 Converted usage of federation internal clientset to versioned clientset 2017-07-26 06:20:08 +05:30
Antoine Pelisse 064f806424 openapi: refactor into more generic structure
Refactor the openapi schema to be a more generic structure that can be
"visited" to get more specific types.
2017-07-25 11:45:29 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
juanvallejo d036686185
fix --local flag for `kubectl set` commands 2017-06-13 12:57:05 -04:00
Sunil Arora f768a63fb0 Get cmd uses print-column extn from Openapi schema
Get command now uses metadata x-kubernetes-print-columns, if present, in Openapi schema
to format output for a resource. This functionality is guarded by a boolean
flag 'use-openapi-print-columns'.
2017-06-06 13:30:24 -07:00
Waseem Ahmad 8442a118ea Denote if a printer is generic.
This fixes #38779.

This allows us to avoid case in which printers.GetStandardPrinter
returns nil for both printer and err removing any potential panics that
may arise throughout kubectl commands.

Please see #38779 and #38112 for complete context.

Add comment explaining adding handlers to printers.HumanReadablePrinter
also remove an unnecessary conversion of printers.HumanReadablePrinter
to printers.ResourcePrinter.
2017-05-31 13:02:23 +05:30
mbohlool ea042c6ca0 Update go-restful dependency 2017-05-05 13:57:01 -07:00
Fabiano Franz 2b178ad608 Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
Phillip Wittrock 212c2a3a72 kubectl OpenAPI support 2017-04-25 10:45:49 -07:00
Kubernetes Submit Queue f14618a56b Merge pull request #43622 from deads2k/cli-10-category
Automatic merge from submit-queue (batch tested with PRs 42087, 43383, 43622)

move category expansion out of restmapper

RESTMapping isn't related to CategoryExpansion (the bit that expands "all" into items to be RESTMapped).  This provides that separation and simplifies the RESTMapper interface.

@kubernetes/sig-cli-pr-reviews
2017-03-27 16:08:20 -07:00
deads2k 8895f314b4 move category expansion out of restmapper 2017-03-27 13:54:05 -04:00
shiywang 52e4be2578 Be able to specify the timeout to wait for pod for kubectl logs/attach 2017-03-14 23:00:31 +08:00
Maciej Szulik 27259358cb Switch ClientAccessFactory to use clientset.Interface rather than actual type 2017-02-27 13:13:06 +01:00
Kubernetes Submit Queue 082cfac707 Merge pull request #35408 from xilabao/add-secret-to-pflag
Automatic merge from submit-queue (batch tested with PRs 35408, 41915, 41992, 41964, 41925)

add secret option to flag

To resolve the issue of security(pr #35030 ),

> @smarterclayton commented 5 days ago
> This is unfortunately not all flags that could be secrets. The best option would be to add support in spf13/pflag to tag a flag as a secret, and then use that bit to determine the list.
> 
> Also, Command() could be used in contexts that need exact parameters (for subshell execution), so we would need to add a new method or extend the signature here to allow exact flags to be retrieved.

we could add a secret option to the flags.
2017-02-26 18:07:53 -08:00
xilabao 131802a5cd add secret flag to options 2017-02-25 23:40:50 +08:00
Clayton Coleman 19ae89dcd8
command Factory should provide Printers
The factory knows all possible types, and should abstract the process of
creating all printers. A future refactor can further reduce the
dependencies between printer code and internal types.
2017-02-23 00:28:31 -05:00
Jordan Liggitt dd6d454848
kubectl: remove ThirdPartyResourceData behavior for unregistered objects 2017-01-26 19:59:24 -05:00
deads2k 2734f8f892 move dynamic and discovery clients 2017-01-26 08:37:06 -05:00
Clayton Coleman 469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
deads2k 335ef747d6 mechanical 2017-01-23 10:03:55 -05:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k f1176d9c5c mechanical repercussions 2017-01-13 08:27:14 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Angus Salkeld 17a711d8fd Add new command "kubectl set selector" 2016-12-21 12:30:56 +01:00
deads2k 9b507e8603 prevent negotation on connections that dont' require it 2016-12-16 16:26:55 -05:00
deads2k 50f6733800 make kubectl factory rings 2016-12-15 15:18:16 -05:00
Jordan Liggitt 12806be2bf
Fix tests using internal types for generic printing 2016-12-09 16:26:05 -05:00
Michal Fojtik 737b32772e add ResolveImage function to CLI factory 2016-12-09 12:41:38 +01:00
deads2k b658552947 remove validation dependency on version negotiation 2016-12-07 13:23:20 -05:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Michail Kargakis 065b652961 kubectl: add create pdb subcommand 2016-12-02 18:42:25 +01:00
Kubernetes Submit Queue 74066816b6 Merge pull request #37098 from deads2k/cli-12-create-cbinding
Automatic merge from submit-queue

add create clusterrolebinding command

Adds `kubectl create clusterrolebinding`.

@kubernetes/sig-cli
2016-12-02 08:44:58 -08:00
Kubernetes Submit Queue bbd447f555 Merge pull request #34789 from AdoHe/external_service
Automatic merge from submit-queue

create service add create ExternalName service implementation

@kubernetes/kubectl create service add ExternalName support, refer #34731 for more detail.

```release-note
kubectl create service externalname
```
2016-12-02 07:29:06 -08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu 96cd71d8f6 kubectl 2016-11-23 15:53:09 -08:00
deads2k e300f01a1b add create clusterrolebinding command 2016-11-21 08:50:06 -05:00
deads2k 66e5c38d67 remove TPR registration, ease validation requirements 2016-11-16 14:04:35 -05:00
AdoHe d66bcbfa61 create service add create ExternalName service implementation 2016-11-16 04:47:10 -05:00
Maciej Szulik 0b5ef16008 Support ScheduledJob name 2016-11-07 10:14:12 +01:00
Maciej Szulik 41d88d30dd Rename ScheduledJob to CronJob 2016-11-07 10:14:12 +01:00
Dr. Stefan Schimanski 14ce6f6065 Add caching for discovery info 2016-11-04 21:17:12 +01:00
deads2k 61673c4b39 make kubectl get generic with respect to objects 2016-11-04 09:04:57 -04:00
deads2k 7fe9bd4c30 make kubectl delete generic 2016-11-04 07:50:31 -04:00
Madhusudan.C.S 1712a190cb [Federation][(Un)join-00] Implement federation/cluster resource generator. 2016-11-01 00:58:54 -07:00
Michal Fojtik 0faa27e62d Use PATCH when pausing/resuming objects and CalculatePatches to get the patch 2016-10-31 13:13:59 +01:00
Kubernetes Submit Queue 5f8dc216d1 Merge pull request #35427 from fabianofranz/issues_35426
Automatic merge from submit-queue

kubectl commands must not use the factory out of Run

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

@smarterclayton PTAL
2016-10-30 03:17:59 -07:00
Chao Xu 850729bfaf include multiple versions in clientset
update client-gen to use the term "internalversion" rather than "unversioned";
leave internal one unqualified;
cleanup client-gen
2016-10-29 13:30:47 -07:00
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
Fabiano Franz 60fc7b87be kubectl commands must not use the factory out of Run 2016-10-27 15:38:22 -02:00
Kubernetes Submit Queue 2de1f5c07e Merge pull request #34407 from brendandburns/kubectl-schema
Automatic merge from submit-queue

Add validation that detects repeated keys in the labels and annotations maps

Fixes #2965  (a nearly 2 year old feature request!)

@kubernetes/kubectl 

@eparis
2016-10-19 14:01:00 -07:00
deads2k ea1eefa7ff glog non-fatal, usually unimportant error instead of fmt 2016-10-18 07:58:20 -04:00
Kubernetes Submit Queue db80dd3339 Merge pull request #34854 from deads2k/cli-02-restmaper
Automatic merge from submit-queue

attempt to use discovery RESTMapper and fallback if we can't

Updates `kubectl` to always attempt discovery regardless of server version.  This is needed to extension servers.
2016-10-15 13:46:40 -07:00
deads2k abf2c43ad7 attempt to use discovery RESTMapper and fallback if we can't 2016-10-14 16:06:31 -04:00
Jacob Tanenbaum 901bbee2fd Add 'kubectl set limit'
Add a way to set resource limits/requests on running pods

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

I squashed the commits to make rebasing easier
Change log:

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

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

- Fixing some of the flow control in kubectl set limit

- update the help info

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

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

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

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

- comment removed

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

- adding the user guide

- fixed a few typos

- typo in hack/cmd-test.sh

- implamenting suggestions for command help text

- adding the dry-run flag

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

- changed limits/requests to requests/limit

- changing ResourcesWithPodSpec

- updated generated docs and removed whitespace

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

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

- cmdutil.PrintSuccess added another argument

- fixing mungedocs failure

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

- fixed typo in Short: field of the cobra command

- rebased

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

- changing ResourcesWithPodSpecs, it doesn't need to be a method of factory
2016-10-14 08:35:32 -04:00
Brendan Burns d9d06f6680 Add some checking for the presence of the same key twice. 2016-10-13 21:58:44 -07:00
AdoHe 593d8e0d7c refactor Factory make it interface 2016-10-13 20:57:14 +08:00
Ilya Dmitrichenko abc0a98d25
Replace references to http://releases.k8s.io/HEAD/docs/user-guide/ 2016-10-02 11:44:40 +01:00
Kubernetes Submit Queue b95fa62fe1 Merge pull request #31163 from juanvallejo/jvallejo_filter-resources-before-printing
Automatic merge from submit-queue

add resource filter handling before printing

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

Resources are currently filtered (in order to prevent printing) at print
time in their HumanReadablePrinter handlers. This design makes it not
possible to filter objects when they are printed using any other
printer, such as YAML, JSON, or the NamePrinter.

This patch removes any filters previously added at the printer level for
pods and adds a way to define resource-specific filters before they are
sent to a printer handler. A woking filter handler for pods has also been
implemented.

Filters affect resources being printed through the HumanReadablePrinter,
YAML, JSON, and `--template` printers.

cc @smarterclayton
2016-09-23 10:45:57 -07:00
juanvallejo 7000e2cf4f
add resource handling before printing
Resources are currently filtered (in order to prevent printing) at print
time in their HumanReadablePrinter handlers. This design makes it not
possible to filter objects when they are printed using any other
printer, such as YAML, JSON, or the NamePrinter.

This patch removes any filters previously added at the printer level for
pods and adds a way to define resource-specific filters before they are
sent to a printer handler. A woking filter handler for pods has also
been
implemented.

Filters affect resources being printed through the HumanReadablePrinter,
YAML, JSON, and `--template` printers.
2016-09-21 10:03:59 -04:00
deads2k e9c1b87b80 move extensions registry packages 2016-09-21 09:14:38 -04:00
Kubernetes Submit Queue 313ef63993 Merge pull request #32680 from sttts/sttts-gracefully-kubectl-without-version
Automatic merge from submit-queue

Behave gracefully in kubectl if /version returns 404

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

It's only about caching the swagger spec here. So it's safe to fall back to non-caching mode and continue.
2016-09-21 04:59:16 -07:00
Clayton Coleman 07f079216e
Make clientcmd defaulting a function of ConfigOverrides and LoadingRules
This commit moves away from using a global variable for default
configuration checking, and instead exposes a method on LoadingRules to
determine whether a particular restclient.Config should be considered
"default". This allows kubectl to provide its own defaults (the same
as before, KUBERNETES_MASTER and the static localhost:8080 values) while
allowing other clients to avoid defining them.

In-cluster config defaulting is now easier to read.
2016-09-21 01:28:06 -04:00
Kubernetes Submit Queue c97246247a Merge pull request #30199 from dims/re-add-roadmap-extend-all
Automatic merge from submit-queue

Extend all to more resources

Added more things from the list here:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go#L159

Update the devel/kubectl-conventions.md with the rules mentioned by
a few folks on which resources could be added to the special 'all' alias
2016-09-20 01:49:45 -07:00
Kubernetes Submit Queue 8d0518d4d2 Merge pull request #32897 from deads2k/api-07-remove-dead-mapper
Automatic merge from submit-queue

remove dead mapper

Removing a write-only field I found looking at the registration code.
2016-09-19 23:12:06 -07:00
Davanum Srinivas e1373cf516 Extend all to more resources
Added more things from the list here:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go#L159

Update the devel/kubectl-conventions.md with the rules mentioned by
a few folks on which resources could be added to the special 'all' alias
2016-09-19 13:01:59 -04:00
deads2k 4aa61ddcb2 remove dead mapper 2016-09-19 09:57:19 -04:00
deads2k 862415aaa2 make --include-extended-apis deprecated and remove plumbing 2016-09-16 16:05:52 -04:00
deads2k 771915c6c4 make shortcut expanding restmapper handle all 2016-09-15 11:03:51 -04:00
deads2k 4359c79f53 add FirstHitRESTMapper for adding thirdparty resources 2016-09-15 10:26:39 -04:00
deads2k 500cddc5c3 use discovery restmapper for kubectl 2016-09-15 10:26:39 -04:00
Dr. Stefan Schimanski 54f5a9b423 Disable swagger spec caching without /version 2016-09-14 18:44:46 +02:00
deads2k 519c13745f convert rest of kubectl to generated clients 2016-09-12 08:22:34 -04:00
deads2k f756e43e7f convert rolling updater to generated client 2016-09-12 07:38:34 -04:00
deads2k 9d43f7e52c convert more command to use a generated clientset 2016-09-12 07:38:34 -04:00
Kubernetes Submit Queue 27c5e5dca7 Merge pull request #31110 from AdoHe/rollout_dry_run
Automatic merge from submit-queue

Rollout dry run

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

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

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

Optimise the DefaultGenerators function

It needn't define all the generators in the "DefaultGenerators" function, it just return the "cmdName" generator, the others is redundant.
2016-09-10 07:43:02 -07:00
Kubernetes Submit Queue 97ec720a19 Merge pull request #32152 from deads2k/client-02-make-clientset
Automatic merge from submit-queue

add ClientSet to factory to remove non-generated client

We should move to using generated clients in the `kubectl` client.  We should really move to generated external clients, but this at least moves away from using manually created clients.

@fabianofranz @mfojtik When I complete this work (move the other commands and eliminate the old API), this will ripple downstream.
2016-09-10 01:59:02 -07:00
Kubernetes Submit Queue 8b5317bf87 Merge pull request #32141 from deads2k/client-01-fix-swagger
Automatic merge from submit-queue

make swaggerschema agnostic about which version to use

`Factory.SwaggerSchema` was reliant on having a non-generated client bits filled in so that it could get the adapted client it wanted.  There's no need since discovery ignores configured GroupVersions.  This eliminates the unneeded dependency.
2016-09-09 22:27:52 -07:00
AdoHe 6a68dbdac4 rollout undo add dry-run implementation 2016-09-08 08:02:04 +08:00
deads2k 1d5e5532ed add ClientSet to factory to remove non-generated client 2016-09-07 09:44:01 -04:00
deads2k aee962c0f2 make swaggerschema agnostic about which version to use 2016-09-06 14:16:02 -04:00
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
Clayton Coleman 06cbb29e9e
ClientConfig should not default to http://localhost:8080
This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.
2016-08-30 10:43:24 -04:00
Kubernetes Submit Queue 2fe56d4bb3 Merge pull request #30863 from ping035627/ping035627-patch-0818
Automatic merge from submit-queue

Optimise the ValidateBytes function

The PR optimise the "ValidateBytes" function in factory.go. Too much "if" branches is poor readability, use "switch" to look better.
2016-08-23 23:59:00 -07:00
PingWang 0926f7d3f1 Optimise the DefaultGenerators function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-22 10:43:15 +08:00
Kara Alexandra d12a66a422 Rename IsEmpty to Empty
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
2016-08-19 14:19:19 -07:00
PingWang cd158938b9 Optimise the ValidateBytes function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-18 19:23:10 +08:00
Kris 63a512fe47 Add discovery mapper and dynamic typer to kubectl 2016-08-15 22:07:54 -07:00
Kubernetes Submit Queue 6f20321833 Merge pull request #28509 from juanvallejo/jvallejo_update-human-readable-printer-signature
Automatic merge from submit-queue

Update HumanResourcePrinter signature w single PrintOptions param

release-note-none

- Makes [HumanReadablePrinter options field non-exported again](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/resource_printer.go#L346-349)
- Adds test-case for HumanReadablePrinter resource printing with aliases.
- Better formatting for saving resource "kind" aliases

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/28509)
<!-- Reviewable:end -->
2016-08-12 07:27:56 -07:00
lixiaobing10051267 254189a5f2 check validation with no apps client in kubectl util factory 2016-08-10 21:20:50 +08:00
Angus Salkeld bd0b7528b5 Add "create deployment" sub-command 2016-08-08 13:24:30 +10:00
Angus Salkeld 42ca885edb Add "create service" sub-commands
This adds:
 create service clusterip
 create service nodeport
 create service loadbalancer
2016-08-08 12:31:21 +10:00
Kubernetes Submit Queue 7921a9ce67 Merge pull request #25816 from soltysh/scheduledjob_kubectl
Automatic merge from submit-queue

ScheduledJob kubectl

@erictune the last part (kubectl) of the ScheduledJob, as usual builds on top of previous PRs, so only last 2 commits matter (the kubectl one and storage leftovers).

```release-note
* Introducing ScheduledJobs as described in [the proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/scheduledjob.md) as part of `batch/v2alpha1` version (experimental feature).
```
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-08-04 17:36:07 -07:00
juanvallejo 620758c7e9 format resource printing with aliases 2016-08-04 12:01:25 -04:00
Maciej Szulik b5c68a9015 ScheduledJob kubectl changes 2016-08-03 17:25:37 +02:00