Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import (
"fmt"
"os"
"testing"
"time"

"k8s.io/klog/v2"
"sigs.k8s.io/e2e-framework/klient/wait"
"sigs.k8s.io/e2e-framework/pkg/env"
"sigs.k8s.io/e2e-framework/pkg/envconf"

Expand All @@ -32,18 +30,12 @@ func TestMain(m *testing.M) {
{
Name: "kind",
Image: "ghcr.io/openmcp-project/images/cluster-provider-kind:v0.0.15",
Opts: []wait.Option{
wait.WithTimeout(time.Minute),
},
},
},
ServiceProviders: []providers.ServiceProviderSetup{
{
Name: "crossplane",
Image: "ghcr.io/openmcp-project/images/service-provider-crossplane:v0.1.4",
Opts: []wait.Option{
wait.WithTimeout(time.Minute),
},
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/providers/clusterprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ spec:

// ClusterProviderSetup represents the configuration parameters to set up a cluster provider
type ClusterProviderSetup struct {
Name string
Image string
Opts []wait.Option
Name string
Image string
WaitOpts []wait.Option
}

func mcpRef(ref types.NamespacedName) *unstructured.Unstructured {
Expand Down Expand Up @@ -93,7 +93,7 @@ func InstallClusterProvider(ctx context.Context, c *envconf.Config, clusterProvi
if err != nil {
return err
}
return wait.For(conditions.Match(obj, c, "Ready", corev1.ConditionTrue), clusterProvider.Opts...)
return wait.For(conditions.Match(obj, c, "Ready", corev1.ConditionTrue), clusterProvider.WaitOpts...)
}

// DeleteClusterProvider deletes the cluster provider object and waits until the object has been deleted
Expand Down
8 changes: 4 additions & 4 deletions pkg/providers/serviceprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ spec:

// ServiceProviderSetup represents the configuration parameters to set up a service provider
type ServiceProviderSetup struct {
Name string
Image string
Opts []wait.Option
Name string
Image string
WaitOpts []wait.Option
}

func serviceProviderRef(name string) *unstructured.Unstructured {
Expand All @@ -51,7 +51,7 @@ func InstallServiceProvider(ctx context.Context, c *envconf.Config, sp ServicePr
if err != nil {
return err
}
return wait.For(conditions.Match(obj, c, "Ready", corev1.ConditionTrue), sp.Opts...)
return wait.For(conditions.Match(obj, c, "Ready", corev1.ConditionTrue), sp.WaitOpts...)
}

// ImportServiceProviderAPIs iterates over each resource from the passed in directory
Expand Down
14 changes: 7 additions & 7 deletions pkg/setup/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package setup

import (
"context"
"time"

apimachinerytypes "k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
Expand All @@ -23,6 +22,7 @@ type OpenMCPSetup struct {
Operator OpenMCPOperatorSetup
ClusterProviders []providers.ClusterProviderSetup
ServiceProviders []providers.ServiceProviderSetup
WaitOpts []wait.Option
}

type OpenMCPOperatorSetup struct {
Expand All @@ -31,6 +31,7 @@ type OpenMCPOperatorSetup struct {
Image string
Environment string
PlatformName string
WaitOpts []wait.Option
}

// Bootstrap sets up a the minimum set of components of an openMCP installation
Expand All @@ -57,16 +58,16 @@ func (s *OpenMCPSetup) cleanup() types.EnvFunc {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
klog.Info("cleaning up environment...")
for _, sp := range s.ServiceProviders {
if err := providers.DeleteServiceProvider(ctx, c, sp.Name, wait.WithTimeout(time.Minute)); err != nil {
if err := providers.DeleteServiceProvider(ctx, c, sp.Name, sp.WaitOpts...); err != nil {
klog.Errorf("delete service provider failed: %v", err)
}
}
if err := providers.DeleteCluster(ctx, c, apimachinerytypes.NamespacedName{Namespace: s.Namespace, Name: "onboarding"},
wait.WithTimeout(time.Second*20)); err != nil {
s.WaitOpts...); err != nil {
klog.Errorf("delete cluster failed: %v", err)
}
for _, cp := range s.ClusterProviders {
if err := providers.DeleteClusterProvider(ctx, c, cp.Name, wait.WithTimeout(time.Minute)); err != nil {
if err := providers.DeleteClusterProvider(ctx, c, cp.Name, cp.WaitOpts...); err != nil {
klog.Errorf("delete cluster provider failed: %v", err)
}
}
Expand All @@ -77,7 +78,7 @@ func (s *OpenMCPSetup) cleanup() types.EnvFunc {
func (s *OpenMCPSetup) verifyEnvironment() types.EnvFunc {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
klog.Info("verify environment...")
return ctx, providers.ClustersReady(ctx, c, wait.WithTimeout(time.Minute))
return ctx, providers.ClustersReady(ctx, c, s.WaitOpts...)
}
}

Expand All @@ -89,8 +90,7 @@ func (s *OpenMCPSetup) installOpenMCPOperator() types.EnvFunc {
}
// wait for deployment to be ready
if err := wait.For(conditions.New(c.Client().Resources()).
DeploymentAvailable(s.Operator.Name, s.Operator.Namespace),
wait.WithTimeout(time.Minute)); err != nil {
DeploymentAvailable(s.Operator.Name, s.Operator.Namespace), s.Operator.WaitOpts...); err != nil {
return ctx, err
}
klog.Info("openmcp operator ready")
Expand Down