mirror of https://github.com/k3s-io/k3s
Make naming of kubectl subcommands consistent
parent
620af16892
commit
ca18e86877
|
@ -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,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)
|
||||
|
|
|
@ -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
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
## kubectl apiversions
|
||||
## kubectl api-versions
|
||||
|
||||
Print available API versions.
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
## kubectl clusterinfo
|
||||
## kubectl cluster-info
|
||||
|
||||
Display cluster info
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## kubectl rollingupdate
|
||||
## kubectl rolling-update
|
||||
|
||||
Perform a rolling update of the given ReplicationController.
|
||||
|
||||
|
@ -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".
|
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
|
@ -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
|
||||
|
@ -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
|
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@ The replication controller simply ensures that the desired number of pods matche
|
|||
|
||||
The replication controller is forever constrained to this narrow responsibility. It itself will not perform readiness nor liveness probes. Rather than performing auto-scaling, it is intended to be controlled by an external auto-scaler (as discussed in [#492](https://github.com/GoogleCloudPlatform/kubernetes/issues/492)), which would change its `replicas` field. We will not add scheduling policies (e.g., [spreading](https://github.com/GoogleCloudPlatform/kubernetes/issues/367#issuecomment-48428019)) to replication controller. Nor should it verify that the pods controlled match the currently specified template, as that would obstruct auto-sizing and other automated processes. Similarly, completion deadlines, ordering dependencies, configuration expansion, and other features belong elsewhere. We even plan to factor out the mechanism for bulk pod creation ([#170](https://github.com/GoogleCloudPlatform/kubernetes/issues/170)).
|
||||
|
||||
The replication controller is intended to be a composable building-block primitive. We expect higher-level APIs and/or tools to be built on top of it and other complementary primitives for user convenience in the future. The "macro" operations currently supported by kubectl (run-container, stop, resize, rollingupdate) are proof-of-concept examples of this. For instance, we could imagine something like [Asgard](http://techblog.netflix.com/2012/06/asgard-web-based-cloud-management-and.html) managing replication controllers, auto-scalers, services, scheduling policies, canaries, etc.
|
||||
The replication controller is intended to be a composable building-block primitive. We expect higher-level APIs and/or tools to be built on top of it and other complementary primitives for user convenience in the future. The "macro" operations currently supported by kubectl (run-container, stop, resize, rolling-update) are proof-of-concept examples of this. For instance, we could imagine something like [Asgard](http://techblog.netflix.com/2012/06/asgard-web-based-cloud-management-and.html) managing replication controllers, auto-scalers, services, scheduling policies, canaries, etc.
|
||||
|
||||
## Common usage patterns
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ If you go back to the [demo website](http://localhost:8001/static/index.html) yo
|
|||
We will now update the docker image to serve a different image by doing a rolling update to a new Docker image.
|
||||
|
||||
```bash
|
||||
$ ./cluster/kubectl.sh rollingupdate update-demo-nautilus --update-period=10s -f examples/update-demo/v1beta1/kitten-rc.yaml
|
||||
$ ./cluster/kubectl.sh rolling-update update-demo-nautilus --update-period=10s -f examples/update-demo/v1beta1/kitten-rc.yaml
|
||||
```
|
||||
The rollingupdate command in kubectl will do 2 things:
|
||||
The rolling-update command in kubectl will do 2 things:
|
||||
|
||||
1. Create a new replication controller with a pod template that uses the new image (`gcr.io/google_containers/update-demo:kitten`)
|
||||
2. Resize the old and new replication controllers until the new controller replaces the old. This will kill the current pods one at a time, spinnning up new ones to replace them.
|
||||
|
|
|
@ -18,6 +18,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
@ -27,8 +28,10 @@ import (
|
|||
|
||||
func (f *Factory) NewCmdApiVersions(out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "apiversions",
|
||||
Short: "Print available API versions.",
|
||||
Use: "api-versions",
|
||||
// apiversions is deprecated.
|
||||
Aliases: []string{"apiversions"},
|
||||
Short: "Print available API versions.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := RunApiVersions(f, out)
|
||||
util.CheckErr(err)
|
||||
|
@ -38,6 +41,10 @@ func (f *Factory) NewCmdApiVersions(out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
func RunApiVersions(f *Factory, out io.Writer) error {
|
||||
if os.Args[1] == "apiversions" {
|
||||
printDeprecationWarning("api-versions", "apiversions")
|
||||
}
|
||||
|
||||
client, err := f.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -19,6 +19,7 @@ package cmd
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
|
@ -31,9 +32,11 @@ import (
|
|||
|
||||
func (f *Factory) NewCmdClusterInfo(out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "clusterinfo",
|
||||
Short: "Display cluster info",
|
||||
Long: "Display addresses of the master and services with label kubernetes.io/cluster-service=true",
|
||||
Use: "cluster-info",
|
||||
// clusterinfo is deprecated.
|
||||
Aliases: []string{"clusterinfo"},
|
||||
Short: "Display cluster info",
|
||||
Long: "Display addresses of the master and services with label kubernetes.io/cluster-service=true",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := RunClusterInfo(f, out, cmd)
|
||||
util.CheckErr(err)
|
||||
|
@ -43,6 +46,10 @@ func (f *Factory) NewCmdClusterInfo(out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
func RunClusterInfo(factory *Factory, out io.Writer, cmd *cobra.Command) error {
|
||||
if os.Args[1] == "clusterinfo" {
|
||||
printDeprecationWarning("cluster-info", "clusterinfo")
|
||||
}
|
||||
|
||||
client, err := factory.ClientConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/resource"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
@ -492,3 +493,7 @@ func (c *clientCache) ClientForVersion(version string) (*client.Client, error) {
|
|||
c.clients[config.Version] = client
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func printDeprecationWarning(command, alias string) {
|
||||
glog.Warningf("%s is DEPRECATED and will be removed in a future version. Use %s instead.", alias, command)
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package cmd
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
|
||||
|
@ -31,24 +32,26 @@ const (
|
|||
updatePeriod = "1m0s"
|
||||
timeout = "5m0s"
|
||||
pollInterval = "3s"
|
||||
rollingupdate_long = `Perform a rolling update of the given ReplicationController.
|
||||
rollingUpdate_long = `Perform a rolling update of the given ReplicationController.
|
||||
|
||||
Replaces the specified controller with new controller, updating one pod at a time to use the
|
||||
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.`
|
||||
rollingupdate_example = `// Update pods of frontend-v1 using new controller data in frontend-v2.json.
|
||||
$ kubectl rollingupdate frontend-v1 -f frontend-v2.json
|
||||
rollingUpdate_example = `// Update pods of frontend-v1 using new controller data in 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 -`
|
||||
)
|
||||
|
||||
func (f *Factory) NewCmdRollingUpdate(out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "rollingupdate OLD_CONTROLLER_NAME -f NEW_CONTROLLER_SPEC",
|
||||
Use: "rolling-update OLD_CONTROLLER_NAME -f NEW_CONTROLLER_SPEC",
|
||||
// rollingupdate is deprecated.
|
||||
Aliases: []string{"rollingupdate"},
|
||||
Short: "Perform a rolling update of the given ReplicationController.",
|
||||
Long: rollingupdate_long,
|
||||
Example: rollingupdate_example,
|
||||
Long: rollingUpdate_long,
|
||||
Example: rollingUpdate_example,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := RunRollingUpdate(f, out, cmd, args)
|
||||
util.CheckErr(err)
|
||||
|
@ -62,6 +65,10 @@ func (f *Factory) NewCmdRollingUpdate(out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
func RunRollingUpdate(f *Factory, out io.Writer, cmd *cobra.Command, args []string) error {
|
||||
if os.Args[1] == "rollingupdate" {
|
||||
printDeprecationWarning("rolling-update", "rollingupdate")
|
||||
}
|
||||
|
||||
filename := util.GetFlagString(cmd, "filename")
|
||||
if len(filename) == 0 {
|
||||
return util.UsageError(cmd, "Must specify filename for new controller")
|
||||
|
|
|
@ -87,8 +87,8 @@ var _ = Describe("kubectl", func() {
|
|||
By("creating the initial replication controller")
|
||||
runKubectl("create", "-f", nautilusPath)
|
||||
validateController(c, nautilusImage, 2, "update-demo", updateDemoSelector, getUDData("nautilus.jpg"))
|
||||
By("rollingupdate to new replication controller")
|
||||
runKubectl("rollingupdate", "update-demo-nautilus", "--update-period=1s", "-f", kittenPath)
|
||||
By("rolling-update to new replication controller")
|
||||
runKubectl("rolling-update", "update-demo-nautilus", "--update-period=1s", "-f", kittenPath)
|
||||
validateController(c, kittenImage, 2, "update-demo", updateDemoSelector, getUDData("kitten.jpg"))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue