Browse code

Set default image version for 'oc cluster up'

Cesar Wong authored on 2016/07/26 04:04:04
Showing 4 changed files
... ...
@@ -208,7 +208,8 @@ To use a different suffix, specify it with `--routing-suffix`.
208 208
 
209 209
 ## Specifying Images to Use
210 210
 
211
-By default `oc cluster up` uses `openshift/origin:latest` as its OpenShift image and `openshift-origin-${component}:latest` for 
211
+By default `oc cluster up` uses `openshift/origin:[released-version]` as its OpenShift image (where [released-version]
212
+corresponds to the release of the `oc` client) and `openshift-origin-${component}:[released-version]` for
212 213
 other images created by the OpenShift cluster (registry, router, builders, etc). It is possible to use a different set of 
213 214
 images by specifying the version and/or the image prefix.
214 215
 
... ...
@@ -94,7 +94,7 @@ A public hostname can also be specified for the server with the \-\-public\-host
94 94
     Use existing configuration if present
95 95
 
96 96
 .PP
97
-\fB\-\-version\fP="latest"
97
+\fB\-\-version\fP=""
98 98
     Specify the tag for OpenShift images
99 99
 
100 100
 
... ...
@@ -94,7 +94,7 @@ A public hostname can also be specified for the server with the \-\-public\-host
94 94
     Use existing configuration if present
95 95
 
96 96
 .PP
97
-\fB\-\-version\fP="latest"
97
+\fB\-\-version\fP=""
98 98
     Specify the tag for OpenShift images
99 99
 
100 100
 
... ...
@@ -28,6 +28,7 @@ import (
28 28
 	"github.com/openshift/origin/pkg/cmd/util/clientcmd"
29 29
 	osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd"
30 30
 	dockerutil "github.com/openshift/origin/pkg/cmd/util/docker"
31
+	"github.com/openshift/origin/pkg/cmd/util/variable"
31 32
 )
32 33
 
33 34
 const (
... ...
@@ -121,7 +122,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob
121 121
 	}
122 122
 	cmd.Flags().BoolVar(&config.ShouldCreateDockerMachine, "create-machine", false, "Create a Docker machine if one doesn't exist")
123 123
 	cmd.Flags().StringVar(&config.DockerMachine, "docker-machine", "", "Specify the Docker machine to use")
124
-	cmd.Flags().StringVar(&config.ImageVersion, "version", "latest", "Specify the tag for OpenShift images")
124
+	cmd.Flags().StringVar(&config.ImageVersion, "version", "", "Specify the tag for OpenShift images")
125 125
 	cmd.Flags().StringVar(&config.Image, "image", "openshift/origin", "Specify the images to use for OpenShift")
126 126
 	cmd.Flags().BoolVar(&config.SkipRegistryCheck, "skip-registry-check", false, "Skip Docker daemon registry check")
127 127
 	cmd.Flags().StringVar(&config.PublicHostname, "public-hostname", "", "Public hostname for OpenShift cluster")
... ...
@@ -199,6 +200,10 @@ func (c *ClientStartConfig) Complete(f *osclientcmd.Factory, cmd *cobra.Command)
199 199
 	c.originalFactory = f
200 200
 	c.command = cmd
201 201
 
202
+	if len(c.ImageVersion) == 0 {
203
+		c.ImageVersion = defaultImageVersion()
204
+	}
205
+
202 206
 	c.addTask("Checking OpenShift client", c.CheckOpenShiftClient)
203 207
 
204 208
 	if c.ShouldCreateDockerMachine {
... ...
@@ -308,6 +313,10 @@ func defaultPortForwarding() bool {
308 308
 
309 309
 const defaultDockerMachineName = "openshift"
310 310
 
311
+func defaultImageVersion() string {
312
+	return variable.OverrideVersion.LastSemanticVersion()
313
+}
314
+
311 315
 // CreateDockerMachine will create a new Docker machine to run OpenShift
312 316
 func (c *ClientStartConfig) CreateDockerMachine(out io.Writer) error {
313 317
 	if len(c.DockerMachine) == 0 {