Commit Graph

146 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
Kubernetes Submit Queue 87bd30a142 Merge pull request #53606 from juanvallejo/jvallejo/add-approx-pod-template-factory-method
Automatic merge from submit-queue (batch tested with PRs 53606, 49361). 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 ApproximatePodTemplateForObject factory method

Makes it possible to get at a pod spec template even if an object is scaled to zero, for use with commands that care about pod templates.

**Release note**:

```release-note
NONE
```

Related downstream patch and use-case: https://github.com/openshift/origin/pull/16379

cc @smarterclayton
2017-10-11 22:41:29 -07:00
Antoine Pelisse d1ce36371e kubectl: Remove swagger 1.2 entirely. 2017-10-10 14:50:56 -07:00
juanvallejo ba1914d514
add ApproximatePodTemplateForObject factory method 2017-10-09 14:57:23 -04:00
Antoine Pelisse 80fd010e83 Remove swagger 1.2 validation 2017-10-03 08:18:21 -07:00
Kubernetes Submit Queue 52cb89751f Merge pull request #48763 from juanvallejo/jvallejo/update-set-image-local-error-message
Automatic merge from submit-queue (batch tested with PRs 47806, 49539, 48763, 47049, 50600). 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 Local and Unstructured resource builder attributes and handle <rsrsc> / <name> pairs when --local is set

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

Related downstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1390139

Adds an error message if a non-filename (or stdin) resource is specified with the `--local` flag in any of the `kube set ...` sub-commands.

cc @fabianofranz @kubernetes/sig-cli-misc
2017-09-22 21:20:54 -07:00
Kubernetes Submit Queue c16ff84e92 Merge pull request #52042 from mengqiy/revert_update_vendor
Automatic merge from submit-queue

Revert update vendor kube-openapi

Revert https://github.com/kubernetes/kubernetes/pull/51762 since https://github.com/kubernetes/kubernetes/pull/51321 are not going to get in this release.

Will revert https://github.com/kubernetes/kube-openapi/pull/10 after this PR merged.

fixes: #52135

```release-note
NONE
```

/assign @apelisse @liggitt
2017-09-07 19:53:03 -07:00
ymqytw c17103f184 Revert "remove dup pkg and update reference"
This reverts commit 93be3f7735.

Revert "update vendor kube-openapi"

This reverts commit 006f80e35d.
2017-09-06 12:30:53 -07:00
Solly Ross b0af402475 Move Autoscaling v2{alpha1 --> beta1}
This commit renames autoscaling/v2alpha1 to autoscaling/v2beta1.
Only the API-related code is moved in this commit.
2017-09-05 17:49:30 -04:00
juanvallejo 04d319dc2a
update bazel 2017-09-05 11:57:01 -04:00
juanvallejo 90d76adb4b
add Local and Unstructured builder attributes
Moves DisabledClientMapperForMapping wrapper to new Local attribute.
Removes Factory#NewUnstructuredBuilder in favor of new Unstructured
builder attribute.
2017-09-05 11:57:00 -04:00
ymqytw 93be3f7735 remove dup pkg and update reference 2017-09-04 18:20:25 -07:00
Antoine Pelisse 332b681bd1 Revert "Revert "Merge pull request #47353 from apelisse/http-cache""
This reverts commit 4ee72eb300.
2017-08-25 08:31:49 -07:00
Kubernetes Submit Queue 83e9cadc02 Merge pull request #50578 from pwittrock/depsutils
Automatic merge from submit-queue (batch tested with PRs 51047, 48573, 50764, 51092, 50578)

Library updates to better support removing kubectl deps on kubernetes/kubernetes

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

**Which issue this PR fixes**: kubernetes/kubectl#50

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-23 17:56:20 -07:00
Antoine Pelisse b7b5457050 Validate against OpenAPI schema (if available) 2017-08-21 08:58:42 -07:00
Jeffrey Regan dbc22ad6fd Remove kubectl's dependence on schema file in pkg/api/validation.
**What this PR does / why we need it**:

Makes functions in validation/schema.go private to kubectl,
further isolating kubectl.

**Which issue this PR fixes**

Part of a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-08-16 16:38:28 -07:00
chandanmad f3ac55725d Changes for updating serviceaccount of a resource. 2017-08-14 12:41:19 +05:30
Phillip Wittrock e97a18b435 Support for using a client-go client from kubectl 2017-08-13 12:52:29 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
Jordan Liggitt 4ee72eb300
Revert "Merge pull request #47353 from apelisse/http-cache"
This reverts commit fc89743dca, reversing
changes made to 29ab38e898.
2017-08-07 16:20:34 -04:00
Dr. Stefan Schimanski 1910b5a1dd Fix code implicitly casting clientsets to getters 2017-08-06 15:30:13 +02:00
Antoine Pelisse a1d0384e82 openapi: Remove cache mechanism
The cache will be removed and replaced with HTTP Etag caching instead.
This patch is simply removing the existing mechanism.
2017-08-04 14:36:32 -07:00
supereagle a1c880ece3 update generated deepcopy code 2017-07-31 22:33:00 +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 d51ae181a5 Auto generated files 2017-07-26 06:22:30 +05:30
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
Dr. Stefan Schimanski 8dd0989b39 Update generated code 2017-07-18 09:28:49 +02:00
Dr. Stefan Schimanski 39d95b9b06 deepcopy: add interface deepcopy funcs
- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells
2017-07-18 09:28:47 +02: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
Jeffrey Regan 7abff879d7 Introduce visibility rules to kubernetes code.
**What this PR does / why we need it**:

Visibility rules allow dependency control.  The rules currently in
place make all targets public, to override the default state of
private.  This PR removes public visibility from kubectl code.  It
uses specially named pacakge groups to identify "bad" dependencies on
kubectl code for later refactoring or removal.

**Which issue this PR fixes**

First in a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-05-15 12:50:56 -07:00
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 21e239fb82 kubectl OpenAPI bazel updates 2017-04-25 10:45:50 -07:00
Phillip Wittrock 212c2a3a72 kubectl OpenAPI support 2017-04-25 10:45:49 -07:00
Mike Danese a05c3c0efd autogenerated 2017-04-14 10:40:57 -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
Irfan Ur Rehman 2ad49a642b [Federation][Kubefed] Add some faked methods on kubectl fake test API factory for kubefeds consumption 2017-03-03 19:39:26 +05:30
Kubernetes Submit Queue 8ceb0c4025 Merge pull request #41151 from ahakanbaba/tpr-unit-tests
Automatic merge from submit-queue (batch tested with PRs 41937, 41151, 42092, 40269, 42135)

Add a unit test for idempotent applys to the TPR entries.

The test in apply_test follows the general pattern of other tests.
We load from a file in test/fixtures and mock the API server in the
function closure in the HttpClient call.
The apply operation expects a last-modified-configuration annotation.
That is written verbatim in the test/fixture file.

References #40841



**What this PR does / why we need it**:
Adds one unit test for TPR's using applies. 

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
References: 
https://github.com/kubernetes/features/issues/95
https://github.com/kubernetes/kubernetes/issues/40841#issue-204769102


**Special notes for your reviewer**:

I am not super proud of the tpr-entry name. 
But I feel like we need to call the two objects differently. 
The one which has Kind:ThirdPartyResource 
and the one has Kind:Foo. 

Is the name "ThirdPartyResource" used interchangeably for both ? I used tpr-entry for the Kind:Foo object.

Also I !assume! this is testing an idempotent apply because the last-applied-configuration annotation is the same as the object itself. 

This is the state I see in the logs of kubectl if I do a proper idempotent apply of a third party resource entry. 

I guess I will know more once I start playing around with apply command that change TPR objects. 

**Release note**:

```release-note
```
2017-02-28 01:24:06 -08:00
Hakan Baba 1cc30bdfb2 Add a unit test for applies and idempotent applys to the TPR entries.
The tests in apply_test follows the general pattern of other tests.
We load from a file in test/fixtures and mock the API server in the
function closure in the HttpClient call.
In PATCH request rount-tripper we check that the kubectl apply
implementation worked as expected.

References #40841
2017-02-27 10:22:12 -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
Kubernetes Submit Queue a1490926d6 Merge pull request #41077 from deads2k/cli-01-cani
Automatic merge from submit-queue (batch tested with PRs 41814, 41922, 41957, 41406, 41077)

add kubectl can-i to see if you can perform an action

Adds `kubectl auth can-i <verb> <resource> [<name>]` so that a user can see if they are allowed to perform an action.

@kubernetes/sig-cli-pr-reviews @fabianofranz 

This particular command satisfies the immediate need of knowing if you can perform an action without trying that action.  When using RBAC in a script that is adding permissions, there is a lag between adding the permission and the permission being realized in the RBAC cache.  As a user on the CLI, you almost never see it, but as a script adding a binding and then using that new power, you hit it quite often.

There are natural follow-ons to the same area (hence the `auth` subcommand) to figure out if someone else can perform an action, what actions you can perform in total, and who can perform a given action.  Someone else is an API we have already, what-can-i-do was a proposed API a while back and a very useful one for interfaces, and who-can is common question if someone is administering a namespace.
2017-02-26 10:22:54 -08:00
xilabao 131802a5cd add secret flag to options 2017-02-25 23:40:50 +08:00
deads2k 5b4a611fd7 add kubectl can-i to see if you can perform an action 2017-02-23 09:12:35 -05:00
Clayton Coleman 651188d687
generated: bazel 2017-02-23 00:28:32 -05:00
Clayton Coleman 2aa4abb73b
Refactor commands to use new factory method 2017-02-23 00:28:32 -05: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
Kubernetes Submit Queue fbc94c0896 Merge pull request #41343 from p0lyn0mial/kubectl_get_short_names_from_discovery_api
Automatic merge from submit-queue

shortcut expander will take the list of short names from the api ser…

**What this PR does / why we need it**: the shortcut expander will take the list of short names for resources from the API server during the discovery. For backward compatibility a hardcoded list of short names will always be appended while evaluating a short name.
2017-02-15 09:07:51 -08:00
p0lyn0mial 98068b6367 shortcut expander will take the list of short names from the api server. 2017-02-15 09:06:47 +01:00
Jordan Liggitt ec271f5c09
Switch 'kubectl edit' to use unstructured objects, handle schemaless objects
mark --output-version as deprecated, add example for fully-qualifying version to edit

Add 'kubectl edit' testcase for editing schemaed and schemaless data together

Add 'kubectl edit' testcase for editing unknown version of known group/kind
2017-02-14 14:55:02 -05:00
Jordan Liggitt f86db18297
Add advanced 'kubectl edit' test scenarios
Add 'kubectl edit' testcase for saving a repeated error

Add 'kubectl edit' testcase for preserving an edited file with a syntax error

Add 'kubectl edit' testcase for recording command on list of objects
2017-02-14 14:50:45 -05:00
Kubernetes Submit Queue ce998a9fa7 Merge pull request #40365 from shiywang/attach
Automatic merge from submit-queue (batch tested with PRs 41145, 38771, 41003, 41089, 40365)

Add `kubectl attach` support for multiple types

To address this issue: https://github.com/kubernetes/kubernetes/issues/24857
the new `kubectl attach` will contain three scenarios depend on args:
1. `kubectl attach POD` :   if only one argument provided, we assume it's a pod name
2. `kubectl attach TYPE NAME` : if two arguments provided, we assume first one is resource we [supported](4770162fd3/pkg/kubectl/cmd/util/factory_object_mapping.go (L285)), the second resource's name.
3. `kubectl attach TYPE/NAME` : one argument provided and arg[0] must contain `/`, ditto

Is there any other scenarios I haven't consider in ?

for now the first scenario is compatible with changed before, also `make test` pass  
will write some unit test to test second and third scenario, if you guys think i'm doing the right way.
@pwittrock @kargakis @fabianofranz @ymqytw @AdoHe
2017-02-09 13:34:56 -08:00
shiywang 919cb19706 kubectl attach support for multiple types
hot fix

add unit test and statefulSet

update example

remove package

change to ResourceNames

remove some code

remove strings

add fake testing func for AttachablePodForObject

minor change

add test.obj nil check

update testfile

gofmt

update

add fallthough

revert back
2017-02-08 16:10:55 +08:00
Jordan Liggitt af3505f53c
Add unit test framework for edit command 2017-02-04 00:11:29 -05:00
Jordan Liggitt cf74abd892
fixup apply null tests 2017-01-31 15:00:23 -05:00
Anastasis Andronidis 4bdcc03c0b
test for explicit null value propagation in apply 2017-01-31 14:22:24 -05:00
Jordan Liggitt 9013e8a7cf
Test cascading delete without client-side reaper does not GET 2017-01-27 09:18:48 -05:00
Jordan Liggitt 06c12f6716
describe: use unstructured objects 2017-01-26 19:59:25 -05:00
Jordan Liggitt a82c4481f3
Distinguish between client and unstructuredclient in fake factory 2017-01-26 19:59:16 -05:00
deads2k 2734f8f892 move dynamic and discovery clients 2017-01-26 08:37:06 -05:00
deads2k 502bfdf944 client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k c587b8a21e re-run client-gen 2017-01-20 08:02:36 -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
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08: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
Mike Danese c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
Michal Fojtik 737b32772e add ResolveImage function to CLI factory 2016-12-09 12:41:38 +01: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
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
ymqytw d178bc76ed Revert "add a unit test"
This reverts commit 11653b11c1.
2016-11-22 21:01:20 -08:00
ymqytw 11653b11c1 add a unit test 2016-11-18 15:35:50 -08:00
Dr. Stefan Schimanski 14ce6f6065 Add caching for discovery info 2016-11-04 21:17:12 +01:00
Kubernetes Submit Queue 5a2c473c1c Merge pull request #36085 from deads2k/cli-05-generic-print
Automatic merge from submit-queue

have basic kubectl crud agnostic of registered types

Makes `kubectl get` agnostic to scheme (baked in API types).  This means that it will now work against generic API servers that are "kube shaped".

This is similar to the work done for `kubectl create` last release.  I'll split out the smaller command.  `kubectl get` looks a lot different, but this eliminates all special casing for TPR in those cases.



@fabianofranz
2016-11-04 08:17:02 -07:00
deads2k 61673c4b39 make kubectl get generic with respect to objects 2016-11-04 09:04:57 -04:00
Madhusudan.C.S 0092cda7ed Need type assertion because RESTClient() is now a method that returns and interface. 2016-11-01 21:59:51 -07:00
Madhusudan.C.S e69475d29e Make the fake command factory return the clientset with appropriate rest clients for all the API groups.
Calling `internalclientset.New()` with a rest client as an argument simply
copies that rest client to all the API group clients irrespective of the
configured GroupVersion or versionedAPIPath in the client. So only one
API group client gets the client configured correctly for that API
group. All the other API group clients get misconfigured rest clients.

On the other hand, `internalclientset.NewForConfigOrDie()` does the right
thing by reconfiguring the passed configs for each API group and
initializes an appropriate rest client for that group.

Now that we are relying on the `NewForConfigOrDie()` method to
initialize the rest clients, we need to swap the underlying http clients
in each of these rest clients with a fake one for testing.
2016-11-01 19:03:04 -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 71ba8a90f0 Merge pull request #35732 from fabianofranz/run_cant_dryrun_with_attach
Automatic merge from submit-queue

Better kubectl run validations

Adds more validations to flags that must be mutually exclusive in `kubectl run`. For example, `--dry-run` must not be used with `--attach`, `--stdin` or `--tty`. Adds unit tests for these new validations and some previously existing ones.

**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`. 
-->
```release-note
NONE
```
2016-10-30 13:07:28 -07: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 fd2fdfba89 move client/unversioned/fake to client/restclient/fake 2016-10-29 14:22:02 -07:00
Clayton Coleman ca2f1b87ad
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation
and reduce the need to allocate during negotiation. Simplify the dynamic
client's logic around negotiating type. Add more tests for media type
handling where necessary.
2016-10-28 11:30:11 -04:00
Fabiano Franz bc1a1d7b30 Better kubectl run validations 2016-10-27 20:05:26 -02:00
Fabiano Franz 60fc7b87be kubectl commands must not use the factory out of Run 2016-10-27 15:38:22 -02:00
deads2k 81ae13084d handle non-generated client removal 2016-10-26 16:10:41 -04:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Angus Salkeld d58554a647 Move the common test functions from cmd_test.go to cmd/testing/fake.go
This is so that we can use NewAPIFactory() from cmd/set/*test.go
Up until now we would get a import loop error.

This commit also adds a basic unit test case for cmd/set/set_image.go
2016-10-19 08:53:26 +10:00