From 68b6c7eb91ae1a50dee015c2d9e06cc73a6a1cbe Mon Sep 17 00:00:00 2001 From: Cesar Wong Date: Mon, 25 Jul 2016 15:04:04 -0400 Subject: [PATCH] Set default image version for 'oc cluster up' --- docs/cluster_up_down.md | 3 ++- docs/man/man1/oc-cluster-up.1 | 2 +- docs/man/man1/openshift-cli-cluster-up.1 | 2 +- pkg/bootstrap/docker/up.go | 8 +++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/cluster_up_down.md b/docs/cluster_up_down.md index 3fde75a90e36..3d4c2ed25be7 100644 --- a/docs/cluster_up_down.md +++ b/docs/cluster_up_down.md @@ -208,7 +208,8 @@ To use a different suffix, specify it with `--routing-suffix`. ## Specifying Images to Use -By default `oc cluster up` uses `openshift/origin:latest` as its OpenShift image and `openshift-origin-${component}:latest` for +By default `oc cluster up` uses `openshift/origin:[released-version]` as its OpenShift image (where [released-version] +corresponds to the release of the `oc` client) and `openshift-origin-${component}:[released-version]` for other images created by the OpenShift cluster (registry, router, builders, etc). It is possible to use a different set of images by specifying the version and/or the image prefix. diff --git a/docs/man/man1/oc-cluster-up.1 b/docs/man/man1/oc-cluster-up.1 index 4f25ba695168..0b81b24373c0 100644 --- a/docs/man/man1/oc-cluster-up.1 +++ b/docs/man/man1/oc-cluster-up.1 @@ -94,7 +94,7 @@ A public hostname can also be specified for the server with the \-\-public\-host Use existing configuration if present .PP -\fB\-\-version\fP="latest" +\fB\-\-version\fP="v1.3.0\-alpha.2" Specify the tag for OpenShift images diff --git a/docs/man/man1/openshift-cli-cluster-up.1 b/docs/man/man1/openshift-cli-cluster-up.1 index 0978409d12a5..8caa0983fcfb 100644 --- a/docs/man/man1/openshift-cli-cluster-up.1 +++ b/docs/man/man1/openshift-cli-cluster-up.1 @@ -94,7 +94,7 @@ A public hostname can also be specified for the server with the \-\-public\-host Use existing configuration if present .PP -\fB\-\-version\fP="latest" +\fB\-\-version\fP="v1.3.0\-alpha.2" Specify the tag for OpenShift images diff --git a/pkg/bootstrap/docker/up.go b/pkg/bootstrap/docker/up.go index 0b4e84c49f3f..e8fa546652bc 100644 --- a/pkg/bootstrap/docker/up.go +++ b/pkg/bootstrap/docker/up.go @@ -28,6 +28,7 @@ import ( "github.com/openshift/origin/pkg/cmd/util/clientcmd" osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" dockerutil "github.com/openshift/origin/pkg/cmd/util/docker" + "github.com/openshift/origin/pkg/cmd/util/variable" ) const ( @@ -105,6 +106,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob config := &ClientStartConfig{ Out: out, PortForwarding: defaultPortForwarding(), + ImageVersion: defaultImageVersion(), } cmd := &cobra.Command{ Use: name, @@ -121,7 +123,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob } cmd.Flags().BoolVar(&config.ShouldCreateDockerMachine, "create-machine", false, "Create a Docker machine if one doesn't exist") cmd.Flags().StringVar(&config.DockerMachine, "docker-machine", "", "Specify the Docker machine to use") - cmd.Flags().StringVar(&config.ImageVersion, "version", "latest", "Specify the tag for OpenShift images") + cmd.Flags().StringVar(&config.ImageVersion, "version", config.ImageVersion, "Specify the tag for OpenShift images") cmd.Flags().StringVar(&config.Image, "image", "openshift/origin", "Specify the images to use for OpenShift") cmd.Flags().BoolVar(&config.SkipRegistryCheck, "skip-registry-check", false, "Skip Docker daemon registry check") cmd.Flags().StringVar(&config.PublicHostname, "public-hostname", "", "Public hostname for OpenShift cluster") @@ -308,6 +310,10 @@ func defaultPortForwarding() bool { const defaultDockerMachineName = "openshift" +func defaultImageVersion() string { + return variable.OverrideVersion.LastSemanticVersion() +} + // CreateDockerMachine will create a new Docker machine to run OpenShift func (c *ClientStartConfig) CreateDockerMachine(out io.Writer) error { if len(c.DockerMachine) == 0 {