Origin: Provide option for just generating config when using oc cluster up

Created on 14 Dec 2016  路  4Comments  路  Source: openshift/origin

I am working on an openshift console extension. Right now, the process to get a quick cluster up and running with my extension loaded into the console is a bit cumbersome. Here is what I currently do..

$ oc cluster up --host-config-dir=<mypath>
$ oc cluster down
# Tweak master-config.yaml values for extensionScripts and extensionStylesheets
# to include my extension code
$ oc cluster up --host-config-dir=<mypath> --use-existing-config

Needing to spin-up a cluster twice is awkward and a little more time consuming than it needs to be.

Version
oc v1.4.0-rc1+b4e0954
kubernetes v1.4.0+776c994
Current Result

No option for oc cluster up --generate-config (or oc cluster config --host-config-dir=<mypath>)

Expected Result

If oc cluster up --generate-config --host-config-dir=<path> (or oc cluster config --host-config-dir=<mypath>) is run, a default set of configuration files will be created that can be tweaked as needed before ultimately doing an oc cluster up that points to that configuration set.

Alternatively, I'd be happy with any set of steps that will reduce the awkwardness of my workflow.

areusability componencomposition prioritP3

Most helpful comment

If you are working with a check-out of the Origin repository, you could use the Bash helpers in hack/lib/start.sh.

source "${GOPATH}"/src/github.com/openshift/origin/hack/lib/init.sh
os::util::environment::setup_all_server_vars "my-test-name"
os::start::configure_server

This will generate configuration in /tmp/openshift/my-test-name/openshift.local.config. Then you could point oc cluster up to that config. I _think_ these should be compatible, but I haven't tried. This may be too low-level for you, but I'm putting it out there. Once you iron out the kinks, though, it should be faster to generate the configuration.

All 4 comments

If you are working with a check-out of the Origin repository, you could use the Bash helpers in hack/lib/start.sh.

source "${GOPATH}"/src/github.com/openshift/origin/hack/lib/init.sh
os::util::environment::setup_all_server_vars "my-test-name"
os::start::configure_server

This will generate configuration in /tmp/openshift/my-test-name/openshift.local.config. Then you could point oc cluster up to that config. I _think_ these should be compatible, but I haven't tried. This may be too low-level for you, but I'm putting it out there. Once you iron out the kinks, though, it should be faster to generate the configuration.

@crobby I agree that an option to oc cluster up to provide configuration is cool, but this can be easily done right now in a different way than what @stevekuznetsov proposes.

We have developed a wrapper around oc cluster up (https://github.com/openshift-evangelists/oc-cluster-wrapper/tree/plugins) that provides this features and supports the customisation of the cluster via plugins.

What it does is use persistent configuration for the origin container (just like you do) but once the cluster is up, it exec into the origin container, modifies the origin-master.yaml configuration and it restarts the origin container, if needed. An example plugin can be found here:
https://github.com/openshift-evangelists/oc-cluster-wrapper/blob/plugins/plugins.d/pipelines.local.plugin

The workflow is:

oc-cluster up
oc-cluster install-plugin pipelines

You can just add a plugin with your extensions and following this workflow you'll have the cluster configured.

Also, the oc-cluster provides the ability to have multiple clusters, so you can have different variants and start one or another at will.

cc @csrwng

Thanks for the ideas guys. Both ideas might work for what I'm trying to do. I'll take a look at #12213 as well.

probably won't fix this, it's not a primary use case for cluster up and there's a valid (if admittedly slightly tedious) workaround.

Was this page helpful?
0 / 5 - 0 ratings