@@ -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"
@@ -479,12 +480,39 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
479480 }
480481 taskPrinter .Success ()
481482
482- // Install a registry
483- taskPrinter .StartTask ("Installing registry" )
484- if err := c .InstallRegistry (out ); err != nil {
485- return taskPrinter .ToError (err )
483+ clusterAdminKubeConfigBytes , err := ioutil .ReadFile (path .Join (c .LocalConfigDir , "master" , "admin.kubeconfig" ))
484+ if err != nil {
485+ return err
486+ }
487+ kubeconfigLoader , err := kclientcmd .NewClientConfigFromBytes (clusterAdminKubeConfigBytes )
488+ if err != nil {
489+ return err
490+ }
491+ clusterAdminKubeConfig , err := kubeconfigLoader .ClientConfig ()
492+ if err != nil {
493+ return err
494+ }
495+
496+ // TODO, now we build up a set of things to install here. We build the list so that we can install everything in
497+ // TODO parallel to avoid anyone accidentally introducing dependencies. We'll start with migrating what we have
498+ // TODO and then we'll try to clean it up.
499+ registryInstall := & registry.RegistryComponentOptions {
500+ ClusterAdminKubeConfig : clusterAdminKubeConfig ,
501+
502+ OCImage : c .openshiftImage (),
503+ MasterConfigDir : path .Join (c .LocalConfigDir , "master" ),
504+ Images : c .imageFormat (),
505+ PVDir : c .HostPersistentVolumesDir ,
506+ }
507+
508+ componentsToInstall := []componentinstall.Component {}
509+ componentsToInstall = append (componentsToInstall , c .ImportInitialObjectsComponents (c .Out )... )
510+ componentsToInstall = append (componentsToInstall , registryInstall )
511+
512+ err = componentinstall .InstallComponents (componentsToInstall , c .GetDockerClient (), path .Join (c .BaseTempDir , "logs" ))
513+ if err != nil {
514+ return err
486515 }
487- taskPrinter .Success ()
488516
489517 // Install a router
490518 taskPrinter .StartTask ("Installing router" )
@@ -502,13 +530,6 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
502530 taskPrinter .Success ()
503531 }
504532
505- // Import default image streams
506- taskPrinter .StartTask ("Importing default data router" )
507- if err := c .ImportInitialObjects (out ); err != nil {
508- return taskPrinter .ToError (err )
509- }
510- taskPrinter .Success ()
511-
512533 // Install logging
513534 if c .ShouldInstallLogging {
514535 taskPrinter .StartTask ("Installing logging" )
@@ -530,7 +551,7 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
530551 // Install template service broker if our version is high enough
531552 if c .ShouldInstallServiceCatalog {
532553 taskPrinter .StartTask ("Installing template service broker" )
533- if err := c .InstallServiceCatalog (out ); err != nil {
554+ if err := c .InstallTemplateServiceBroker (out ); err != nil {
534555 return taskPrinter .ToError (err )
535556 }
536557 taskPrinter .Success ()
@@ -540,7 +561,7 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
540561 // the TSB registration is not persisted.
541562 if c .ShouldInstallServiceCatalog {
542563 taskPrinter .StartTask ("Registering template service broker with service catalog" )
543- if err := c .InstallServiceCatalog (out ); err != nil {
564+ if err := c .RegisterTemplateServiceBroker (out ); err != nil {
544565 return taskPrinter .ToError (err )
545566 }
546567 taskPrinter .Success ()
@@ -884,19 +905,6 @@ func (c *ClusterUpConfig) imageFormat() string {
884905 return fmt .Sprintf ("%s-${component}:%s" , c .Image , c .ImageVersion )
885906}
886907
887- // InstallRegistry installs the OpenShift registry on the server
888- func (c * ClusterUpConfig ) InstallRegistry (out io.Writer ) error {
889- _ , kubeClient , err := c .Clients ()
890- if err != nil {
891- return err
892- }
893- f , err := c .Factory ()
894- if err != nil {
895- return err
896- }
897- return c .OpenShiftHelper ().InstallRegistry (c .GetDockerClient (), c .openshiftImage (), kubeClient , f , c .LocalConfigDir , path .Join (c .BaseTempDir , "logs" ), c .imageFormat (), c .HostPersistentVolumesDir , out , os .Stderr )
898- }
899-
900908// InstallRouter installs a default router on the server
901909func (c * ClusterUpConfig ) InstallRouter (out io.Writer ) error {
902910 _ , kubeClient , err := c .Clients ()
@@ -937,7 +945,8 @@ func (c *ClusterUpConfig) InstallWebConsole(out io.Writer) error {
937945 return c .OpenShiftHelper ().InstallWebConsole (f , c .imageFormat (), c .ServerLogLevel , publicURL , masterURL , loggingURL , metricsURL )
938946}
939947
940- func (c * ClusterUpConfig ) ImportInitialObjects (out io.Writer ) error {
948+ // TODO this should become a separate thing we can install, like registry
949+ func (c * ClusterUpConfig ) ImportInitialObjectsComponents (out io.Writer ) []componentinstall.Component {
941950 componentsToInstall := []componentinstall.Component {}
942951 componentsToInstall = append (componentsToInstall ,
943952 c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftNamespace , map [string ]string {
@@ -952,7 +961,7 @@ func (c *ClusterUpConfig) ImportInitialObjects(out io.Writer) error {
952961 componentsToInstall = append (componentsToInstall ,
953962 c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftInfraNamespace , internalCurrentTemplateLocations )... )
954963
955- return componentinstall . InstallComponents ( componentsToInstall , c . GetDockerClient (), path . Join ( c . BaseTempDir , "logs" ))
964+ return componentsToInstall
956965}
957966
958967// InstallLogging will start the installation of logging components
0 commit comments