@@ -17,7 +17,6 @@ import (
17
17
cliconfig "github.com/docker/docker/cli/config"
18
18
dockerclient "github.com/docker/docker/client"
19
19
"github.com/golang/glog"
20
- "github.com/openshift/origin/pkg/oc/bootstrap/clusterup/tmpformac"
21
20
"github.com/spf13/cobra"
22
21
"github.com/spf13/pflag"
23
22
"golang.org/x/net/context"
@@ -37,6 +36,8 @@ import (
37
36
"github.com/openshift/origin/pkg/cmd/util/variable"
38
37
"github.com/openshift/origin/pkg/oc/bootstrap"
39
38
"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"
40
41
"github.com/openshift/origin/pkg/oc/bootstrap/docker/dockerhelper"
41
42
"github.com/openshift/origin/pkg/oc/bootstrap/docker/dockermachine"
42
43
"github.com/openshift/origin/pkg/oc/bootstrap/docker/errors"
@@ -481,12 +482,35 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
481
482
}
482
483
taskPrinter .Success ()
483
484
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
488
513
}
489
- taskPrinter .Success ()
490
514
491
515
// Install a router
492
516
taskPrinter .StartTask ("Installing router" )
@@ -504,13 +528,6 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
504
528
taskPrinter .Success ()
505
529
}
506
530
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
-
514
531
// Install logging
515
532
if c .ShouldInstallLogging {
516
533
taskPrinter .StartTask ("Installing logging" )
@@ -882,19 +899,6 @@ func (c *ClusterUpConfig) imageFormat() string {
882
899
return fmt .Sprintf ("%s-${component}:%s" , c .Image , c .ImageVersion )
883
900
}
884
901
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
-
898
902
// InstallRouter installs a default router on the server
899
903
func (c * ClusterUpConfig ) InstallRouter (out io.Writer ) error {
900
904
_ , kubeClient , err := c .Clients ()
@@ -935,7 +939,8 @@ func (c *ClusterUpConfig) InstallWebConsole(out io.Writer) error {
935
939
return c .OpenShiftHelper ().InstallWebConsole (f , c .imageFormat (), c .ServerLogLevel , publicURL , masterURL , loggingURL , metricsURL )
936
940
}
937
941
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 {
939
944
componentsToInstall := []componentinstall.Component {}
940
945
componentsToInstall = append (componentsToInstall ,
941
946
c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftNamespace , map [string ]string {
@@ -950,7 +955,7 @@ func (c *ClusterUpConfig) ImportInitialObjects(out io.Writer) error {
950
955
componentsToInstall = append (componentsToInstall ,
951
956
c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftInfraNamespace , internalCurrentTemplateLocations )... )
952
957
953
- return componentinstall . InstallComponents ( componentsToInstall , c . GetDockerClient (), path . Join ( c . BaseTempDir , "logs" ))
958
+ return componentsToInstall
954
959
}
955
960
956
961
// InstallLogging will start the installation of logging components
0 commit comments