@@ -36,11 +36,12 @@ type OpenMCPOperatorSetup struct {
3636
3737// Bootstrap sets up a the minimum set of components of an openMCP installation
3838func (s * OpenMCPSetup ) Bootstrap (testenv env.Environment ) error {
39- platformClusterName := envconf .RandomName ("platform-cluster " , 16 )
39+ platformClusterName := envconf .RandomName ("platform-" , 16 )
4040 s .Operator .Namespace = s .Namespace
4141 testenv .Setup (createPlatformCluster (platformClusterName )).
4242 Setup (envfuncs .CreateNamespace (s .Namespace )).
4343 Setup (s .installOpenMCPOperator ()).
44+ Setup (s .loadServiceProviderImages (platformClusterName )).
4445 Setup (s .installClusterProviders ()).
4546 Setup (s .installServiceProviders ()).
4647 Setup (s .verifyEnvironment ()).
@@ -109,7 +110,6 @@ func (s *OpenMCPSetup) installClusterProviders() env.Func {
109110 }
110111}
111112
112- // InstallServiceProvider creates a service provider object on the platform cluster and waits until it is ready
113113func (s * OpenMCPSetup ) installServiceProviders () env.Func {
114114 return func (ctx context.Context , c * envconf.Config ) (context.Context , error ) {
115115 for _ , sp := range s .ServiceProviders {
@@ -120,3 +120,24 @@ func (s *OpenMCPSetup) installServiceProviders() env.Func {
120120 return ctx , nil
121121 }
122122}
123+
124+ func (s * OpenMCPSetup ) loadServiceProviderImages (platformCluster string ) env.Func {
125+ funcs := []env.Func {}
126+ for _ , sp := range s .ServiceProviders {
127+ funcs = append (funcs , envfuncs .LoadDockerImageToCluster (platformCluster , sp .Image ))
128+ }
129+ return Compose (funcs ... )
130+ }
131+
132+ // Compose executes multiple env.Funcs in a row
133+ func Compose (envfuncs ... env.Func ) env.Func {
134+ return func (ctx context.Context , cfg * envconf.Config ) (context.Context , error ) {
135+ for _ , envfunc := range envfuncs {
136+ var err error
137+ if ctx , err = envfunc (ctx , cfg ); err != nil {
138+ return ctx , err
139+ }
140+ }
141+ return ctx , nil
142+ }
143+ }
0 commit comments