@@ -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,39 @@ 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
+ kubeconfigLoader , err := kclientcmd .NewClientConfigFromBytes (clusterAdminKubeConfigBytes )
490
+ if err != nil {
491
+ return err
492
+ }
493
+ clusterAdminKubeConfig , err := kubeconfigLoader .ClientConfig ()
494
+ if err != nil {
495
+ return err
496
+ }
497
+
498
+ // TODO, now we build up a set of things to install here. We build the list so that we can install everything in
499
+ // TODO parallel to avoid anyone accidentally introducing dependencies. We'll start with migrating what we have
500
+ // TODO and then we'll try to clean it up.
501
+ registryInstall := & registry.RegistryComponentOptions {
502
+ ClusterAdminKubeConfig : clusterAdminKubeConfig ,
503
+
504
+ OCImage : c .openshiftImage (),
505
+ MasterConfigDir : path .Join (c .LocalConfigDir , "master" ),
506
+ Images : c .imageFormat (),
507
+ PVDir : c .HostPersistentVolumesDir ,
508
+ }
509
+
510
+ componentsToInstall := []componentinstall.Component {}
511
+ componentsToInstall = append (componentsToInstall , c .ImportInitialObjectsComponents (c .Out )... )
512
+ componentsToInstall = append (componentsToInstall , registryInstall )
513
+
514
+ err = componentinstall .InstallComponents (componentsToInstall , c .GetDockerClient (), path .Join (c .BaseTempDir , "logs" ))
515
+ if err != nil {
516
+ return err
488
517
}
489
- taskPrinter .Success ()
490
518
491
519
// Install a router
492
520
taskPrinter .StartTask ("Installing router" )
@@ -504,13 +532,6 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
504
532
taskPrinter .Success ()
505
533
}
506
534
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
535
// Install logging
515
536
if c .ShouldInstallLogging {
516
537
taskPrinter .StartTask ("Installing logging" )
@@ -882,19 +903,6 @@ func (c *ClusterUpConfig) imageFormat() string {
882
903
return fmt .Sprintf ("%s-${component}:%s" , c .Image , c .ImageVersion )
883
904
}
884
905
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
906
// InstallRouter installs a default router on the server
899
907
func (c * ClusterUpConfig ) InstallRouter (out io.Writer ) error {
900
908
_ , kubeClient , err := c .Clients ()
@@ -935,7 +943,8 @@ func (c *ClusterUpConfig) InstallWebConsole(out io.Writer) error {
935
943
return c .OpenShiftHelper ().InstallWebConsole (f , c .imageFormat (), c .ServerLogLevel , publicURL , masterURL , loggingURL , metricsURL )
936
944
}
937
945
938
- func (c * ClusterUpConfig ) ImportInitialObjects (out io.Writer ) error {
946
+ // TODO this should become a separate thing we can install, like registry
947
+ func (c * ClusterUpConfig ) ImportInitialObjectsComponents (out io.Writer ) []componentinstall.Component {
939
948
componentsToInstall := []componentinstall.Component {}
940
949
componentsToInstall = append (componentsToInstall ,
941
950
c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftNamespace , map [string ]string {
@@ -950,7 +959,7 @@ func (c *ClusterUpConfig) ImportInitialObjects(out io.Writer) error {
950
959
componentsToInstall = append (componentsToInstall ,
951
960
c .makeObjectImportInstallationComponentsOrDie (out , openshift .OpenshiftInfraNamespace , internalCurrentTemplateLocations )... )
952
961
953
- return componentinstall . InstallComponents ( componentsToInstall , c . GetDockerClient (), path . Join ( c . BaseTempDir , "logs" ))
962
+ return componentsToInstall
954
963
}
955
964
956
965
// InstallLogging will start the installation of logging components
0 commit comments