@@ -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"
@@ -484,12 +485,35 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
484
485
}
485
486
taskPrinter .Success ()
486
487
487
- // Install a registry
488
- taskPrinter .StartTask ("Installing registry" )
489
- if err := c .InstallRegistry (out ); err != nil {
490
- return taskPrinter .ToError (err )
488
+ clusterAdminKubeConfigBytes , err := ioutil .ReadFile (path .Join (c .LocalConfigDir , "master" , "admin.kubeconfig" ))
489
+ if err != nil {
490
+ return err
491
+ }
492
+ clusterAdminKubeConfig , err := kclientcmd .RESTConfigFromKubeConfig (clusterAdminKubeConfigBytes )
493
+ if err != nil {
494
+ return err
495
+ }
496
+
497
+ // TODO, now we build up a set of things to install here. We build the list so that we can install everything in
498
+ // TODO parallel to avoid anyone accidentally introducing dependencies. We'll start with migrating what we have
499
+ // TODO and then we'll try to clean it up.
500
+ registryInstall := & registry.RegistryComponentOptions {
501
+ ClusterAdminKubeConfig : clusterAdminKubeConfig ,
502
+
503
+ OCImage : c .openshiftImage (),
504
+ MasterConfigDir : path .Join (c .LocalConfigDir , "master" ),
505
+ Images : c .imageFormat (),
506
+ PVDir : c .HostPersistentVolumesDir ,
507
+ }
508
+
509
+ componentsToInstall := []componentinstall.Component {}
510
+ componentsToInstall = append (componentsToInstall , c .ImportInitialObjectsComponents (c .Out )... )
511
+ componentsToInstall = append (componentsToInstall , registryInstall )
512
+
513
+ err = componentinstall .InstallComponents (componentsToInstall , c .GetDockerClient (), path .Join (c .BaseTempDir , "logs" ))
514
+ if err != nil {
515
+ return err
491
516
}
492
- taskPrinter .Success ()
493
517
494
518
// Install a router
495
519
taskPrinter .StartTask ("Installing router" )
@@ -507,13 +531,6 @@ func (c *ClusterUpConfig) Start(out io.Writer) error {
507
531
taskPrinter .Success ()
508
532
}
509
533
510
- // Import default image streams
511
- taskPrinter .StartTask ("Importing default data router" )
512
- if err := c .ImportInitialObjects (out ); err != nil {
513
- return taskPrinter .ToError (err )
514
- }
515
- taskPrinter .Success ()
516
-
517
534
// Install logging
518
535
if c .ShouldInstallLogging {
519
536
taskPrinter .StartTask ("Installing logging" )
@@ -835,7 +852,7 @@ func (c *ClusterUpConfig) determineServerIP(out io.Writer) (string, []string, er
835
852
836
853
// updateNoProxy will add some default values to the NO_PROXY setting if they are not present
837
854
func (c * ClusterUpConfig ) updateNoProxy () {
838
- values := []string {"127.0.0.1" , c .ServerIP , "localhost" , openshift .ServiceCatalogServiceIP , openshift .RegistryServiceClusterIP }
855
+ values := []string {"127.0.0.1" , c .ServerIP , "localhost" , openshift .ServiceCatalogServiceIP , registry .RegistryServiceClusterIP }
839
856
ipFromServer , err := c .OpenShiftHelper ().ServerIP ()
840
857
if err == nil {
841
858
values = append (values , ipFromServer )
@@ -885,19 +902,6 @@ func (c *ClusterUpConfig) imageFormat() string {
885
902
return fmt .Sprintf ("%s-${component}:%s" , c .Image , c .ImageVersion )
886
903
}
887
904
888
- // InstallRegistry installs the OpenShift registry on the server
889
- func (c * ClusterUpConfig ) InstallRegistry (out io.Writer ) error {
890
- _ , kubeClient , err := c .Clients ()
891
- if err != nil {
892
- return err
893
- }
894
- f , err := c .Factory ()
895
- if err != nil {
896
- return err
897
- }
898
- return c .OpenShiftHelper ().InstallRegistry (c .GetDockerClient (), c .openshiftImage (), kubeClient , f , c .LocalConfigDir , path .Join (c .BaseTempDir , "logs" ), c .imageFormat (), c .HostPersistentVolumesDir , out , os .Stderr )
899
- }
900
-
901
905
// InstallRouter installs a default router on the server
902
906
func (c * ClusterUpConfig ) InstallRouter (out io.Writer ) error {
903
907
_ , kubeClient , err := c .Clients ()
@@ -938,7 +942,8 @@ func (c *ClusterUpConfig) InstallWebConsole(out io.Writer) error {
938
942
return c .OpenShiftHelper ().InstallWebConsole (f , c .imageFormat (), c .ServerLogLevel , publicURL , masterURL , loggingURL , metricsURL )
939
943
}
940
944
941
- func (c * ClusterUpConfig ) ImportInitialObjects (out io.Writer ) error {
945
+ // TODO this should become a separate thing we can install, like registry
946
+ func (c * ClusterUpConfig ) ImportInitialObjectsComponents (out io.Writer ) []componentinstall.Component {
942
947
componentsToInstall := []componentinstall.Component {}
943
948
componentsToInstall = append (componentsToInstall ,
944
949
c .makeObjectImportInstallationComponentsOrDie (out , openshift .Namespace , map [string ]string {
@@ -953,7 +958,7 @@ func (c *ClusterUpConfig) ImportInitialObjects(out io.Writer) error {
953
958
componentsToInstall = append (componentsToInstall ,
954
959
c .makeObjectImportInstallationComponentsOrDie (out , openshift .InfraNamespace , internalCurrentTemplateLocations )... )
955
960
956
- return componentinstall . InstallComponents ( componentsToInstall , c . GetDockerClient (), path . Join ( c . BaseTempDir , "logs" ))
961
+ return componentsToInstall
957
962
}
958
963
959
964
// InstallLogging will start the installation of logging components
@@ -1120,9 +1125,9 @@ func (c *ClusterUpConfig) checkProxySettings() string {
1120
1125
if len (dockerHTTPProxy ) > 0 || len (dockerHTTPSProxy ) > 0 {
1121
1126
dockerNoProxyList := strings .Split (dockerNoProxy , "," )
1122
1127
dockerNoProxySet := sets .NewString (dockerNoProxyList ... )
1123
- if ! dockerNoProxySet .Has (openshift .RegistryServiceClusterIP ) {
1128
+ if ! dockerNoProxySet .Has (registry .RegistryServiceClusterIP ) {
1124
1129
warnings = append (warnings , fmt .Sprintf ("A proxy is configured for Docker, however %[1]s is not included in its NO_PROXY list.\n " +
1125
- " %[1]s needs to be included in the Docker daemon's NO_PROXY environment variable so pushes to the local OpenShift registry can succeed." , openshift .RegistryServiceClusterIP ))
1130
+ " %[1]s needs to be included in the Docker daemon's NO_PROXY environment variable so pushes to the local OpenShift registry can succeed." , registry .RegistryServiceClusterIP ))
1126
1131
}
1127
1132
}
1128
1133
@@ -1361,7 +1366,7 @@ func (c *ClusterUpConfig) ShouldInitializeData() bool {
1361
1366
return true
1362
1367
}
1363
1368
1364
- if _ , err = kclient .Core ().Services (openshift .DefaultNamespace ).Get (openshift . RegistryServiceName , metav1.GetOptions {}); err != nil {
1369
+ if _ , err = kclient .Core ().Services (openshift .DefaultNamespace ).Get (registry . SvcDockerRegistry , metav1.GetOptions {}); err != nil {
1365
1370
return true
1366
1371
}
1367
1372
0 commit comments