Skip to content

Commit

Permalink
Make naming of kubectl subcommands consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Ghods committed Apr 2, 2015
1 parent 620af16 commit ca18e86
Show file tree
Hide file tree
Showing 22 changed files with 235 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cluster/kube-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ echo "... calling validate-cluster" >&2
"${KUBE_ROOT}/cluster/validate-cluster.sh"

echo -e "Done, listing cluster services:\n" >&2
"${KUBE_ROOT}/cluster/kubectl.sh" clusterinfo
"${KUBE_ROOT}/cluster/kubectl.sh" cluster-info
echo

exit 0
2 changes: 1 addition & 1 deletion contrib/recipes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Solutions to interesting problems and unique implementations that showcase the extensibility of Kubernetes

- [Automated APIServer load balancing using Hipache and Fleet](docs/apiserver_hipache_registration.md)
- [Jenkins-triggered rolling updates on sucessful "builds"](docs/rollingupdates_from_jenkins.md)
- [Jenkins-triggered rolling updates on sucessful "builds"](docs/rolling_updates_from_jenkins.md)
57 changes: 57 additions & 0 deletions contrib/recipes/docs/rolling_updates_from_jenkins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
###How To
For our example, Jenkins is set up to have one build step in bash:

`Jenkins "Bash" build step`
```
#!/bin/bash
cd $WORKSPACE
source bin/jenkins.sh
source bin/kube-rolling.sh
```

Our project's build script (`bin/jenkins.sh`), is followed by our new kube-rolling script. Jenkins already has `$BUILD_NUMBER` set, but we need a few other variables that are set in `jenkins.sh` that we reference in `kube-rolling.sh`:

```
DOCKER_IMAGE="path_webteam/public"
REGISTRY_LOCATION="dockerreg.web.local/"
```

Jenkins builds our container, tags it with the build number, and runs a couple rudimentary tests on it. On success, it pushes it to our private docker registry. Once the container is pushed, it then executes our rolling update script.

`kube-rolling.sh`
```
#!/bin/bash
# KUBERNETES_MASTER: Your Kubernetes API Server endpoint
# BINARY_LOCATION: Location of pre-compiled Binaries (We build our own, there are others available)
# CONTROLLER_NAME: Name of the replicationController you're looking to update
# RESET_INTERVAL: Interval between pod updates
export KUBERNETES_MASTER="http://10.1.10.1:8080"
BINARY_LOCATION="https://build.web.local/kubernetes/"
CONTROLLER_NAME="public-frontend-controller"
RESET_INTERVAL="10s"
echo "*** Time to push to Kubernetes!";
#Delete then graba kubecfg binary from a static location
rm kubecfg
wget $BINARY_LOCATION/kubecfg
echo "*** Downloaded binary from $BINARY_LOCATION/kubecfg"
chmod +x kubecfg
# Update the controller with your new image!
echo "*** ./kubecfg -image \"$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER\" -u $RESET_INTERVAL rollingupdate $CONTROLLER_NAME"
./kubecfg -image "$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER" -u $RESET_INTERVAL rollingupdate $CONTROLLER_NAME
```

Though basic, this implementation allows our Jenkins instance to push container updates to our Kubernetes cluster without much trouble.

### Notes
When using a private docker registry as we are, the Jenkins slaves as well as the Kubernetes minions require the [.dockercfg](https://coreos.com/docs/launching-containers/building/customizing-docker/#using-a-dockercfg-file-for-authentication) file in order to function properly.

### Questions
twitter @jeefy

irc.freenode.net #kubernetes jeefy
4 changes: 2 additions & 2 deletions contrib/recipes/docs/rollingupdates_from_jenkins.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Jenkins builds our container, tags it with the build number, and runs a couple r
chmod +x kubecfg
# Update the controller with your new image!
echo "*** ./kubecfg -image \"$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER\" -u $RESET_INTERVAL rollingupdate $CONTROLLER_NAME"
./kubecfg -image "$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER" -u $RESET_INTERVAL rollingupdate $CONTROLLER_NAME
echo "*** ./kubecfg -image \"$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER\" -u $RESET_INTERVAL rolling-update $CONTROLLER_NAME"
./kubecfg -image "$REGISTRY_LOCATION$DOCKER_IMAGE:$BUILD_NUMBER" -u $RESET_INTERVAL rolling-update $CONTROLLER_NAME
```

Though basic, this implementation allows our Jenkins instance to push container updates to our Kubernetes cluster without much trouble.
Expand Down
2 changes: 1 addition & 1 deletion docs/cli-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See also issues with the following labels:
1. Service address/port lookup command(s)
1. Finish rolling update [#1353](https://github.com/GoogleCloudPlatform/kubernetes/issues/1353)
1. Friendly to auto-scaling [#2863](https://github.com/GoogleCloudPlatform/kubernetes/pull/2863#issuecomment-69701562)
1. Rollback (make rollingupdate reversible, and complete an in-progress rolling update by taking 2 replication controller names rather than always taking a file)
1. Rollback (make rolling-update reversible, and complete an in-progress rolling update by taking 2 replication controller names rather than always taking a file)
1. Rollover (replace multiple replication controllers with one, such as to clean up an aborted partial rollout)
1. Write a ReplicationController generator to derive the new ReplicationController from an old one (e.g., `--image-version=newversion`, which would apply a name suffix, update a label value, and apply an image tag)
1. Use readiness [#620](https://github.com/GoogleCloudPlatform/kubernetes/issues/620)
Expand Down
52 changes: 52 additions & 0 deletions docs/kubectl-api-versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## kubectl api-versions

Print available API versions.

### Synopsis


Print available API versions.

```
kubectl api-versions
```

### Options

```
-h, --help=false: help for api-versions
```

### Options inherrited from parent commands

```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--kubeconfig="": Path to the kubeconfig file to use for CLI requests.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kubectl](kubectl.md)

6 changes: 3 additions & 3 deletions docs/kubectl-apiversions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## kubectl apiversions
## kubectl api-versions

Print available API versions.

Expand All @@ -8,13 +8,13 @@ Print available API versions.
Print available API versions.

```
kubectl apiversions
kubectl api-versions
```

### Options

```
-h, --help=false: help for apiversions
-h, --help=false: help for api-versions
```

### Options inherrited from parent commands
Expand Down
52 changes: 52 additions & 0 deletions docs/kubectl-cluster-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## kubectl cluster-info

Display cluster info

### Synopsis


Display addresses of the master and services with label kubernetes.io/cluster-service=true

```
kubectl cluster-info
```

### Options

```
-h, --help=false: help for cluster-info
```

### Options inherrited from parent commands

```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--kubeconfig="": Path to the kubeconfig file to use for CLI requests.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kubectl](kubectl.md)

6 changes: 3 additions & 3 deletions docs/kubectl-clusterinfo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## kubectl clusterinfo
## kubectl cluster-info

Display cluster info

Expand All @@ -8,13 +8,13 @@ Display cluster info
Display addresses of the master and services with label kubernetes.io/cluster-service=true

```
kubectl clusterinfo
kubectl cluster-info
```

### Options

```
-h, --help=false: help for clusterinfo
-h, --help=false: help for cluster-info
```

### Options inherrited from parent commands
Expand Down
10 changes: 5 additions & 5 deletions docs/kubectl-rollingupdate.md → docs/kubectl-rolling-update.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## kubectl rollingupdate
## kubectl rolling-update

Perform a rolling update of the given ReplicationController.

Expand All @@ -12,24 +12,24 @@ new PodTemplate. The new-controller.json must specify the same namespace as the
existing controller and overwrite at least one (common) label in its replicaSelector.

```
kubectl rollingupdate OLD_CONTROLLER_NAME -f NEW_CONTROLLER_SPEC
kubectl rolling-update OLD_CONTROLLER_NAME -f NEW_CONTROLLER_SPEC
```

### Examples

```
// Update pods of frontend-v1 using new controller data in frontend-v2.json.
$ kubectl rollingupdate frontend-v1 -f frontend-v2.json
$ kubectl rolling-update frontend-v1 -f frontend-v2.json
// Update pods of frontend-v1 using JSON data passed into stdin.
$ cat frontend-v2.json | kubectl rollingupdate frontend-v1 -f -
$ cat frontend-v2.json | kubectl rolling-update frontend-v1 -f -
```

### Options

```
-f, --filename="": Filename or URL to file to use to create the new controller.
-h, --help=false: help for rollingupdate
-h, --help=false: help for rolling-update
--poll-interval="3s": Time delay between polling controller status after update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
--timeout="5m0s": Max time to wait for a controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
--update-period="1m0s": Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
Expand Down
6 changes: 3 additions & 3 deletions docs/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ kubectl
* [kubectl-delete](kubectl-delete.md)
* [kubectl-namespace](kubectl-namespace.md)
* [kubectl-log](kubectl-log.md)
* [kubectl-rollingupdate](kubectl-rollingupdate.md)
* [kubectl-rolling-update](kubectl-rolling-update.md)
* [kubectl-resize](kubectl-resize.md)
* [kubectl-exec](kubectl-exec.md)
* [kubectl-port-forward](kubectl-port-forward.md)
Expand All @@ -62,7 +62,7 @@ kubectl
* [kubectl-expose](kubectl-expose.md)
* [kubectl-label](kubectl-label.md)
* [kubectl-config](kubectl-config.md)
* [kubectl-clusterinfo](kubectl-clusterinfo.md)
* [kubectl-apiversions](kubectl-apiversions.md)
* [kubectl-cluster-info](kubectl-cluster-info.md)
* [kubectl-api-versions](kubectl-api-versions.md)
* [kubectl-version](kubectl-version.md)

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

.SH NAME
.PP
kubectl apiversions \- Print available API versions.
kubectl api\-versions \- Print available API versions.


.SH SYNOPSIS
.PP
\fBkubectl apiversions\fP [OPTIONS]
\fBkubectl api\-versions\fP [OPTIONS]


.SH DESCRIPTION
Expand All @@ -19,7 +19,7 @@ Print available API versions.
.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP=false
help for apiversions
help for api\-versions


.SH OPTIONS INHERITED FROM PARENT COMMANDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

.SH NAME
.PP
kubectl clusterinfo \- Display cluster info
kubectl cluster\-info \- Display cluster info


.SH SYNOPSIS
.PP
\fBkubectl clusterinfo\fP [OPTIONS]
\fBkubectl cluster\-info\fP [OPTIONS]


.SH DESCRIPTION
Expand All @@ -19,7 +19,7 @@ Display addresses of the master and services with label kubernetes.io/cluster\-s
.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP=false
help for clusterinfo
help for cluster\-info


.SH OPTIONS INHERITED FROM PARENT COMMANDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

.SH NAME
.PP
kubectl rollingupdate \- Perform a rolling update of the given ReplicationController.
kubectl rolling\-update \- Perform a rolling update of the given ReplicationController.


.SH SYNOPSIS
.PP
\fBkubectl rollingupdate\fP [OPTIONS]
\fBkubectl rolling\-update\fP [OPTIONS]


.SH DESCRIPTION
Expand All @@ -28,7 +28,7 @@ existing controller and overwrite at least one (common) label in its replicaSele

.PP
\fB\-h\fP, \fB\-\-help\fP=false
help for rollingupdate
help for rolling\-update

.PP
\fB\-\-poll\-interval\fP="3s"
Expand Down Expand Up @@ -151,10 +151,10 @@ existing controller and overwrite at least one (common) label in its replicaSele

.nf
// Update pods of frontend\-v1 using new controller data in frontend\-v2.json.
$ kubectl rollingupdate frontend\-v1 \-f frontend\-v2.json
$ kubectl rolling\-update frontend\-v1 \-f frontend\-v2.json

// Update pods of frontend\-v1 using JSON data passed into stdin.
$ cat frontend\-v2.json | kubectl rollingupdate frontend\-v1 \-f \-
$ cat frontend\-v2.json | kubectl rolling\-update frontend\-v1 \-f \-

.fi
.RE
Expand Down
2 changes: 1 addition & 1 deletion docs/man/man1/kubectl.1
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Find more information at

.SH SEE ALSO
.PP
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-log(1)\fP, \fBkubectl\-rollingupdate(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run\-container(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-clusterinfo(1)\fP, \fBkubectl\-apiversions(1)\fP, \fBkubectl\-version(1)\fP,
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-log(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run\-container(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,


.SH HISTORY
Expand Down
Loading

0 comments on commit ca18e86

Please sign in to comment.