Skip to content

Commit

Permalink
Set default image version for 'oc cluster up'
Browse files Browse the repository at this point in the history
  • Loading branch information
csrwng committed Jul 27, 2016
1 parent 6c631f8 commit ea7f204
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/cluster_up_down.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/man/man1/oc-cluster-up.1
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Specify the tag for OpenShift images


Expand Down
2 changes: 1 addition & 1 deletion docs/man/man1/openshift-cli-cluster-up.1
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Specify the tag for OpenShift images


Expand Down
11 changes: 10 additions & 1 deletion pkg/bootstrap/docker/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -121,7 +122,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", "", "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")
Expand Down Expand Up @@ -199,6 +200,10 @@ func (c *ClientStartConfig) Complete(f *osclientcmd.Factory, cmd *cobra.Command)
c.originalFactory = f
c.command = cmd

if len(c.ImageVersion) == 0 {
c.ImageVersion = defaultImageVersion()
}

c.addTask("Checking OpenShift client", c.CheckOpenShiftClient)

if c.ShouldCreateDockerMachine {
Expand Down Expand Up @@ -308,6 +313,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 {
Expand Down

0 comments on commit ea7f204

Please sign in to comment.