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 25, 2016
1 parent e430003 commit edf2642
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 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
8 changes: 7 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 @@ -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,
Expand All @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit edf2642

Please sign in to comment.