@@ -17,7 +17,6 @@ import (
1717 cliconfig "github.com/docker/docker/cli/config"
1818 dockerclient "github.com/docker/docker/client"
1919 "github.com/golang/glog"
20- "github.com/openshift/origin/pkg/oc/bootstrap/clusterup/tmpformac"
2120 "github.com/spf13/cobra"
2221 "github.com/spf13/pflag"
2322 "golang.org/x/net/context"
@@ -37,6 +36,8 @@ import (
3736 "github.com/openshift/origin/pkg/cmd/util/variable"
3837 "github.com/openshift/origin/pkg/oc/bootstrap"
3938 "github.com/openshift/origin/pkg/oc/bootstrap/clusterup/componentinstall"
39+ "github.com/openshift/origin/pkg/oc/bootstrap/clusterup/components/registry"
40+ "github.com/openshift/origin/pkg/oc/bootstrap/clusterup/tmpformac"
4041 "github.com/openshift/origin/pkg/oc/bootstrap/docker/dockerhelper"
4142 "github.com/openshift/origin/pkg/oc/bootstrap/docker/dockermachine"
4243 "github.com/openshift/origin/pkg/oc/bootstrap/docker/errors"
@@ -481,12 +482,35 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
481482 }
482483 taskPrinter .Success ()
483484
484- // Install a registry
485- taskPrinter .StartTask ("Installing registry" )
486- if err := c .InstallRegistry (out ); err != nil {
487- return taskPrinter .ToError (err )
485+ clusterAdminKubeConfigBytes , err := ioutil .ReadFile (path .Join (c .LocalConfigDir , "master" , "admin.kubeconfig" ))
486+ if err != nil {
487+ return err
488+ }
489+ clusterAdminKubeConfig , err := kclientcmd .RESTConfigFromKubeConfig (clusterAdminKubeConfigBytes )
490+ if err != nil {
491+ return err
492+ }
493+
494+ // TODO, now we build up a set of things to install here. We build the list so that we can install everything in
495+ // TODO parallel to avoid anyone accidentally introducing dependencies. We'll start with migrating what we have
496+ // TODO and then we'll try to clean it up.
497+ registryInstall := & registry.RegistryComponentOptions {
498+ ClusterAdminKubeConfig : clusterAdminKubeConfig ,
499+
500+ OCImage : c .openshiftImage (),
501+ MasterConfigDir : path .Join (c .LocalConfigDir , "master" ),
502+ Images : c .imageFormat (),
503+ PVDir : c .HostPersistentVolumesDir ,
504+ }
505+
506+ componentsToInstall := []componentinstall.Component {}
507+ componentsToInstall = append (componentsToInstall , c .ImportInitialObjectsComponents (c .Out )... )
508+ componentsToInstall = append (componentsToInstall , registryInstall )
509+
510+ err = componentinstall .InstallComponents (componentsToInstall , c .GetDockerClient (), path .Join (c .BaseTempDir , "logs" ))
511+ if err != nil {
512+ return err
488513 }
489- taskPrinter .Success ()
490514
491515 // Install a router
492516 taskPrinter .StartTask ("Installing router" )
@@ -504,13 +528,6 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
504528 taskPrinter .Success ()
505529 }
506530
507- // Import default image streams
508- taskPrinter .StartTask ("Importing default data router" )
509- if err := c .ImportInitialObjects (out ); err != nil {
510- return taskPrinter .ToError (err )
511- }
512- taskPrinter .Success ()
513-
514531 // Install logging
515532 if c .ShouldInstallLogging {
516533 taskPrinter .StartTask ("Installing logging" )
@@ -882,19 +899,6 @@ func (c *ClusterUpConfig) imageFormat() string {
882899 return fmt .Sprintf ("%s-${component}:%s" , c .Image , c .ImageVersion )
883900}
884901
885- // InstallRegistry installs the OpenShift registry on the server
886- func (c * ClusterUpConfig ) InstallRegistry (out io.Writer ) error {
887- _ , kubeClient , err := c .Clients ()
888- if err != nil {
889- return err
890- }
891- f , err := c .Factory ()
892- if err != nil {
893- return err
894- }
895- return c .OpenShiftHelper ().InstallRegistry (c .GetDockerClient (), c .openshiftImage (), kubeClient , f , c .LocalConfigDir , path .Join (c .BaseTempDir , "logs" ), c .imageFormat (), c .HostPersistentVolumesDir , out , os .Stderr )
896- }
897-
898902// InstallRouter installs a default router on the server
899903func (c * ClusterUpConfig ) InstallRouter (out io.Writer ) error {
900904 _ , kubeClient , err := c .Clients ()
@@ -935,7 +939,8 @@ func (c *ClusterUpConfig) InstallWebConsole(out io.Writer) error {
935939 return c .OpenShiftHelper ().InstallWebConsole (f , c .imageFormat (), c .ServerLogLevel , publicURL , masterURL , loggingURL , metricsURL )
936940}
937941
938- func (c * ClusterUpConfig ) ImportInitialObjects (out io.Writer ) error {
942+ // TODO this should become a separate thing we can install, like registry
943+ func (c * ClusterUpConfig ) ImportInitialObjectsComponents (out io.Writer ) []componentinstall.Component {
939944 componentsToInstall := []componentinstall.Component {}
940945 componentsToInstall = append (componentsToInstall ,
941946 c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftNamespace , map [string ]string {
@@ -950,7 +955,7 @@ func (c *ClusterUpConfig) ImportInitialObjects(out io.Writer) error {
950955 componentsToInstall = append (componentsToInstall ,
951956 c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftInfraNamespace , internalCurrentTemplateLocations )... )
952957
953- return componentinstall . InstallComponents ( componentsToInstall , c . GetDockerClient (), path . Join ( c . BaseTempDir , "logs" ))
958+ return componentsToInstall
954959}
955960
956961// InstallLogging will start the installation of logging components
0 commit comments