Commit Graph

128 Commits (7f9f847ce90d4a301a87d2f52cba1b9aa4859cf2)

Author SHA1 Message Date
David Eads 58f39a15de add kubectl create --raw -f 2017-10-23 12:50:46 -04:00
juanvallejo 1d54dc4136
add user-specified ns to --dry-run created obj 2017-10-09 15:44:02 -04:00
Antoine Pelisse 80fd010e83 Remove swagger 1.2 validation 2017-10-03 08:18:21 -07: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
Kubernetes Submit Queue 5c0b265a9b Merge pull request #50497 from dixudx/kubectl-include-uninitialized
Automatic merge from submit-queue (batch tested with PRs 51301, 50497, 50112, 48184, 50993)

Introduce new flag "--include-uninitialized" to kubectl

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

Introduce `--include-uninitialized` as a global flag to kubectl

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

**Special notes for your reviewer**:
/assign @caesarxuchao @smarterclayton @ahmetb @deads2k 

**Release note**:

```release-note
Add flag "--include-uninitialized" to kubectl annotate, apply, edit-last-applied, delete, describe, edit, get, label, set. "--include-uninitialized=true" makes kubectl commands apply to uninitialized objects, which by default are ignored if the names of the objects are not provided. "--all" also makes kubectl commands apply to uninitialized objects. Please see the [initializer](https://kubernetes.io/docs/admin/extensible-admission-controllers/) doc for more details.
```
2017-09-02 23:50:00 -07:00
Di Xu be0cadde2e enforce include-uninitialized in several kubectl commands 2017-08-31 16:30:56 +08:00
Michael Taufen 503a6a8eec Add --append-hash flag to kubectl create configmap/secret
Specifying this new flag will automatically hash the configmap/secret
contents with sha256 and append the first 40 hex-encoded bits of the
hash to the name of the configmap/secret. This is especially useful for
workflows that generate configmaps/secrets from files (e.g.
--from-file).

Note that vowels and vowel-like characters in the hash are remapped to
consonants to make it more difficult to accidentally form bad words.

See this Google doc for more background:
https://docs.google.com/document/d/1x1fJ3pGRx20ujR-Y89HUAw8glUL8-ygaztLkkmQeCdU/edit
2017-08-28 14:17:47 -07:00
Antoine Pelisse b7b5457050 Validate against OpenAPI schema (if available) 2017-08-21 08:58:42 -07:00
zhengjiajin 43e3044b73 fix issue(#49883) Add selector example 2017-08-17 20:27:11 +08:00
ymqytw b776df8a20 move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
Alexander Campbell 6fd36c10ad kubectl/cmd: many small refactors
* Rename variables and functions to match Go convention.
   For example, UsageError --> UsageErrorf.
 * Remove redundant or unreachable code.
 * Simplify some utility functions (no functionality changes).
 * Fix hanging 'if { return } else { return }' constructs.
 * Fix several incorrect printf verbs.
2017-06-27 16:25:20 -07:00
Alexander Campbell ac793982b0 kubectl: fix inaccurate usage messages for --windows-line-endings
Part of the problem is that these are duplicated between the different
commands. I'm planning to consolidate these further.
2017-06-23 09:49:30 -07:00
Alexander Campbell ef9ae61240 kubectl: simplify code with help of linter 2017-06-23 09:49:30 -07:00
Alexander Campbell f9913c4948 kubectl: rewrite docstrings in several files
Fixing inaccuracies and clarifying in the case of ambiguities.
2017-06-23 09:49:30 -07:00
juanvallejo d036686185
fix --local flag for `kubectl set` commands 2017-06-13 12:57:05 -04:00
AdoHe 5ed1ab66a2 refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00
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 aa4390750c Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
xilabao 131802a5cd add secret flag to options 2017-02-25 23:40:50 +08:00
Xing Zhou 433941f1fd Added `kubectl create clusterrole` command.
Added `kubectl create clusterrole` command.
2017-02-22 10:30:41 +08:00
Xing Zhou 0a2876d39e Added kubectl create role command.
Added kubectl create role command.
2017-02-08 13:30:03 +08:00
Brendan Burns d9c4a289a6 Extract strings for translation. 2017-02-06 22:32:01 -08:00
Kubernetes Submit Queue a2931c6218 Merge pull request #40289 from xilabao/fix-save-config-in-create-subcommand
Automatic merge from submit-queue

fix --save-config in create subcommand

--save-config option doesn't work.
```
#kubectl create rolebinding a --role=b --user=c --save-config  
rolebinding "a" created
```
old output:
```
#kubectl get rolebinding a -o yaml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  creationTimestamp: 2017-01-23T10:09:48Z
  name: a
  namespace: default
  resourceVersion: "281"
  selfLink: /apis/rbac.authorization.k8s.io/v1beta1/namespaces/default/rolebindings/a
  uid: 12abccd6-e154-11e6-819c-525400f84377
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: b
subjects:
- apiVersion: rbac/v1alpha1
  kind: User
  name: c
```

expected output:
```
#kubectl get rolebinding a -o yaml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"kind":"RoleBinding","apiVersion":"rbac.authorization.k8s.io/v1beta1","metadata":{"name":"c","creationTimestamp":null},"subjects":[{"kind":"User","apiVersion":"rbac/v1alpha1","name":"c"}],"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"b"}}
  creationTimestamp: 2017-01-23T10:09:48Z
  name: a
  namespace: default
  resourceVersion: "281"
  selfLink: /apis/rbac.authorization.k8s.io/v1beta1/namespaces/default/rolebindings/a
  uid: 12abccd6-e154-11e6-819c-525400f84377
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: b
subjects:
- apiVersion: rbac/v1alpha1
  kind: User
  name: c
```
2017-02-04 04:40:29 -08:00
xilabao 93c63d76e8 fix --save-config in create subcommand 2017-01-23 15:15:37 +08:00
Zihong Zheng 6b9860cf54 Allows kubectl create -f to filter by selector. 2017-01-17 19:18:51 -08:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue 3951ae4e1d Merge pull request #38112 from juanvallejo/jvallejo/add-output-format-support-kubectl-create
Automatic merge from submit-queue

Add json,yaml output format support to kubectl create, kubectl apply

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

**Release note**:
```release-note
Added support for printing in all supported `--output` formats to `kubectl create ...` and `kubectl apply ...`
```

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.

The patch prints `*resource.Info`s returned by the server. If a resource does not yet exist (and the `--dry-run` option is not set), the resource is created and printed in the specified format.

@kubernetes/cli-review @fabianofranz
2017-01-03 14:18:33 -08:00
deads2k 8b25c21e79 add create rolebinding 2016-12-21 09:03:27 -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
Clayton Coleman 42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -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
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
deads2k e300f01a1b add create clusterrolebinding command 2016-11-21 08:50:06 -05:00
juanvallejo 988e747649 update default run function for sub-commands
This patch updates parent commands of sub-commands to exit with a usage
error and exit code 1 on an invalid (non-sub-command) argument.
2016-10-31 10:08:12 -04:00
ymqytw c641834bb3 support editing before creating resource 2016-10-24 09:56:37 -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 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
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
Kubernetes Submit Queue ea688f5e44 Merge pull request #31276 from juanvallejo/jvallejo_update-dry-run-create
Automatic merge from submit-queue

Update kubectl create message when using --dry-run

`kubectl create <resource> <name> --dry-run` provides a misleading success
message.

When commands such as `kubectl new-app node` are run with a
`--dry-run` flag, they make this clear by appending a "(DRY RUN)"
string to the final output. `kubectl create <resource>  <name> --dry-run`
does not do this, providing a potentially misleading output.

This patch appends a "(DRY RUN)" string to the end of a successful
message of `kubectl create` subcommands that support the `--dry-run` flag.

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created
```

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created (DRY RUN)
```

**Release note**:
```release-note
release-note-none
```
2016-09-26 16:01:17 -07:00
Kubernetes Submit Queue 2941069307 Merge pull request #32894 from deads2k/cli-01-remove-arg
Automatic merge from submit-queue

make --include-extended-apis deprecated and remove plumbing

Marks a dead CLI parameter as deprecated and removes the plumbing for it.
2016-09-19 21:11:04 -07:00
deads2k 862415aaa2 make --include-extended-apis deprecated and remove plumbing 2016-09-16 16:05:52 -04:00
juanvallejo 52fc8efa55 update PrintSuccess message when using --dry-run 2016-09-15 10:11:21 -04:00
ymqytw c67a62da49 Fixes #30562: Refactor kubectl command options to use common struct for common file params 2016-09-12 11:01:37 -07:00
Kris 7511412ca6 Make kubectl create use dynamic clients 2016-08-15 22:07:54 -07: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
maaz khan 5b95524d65 Add support for kubectl create quota command 2016-07-26 11:32:08 +02:00