Skip to content

Commit

Permalink
Merge pull request #18835 from brendandburns/3rdparty
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Add support for 3rd party objects to kubectl

@deads2k @jlowdermilk

Instructions for playing around with this:

Run an apiserver with third party resources turned on (`--runtime-config=extensions/v1beta1=true,extensions/v1beta1/thirdpartyresources=true`)

Then you should be able to:

```
kubectl create -f rsrc.json
```

```json
{
  "metadata": {
    "name": "foo.company.com"
  },
  "apiVersion": "extensions/v1beta1",
  "kind": "ThirdPartyResource",
  "versions": [
    {
      "apiGroup": "group",
      "name": "v1"
    },
    {
      "apiGroup": "group",
      "name": "v2"
    }
  ]
}
```

Once that is done, you should be able to:

```
curl http://<server>/apis/company.com/v1/foos
```

```
curl -X POST -d @${HOME}/foo.json http://localhost:8080/apis/company.com/v1/namespaces/default/foos
```

```json
{
  "kind": "Foo",
  "apiVersion": "company.com/v1",
  "metadata": {
    "name": "baz"
  },
  "someField": "hello world",
  "otherField": 1
}
```

After this PR, you can do:

```
kubectl create -f foo.json
```

```
kubectl get foos
```

etc.
  • Loading branch information
k8s-merge-robot committed Apr 1, 2016
2 parents 4212497 + be6c5b3 commit 0792997
Show file tree
Hide file tree
Showing 115 changed files with 697 additions and 148 deletions.
23 changes: 23 additions & 0 deletions contrib/completions/bash/kubectl
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ _kubectl_get()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--label-columns=")
two_word_flags+=("-L")
flags+=("--no-headers")
Expand Down Expand Up @@ -342,6 +343,7 @@ _kubectl_get()
must_have_one_noun+=("service")
must_have_one_noun+=("serviceaccount")
must_have_one_noun+=("thirdpartyresource")
must_have_one_noun+=("thirdpartyresourcedata")
}

_kubectl_describe()
Expand All @@ -360,6 +362,7 @@ _kubectl_describe()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--recursive")
flags+=("-R")
flags+=("--selector=")
Expand Down Expand Up @@ -484,6 +487,7 @@ _kubectl_create_secret_docker-registry()
flags+=("--docker-username=")
flags+=("--dry-run")
flags+=("--generator=")
flags+=("--include-extended-apis")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
Expand Down Expand Up @@ -695,6 +699,7 @@ _kubectl_create_serviceaccount()

flags+=("--dry-run")
flags+=("--generator=")
flags+=("--include-extended-apis")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
Expand Down Expand Up @@ -757,6 +762,7 @@ _kubectl_create()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--record")
Expand Down Expand Up @@ -815,6 +821,7 @@ _kubectl_replace()
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--force")
flags+=("--grace-period=")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--record")
Expand Down Expand Up @@ -871,6 +878,7 @@ _kubectl_patch()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--patch=")
Expand Down Expand Up @@ -930,6 +938,7 @@ _kubectl_delete()
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--grace-period=")
flags+=("--ignore-not-found")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--recursive")
Expand Down Expand Up @@ -988,6 +997,7 @@ _kubectl_delete()
must_have_one_noun+=("service")
must_have_one_noun+=("serviceaccount")
must_have_one_noun+=("thirdpartyresource")
must_have_one_noun+=("thirdpartyresourcedata")
}

_kubectl_edit()
Expand All @@ -1006,6 +1016,7 @@ _kubectl_edit()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--output-version=")
Expand Down Expand Up @@ -1059,6 +1070,7 @@ _kubectl_apply()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--record")
Expand Down Expand Up @@ -1150,6 +1162,7 @@ _kubectl_logs()
two_word_flags+=("-c")
flags+=("--follow")
flags+=("-f")
flags+=("--include-extended-apis")
flags+=("--interactive")
flags+=("--limit-bytes=")
flags+=("--previous")
Expand Down Expand Up @@ -1207,6 +1220,7 @@ _kubectl_rolling-update()
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--image=")
flags+=("--include-extended-apis")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
Expand Down Expand Up @@ -1272,6 +1286,7 @@ _kubectl_scale()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--record")
Expand Down Expand Up @@ -1635,6 +1650,7 @@ _kubectl_run()
flags+=("--generator=")
flags+=("--hostport=")
flags+=("--image=")
flags+=("--include-extended-apis")
flags+=("--labels=")
two_word_flags+=("-l")
flags+=("--leave-stdin-open")
Expand Down Expand Up @@ -1787,6 +1803,7 @@ _kubectl_autoscale()
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--generator=")
flags+=("--include-extended-apis")
flags+=("--max=")
flags+=("--min=")
flags+=("--name=")
Expand Down Expand Up @@ -2085,6 +2102,7 @@ _kubectl_label()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
Expand Down Expand Up @@ -2153,6 +2171,7 @@ _kubectl_label()
must_have_one_noun+=("service")
must_have_one_noun+=("serviceaccount")
must_have_one_noun+=("thirdpartyresource")
must_have_one_noun+=("thirdpartyresourcedata")
}

_kubectl_annotate()
Expand All @@ -2172,6 +2191,7 @@ _kubectl_annotate()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
Expand Down Expand Up @@ -2602,6 +2622,7 @@ _kubectl_cluster-info()
flags_with_completion=()
flags_completion=()

flags+=("--include-extended-apis")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--certificate-authority=")
Expand Down Expand Up @@ -2721,6 +2742,7 @@ _kubectl_explain()
flags_with_completion=()
flags_completion=()

flags+=("--include-extended-apis")
flags+=("--recursive")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -2767,6 +2789,7 @@ _kubectl_convert()
two_word_flags+=("-f")
flags_with_completion+=("-f")
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--include-extended-apis")
flags+=("--local")
flags+=("--no-headers")
flags+=("--output=")
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-annotate.1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the resource to update the annotation

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-apply.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ JSON and YAML formats are accepted.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to file that contains the configuration to apply

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-autoscale.1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ An autoscaler can automatically increase or decrease number of pods deployed wit
\fB\-\-generator\fP="horizontalpodautoscaler/v1beta1"
The name of the API generator to use. Currently there is only 1 generator.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-max\fP=\-1
The upper limit for the number of pods that can be set by the autoscaler. Required.
Expand Down
6 changes: 6 additions & 0 deletions docs/man/man1/kubectl-cluster-info.1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ kubectl cluster\-info \- Display cluster info
Display addresses of the master and services with label kubernetes.io/cluster\-service=true


.SH OPTIONS
.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB\-\-alsologtostderr\fP=false
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-convert.1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ to change to output destination.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to file to need to get converted.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-local\fP=true
If true, convert will NOT try to contact api\-server but run locally.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-create-secret-docker-registry.1
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ by creating a dockercfg secret and attaching it to your service account.
\fB\-\-generator\fP="secret\-for\-docker\-registry/v1"
The name of the API generator to use.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-create-serviceaccount.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Create a service account with the specified name.
\fB\-\-generator\fP="serviceaccount/v1"
The name of the API generator to use.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-create.1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ JSON and YAML formats are accepted.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to file to use to create the resource

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-delete.1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ will be lost along with the rest of the resource.
\fB\-\-ignore\-not\-found\fP=false
Treat "resource not found" as a successful delete. Defaults to "true" when \-\-all is specified.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-describe.1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ componentstatuses (cs), endpoints (ep), and secrets.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file containing the resource to describe

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-R\fP, \fB\-\-recursive\fP=false
If true, process directory recursively.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-edit.1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ saved copy to include the latest resource version.
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to file to use to edit the resource

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP="yaml"
Output format. One of: yaml|json.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-explain.1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ componentstatuses (cs), endpoints (ep), and secrets.


.SH OPTIONS
.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-recursive\fP=false
Print the fields of fields (Currently only 1 level deep)
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-get.1
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ of the \-\-template flag, you can filter the attributes of the fetched resource(
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the resource to get from a server.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-L\fP, \fB\-\-label\-columns\fP=[]
Accepts a comma separated list of labels that are going to be presented as columns. Names are case\-sensitive. You can also use multiple flag statements like \-L label1 \-L label2...
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-label.1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ If \-\-resource\-version is specified, then updates will use this resource versi
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the resource to update the labels

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-logs.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Print the logs for a container in a pod. If the pod has only one container, the
\fB\-f\fP, \fB\-\-follow\fP=false
Specify if the logs should be streamed.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-interactive\fP=false
If true, prompt the user for input when required.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-patch.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Please refer to the models in
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the resource to update

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-replace.1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Please refer to the models in
\fB\-\-grace\-period\fP=\-1
Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-rolling-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ existing replication controller and overwrite at least one (common) label in its
\fB\-\-image\fP=""
Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with \-\-filename/\-f

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-run.1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Creates a deployment or job to manage the created container(s).
\fB\-\-image\fP=""
The image for the container to run.

.PP
\fB\-\-include\-extended\-apis\fP=true
If true, include definitions of new APIs via calls to the API server. [default true]

.PP
\fB\-l\fP, \fB\-\-labels\fP=""
Labels to apply to the pod(s).
Expand Down
Loading

1 comment on commit 0792997

@k8s-teamcity-mesosphere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity OSS :: Kubernetes Mesos :: 4 - Smoke Tests Build 20346 outcome was SUCCESS
Summary: Tests passed: 1, ignored: 267 Build time: 00:09:40

Please sign in to comment.