Commit Graph

71 Commits (c68ae58c93d71b75c2ba6bcea565431cbbcaf061)

Author SHA1 Message Date
Brendan Burns 79f51923d3 Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
deads2k 8895f314b4 move category expansion out of restmapper 2017-03-27 13:54:05 -04:00
Maciej Szulik c272630b1b Deployments under apps/v1beta1 with new defaults 2017-03-01 15:14:41 +01:00
Kubernetes Submit Queue 34b31c8f32 Merge pull request #41699 from liggitt/apply-output-result
Automatic merge from submit-queue (batch tested with PRs 40746, 41699, 42108, 42174, 42093)

Output result of apply operation

Fixes #41690 

Plumbs the resulting object from patch operations back to the top level so it can be output when printing
2017-02-28 07:51:22 -08:00
Jordan Liggitt 4592c47ad4
Output result of apply operation 2017-02-27 09:28:28 -05: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 e6ecfd2e37 Merge pull request #41694 from shiywang/apply-set1
Automatic merge from submit-queue (batch tested with PRs 42044, 41694, 41927, 42050, 41987)

Add apply set-last-applied subcommand 

implement part of https://github.com/kubernetes/community/pull/287, will rebase after https://github.com/kubernetes/kubernetes/pull/41699 got merged, EDIT: since bug output format has been confirmed, will update the behavior of output format soon  
cc @kubernetes/sig-cli-pr-reviews @AdoHe @pwittrock 

```release-note
Support kubectl apply set-last-applied command to update the applied-applied-configuration annotation
```
2017-02-26 23:16:51 -08:00
xilabao 131802a5cd add secret flag to options 2017-02-25 23:40:50 +08:00
Shiyang Wang 9bace3e379 add apply-set-last-applied subcommand
update

update code

update unit tests

hack/update

remove spew

update bazel

updated

add comments

remove unused parameter

remove hardcode

bump unit tests

add new flags

add unit tests

add bazel

genreate doc
2017-02-24 11:11:39 +08:00
shiywang 557c18694a Add apply view last-applied subcommand
change to GetOriginalConfiguration

add bazel

refactor apply view-last-applied command

update some changes

minor change

add unit tests, update

update some codes and genreate docs

update LongDesc
2017-02-21 20:08:25 +08:00
ymqytw a910284e17 extract util used by jsonmergepatch and SMPatch 2017-02-03 15:28:42 -08:00
ymqytw ad7ffd79c3 apply falls back to generic 3-way JSON merge patch if no go struct is registered for the target GVK 2017-02-02 15:19:50 -08:00
Piotr Szczesniak a35ad8f6ba Removed HPA objects from extensions api group 2017-02-02 14:09:54 +01:00
Kubernetes Submit Queue 1625150de8 Merge pull request #40260 from liggitt/kubectl-tpr
Automatic merge from submit-queue (batch tested with PRs 39223, 40260, 40082, 40389)

make kubectl generic commands work with unstructured objects

part of making apply, edit, label, annotate, and patch work with third party resources

fixes #35149
fixes #34413

prereq of:
https://github.com/kubernetes/kubernetes/issues/35496
https://github.com/kubernetes/kubernetes/pull/40096

related to:
https://github.com/kubernetes/kubernetes/issues/39906
https://github.com/kubernetes/kubernetes/issues/40119

kubectl is currently decoding any resource it doesn't have compiled-in to a ThirdPartyResourceData struct, which means it computes patches using that struct, and would try to send a ThirdPartyResourceData object to the API server when running `apply`

This PR removes the behavior that decodes unknown objects into ThirdPartyResourceData structs internally, and fixes up the following generic commands to work with unstructured objects

- [x] apply
  - [x] decode into runtime.Unstructured objects
  - [x] successfully use `--record` with unregistered objects 
- [x] patch
  - [x] decode into runtime.Unstructured objects
  - [x] successfully use `--record` with unregistered objects 
- [x] describe
  - [x] decode into runtime.Unstructured objects
  - [x] implement generic describer
- [x] fix other generic kubectl commands to work with unstructured objects
  - [x] label
  - [x] annotate

follow-ups for pre-existing issues:
- [ ] `explain` doesn't work with unregistered resources
- [ ] remove special casing of federation group in clientset lookups, etc
- [ ] `patch`
  - [ ] doesn't honor output formats when persisting to server (`kubectl patch -f svc.json --type merge -p '{}' -o json` doesn't output json)
  - [ ] --local throws exception (`kubectl patch -f svc.json --type merge -p '{}' --local`)
- [ ] `apply`
  - [ ] fall back to generic JSON patch computation if no go struct is registered for the target GVK (e.g. https://github.com/kubernetes/kubernetes/pull/40096)
  - [ ] ensure subkey deletion works in CreateThreeWayJSONMergePatch
  - [ ] ensure type stomping works in CreateThreeWayJSONMergePatch
  - [ ] lots of tests for generic json patch computation
  - [ ] prevent generic apply patch computation among different versions
  - [ ] reconcile treatment of nulls with https://github.com/kubernetes/kubernetes/pull/35496
- [ ] `edit`
  - [ ] decode into runtime.Unstructured objects
  - [ ] fall back to generic JSON patch computation if no go struct is registered for the target GVK
2017-01-27 05:41:45 -08:00
Jordan Liggitt 408a978f26
fix --record to work with unstructured objects 2017-01-26 19:59:27 -05:00
Jordan Liggitt aaf96a1048
apply: use unstructured objects 2017-01-26 19:59:26 -05:00
Brendan Burns e8b0f59ed2 Add a script to extract strings for translation and a sample of what it does. 2017-01-25 22:08:02 -08:00
Dr. Stefan Schimanski d7eb3b6870 pkg/util: move uuid and strategicpatch into k8s.io/apimachinery 2017-01-25 19:45:09 +01:00
Clayton Coleman be6d2933df
refactor: Move *Options references to metav1 2017-01-24 13:41:51 -05:00
Clayton Coleman 469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
deads2k 26c46971f2 move PatchType to apimachinery 2017-01-17 08:32:05 -05:00
deads2k 77b4d55982 mechanical 2017-01-16 09:35:12 -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
juanvallejo cbe479039b Add json,yaml output format support kubectl create
This patch adds the ability to specify an output format other than
"name" to `kubectl create ...`. It can be used in conjunction with the
`--dry-run` option. Converts unstructured objects into known types in
order to support all `--output` values.
2016-12-12 16:09:12 -05:00
Kubernetes Submit Queue 3d29c3d229 Merge pull request #36672 from ymqytw/check_annotation_for_apply
Automatic merge from submit-queue (batch tested with PRs 38453, 36672, 38629, 34966, 38630)

Warn user if they try to apply on an object without the annotation

Give user a warning when using `kubectl apply` on a resource lacking the `LastAppliedConfig` annotation

fixes #36620

Ref: #35134 and #36509.

**Release note**:
```release-note
Issue a warning when using `kubectl apply` on a resource lacking the `LastAppliedConfig` annotation
```
2016-12-12 11:41:06 -08:00
ymqytw b6cfa9aa98 warn user if they try to apply on an object without the annotation 2016-12-09 17:29:31 -08:00
Jordan Liggitt 3654d63766
Compute apply patch using versioned object 2016-12-09 16:26:04 -05:00
xilabao b95dcfb424 update label filter prompt 2016-12-05 11:03:21 +08:00
Kubernetes Submit Queue 63a930f88e Merge pull request #37397 from ymqytw/update_doc_for_kubectl_apply
Automatic merge from submit-queue

Update doc for kubectl apply

Update doc for `kubectl apply`.

@MrHohn @mikedanese Please review the changes related to `--prune`.

We will need to update the doc when flags `--dry-run` and `-o` have been fixed. Ref: https://github.com/kubernetes/kubernetes/pull/34028#issuecomment-262392748

Partially addresses: kubernetes/kubernetes.github.io#1513

cc: @pwittrock @foxish
2016-11-29 07:31:48 -08:00
Kubernetes Submit Queue 93f6736daf Merge pull request #37345 from MrHohn/kubectl-apply-remove-w
Automatic merge from submit-queue

Removes shorthand flag -w from kubectl apply

Fixes #37342.

A shorthand flag `-w` was introduced as flag `--prune-whitelist` for kubectl apply two weeks ago. Turned out it is not what we should do. Removing this shorthand flag before 1.5 release to prevent further issues.

@ymqytw @pwittrock
2016-11-29 07:31:38 -08:00
ymqytw 2f32b48b25 update doc for kubectl apply 2016-11-28 09:52:39 -08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Zihong Zheng f57c9c70f9 Removes shorthand flag from kubectl apply 2016-11-22 22:24:50 -08:00
ymqytw 3cc294b1e0 Revert "support patch list of primitives"
This reverts commit 34891ad9f6.
2016-11-22 21:06:36 -08:00
ymqytw d248843b65 Revert "try old patch after new patch fails"
This reverts commit f32696e734.
2016-11-22 21:02:30 -08:00
ymqytw 9b16b435fc Revert "Update apply and edit"
This reverts commit 48d3ca23cf.
2016-11-22 21:02:15 -08:00
ymqytw 48d3ca23cf Update apply and edit 2016-11-18 09:01:28 -08:00
ymqytw f32696e734 try old patch after new patch fails 2016-11-17 14:28:09 -08:00
Kubernetes Submit Queue 3e169be887 Merge pull request #35647 from ymqytw/patch_primitive_list
Automatic merge from submit-queue

Fix strategic patch for list of primitive type with merge sementic

Fix strategic patch for list of primitive type when the patch strategy is `merge`.
Before: we cannot replace or delete an item in a list of primitive, e.g. string, when the patch strategy is `merge`. It will always append new items to the list.
This patch will generate a map to update the list of primitive type.
The server with this patch will accept either a new patch or an old patch.
The client will found out the APIserver version before generate the patch.

Fixes #35163, #32398

cc: @pwittrock @fabianofranz 

``` release-note
Fix strategic patch for list of primitive type when patch strategy is `merge` to remove deleted objects.
```
2016-11-11 14:36:44 -08:00
ymqytw 34891ad9f6 support patch list of primitives 2016-11-09 11:46:59 -08:00
ymqytw 750449ba3c support force apply 2016-11-04 20:42:34 -07:00
Zihong Zheng af048bdb62 Implements --prune-whitelist(-w) flag to overwrite default whitelist for --prune 2016-11-01 14:02:00 -07:00
Fabiano Franz f6d1ac72a0 Use our own normalizers for cmd examples and descriptions 2016-10-17 11:49:55 -02:00
Kubernetes Submit Queue 3f4c438946 Merge pull request #34836 from mikedanese/prune-1
Automatic merge from submit-queue

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

Fixes #34790

cc @kubernetes/kubectl @MrHohn
2016-10-15 18:38:20 -07:00
Kubernetes Submit Queue a010d3b195 Merge pull request #34028 from juanvallejo/jvallejo/add-dry-run-flag-kubectl-apply
Automatic merge from submit-queue

add --dry-run flag to `kubectl apply, kubectl create`

Partially addresses https://github.com/kubernetes/kubernetes/issues/11488

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

Related StackOverflow:
http://stackoverflow.com/questions/38824409/validate-openshift-objects-defined-in-yaml-before-actually-applying-or-executing

This patch adds a `--dry-run` flag to the `apply` command in order to
allow validation of objects, without patching or creating them. If a
`--dry-run` flag is present and no validation errors are found, the
command will exit before "configuring" or creating any objects.

@ncdc @fabianofranz
2016-10-15 05:30:40 -07:00
Mike Danese c17a8a773d kubectl: apply prune should fallback to basic delete when a resource has no reaper 2016-10-14 15:04:38 -07:00
AdoHe b2280a646a update various commands to adapt the new Factory interface 2016-10-13 21:01:14 +08:00
juanvallejo 63e0279d93
add --dry-run flag to `kubectl apply`
Related StackOverflow:
http://stackoverflow.com/questions/38824409/validate-openshift-objects-defined-in-yaml-before-actually-applying-or-executing

This patch adds a `--dry-run` flag to the `apply` command in order to
allow validation of objects, without actually creating them. If a
`--dry-run` flag is present and no validation errors are found, the
command will exit before patching or creating any objects.

It also adds a `--dry-run` option to the `kubectl create` root command.
2016-10-12 16:48:20 -04:00
Mike Danese ea5ecc4145 implement kubectl apply --prune 2016-10-06 17:49:02 -07:00