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
11 changes: 11 additions & 0 deletions test/e2e/addon_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ func WaitForAddonsToBeReadyInWorkloadCluster(
},
)

WaitForCOSIControllerToBeReadyInWorkloadCluster(
ctx,
WaitForCOSIControllerToBeReadyInWorkloadClusterInput{
COSI: input.AddonsConfig.COSI,
WorkloadCluster: input.WorkloadCluster,
ClusterProxy: input.ClusterProxy,
DeploymentIntervals: input.DeploymentIntervals,
HelmReleaseIntervals: input.HelmReleaseIntervals,
},
)

WaitForServiceLoadBalancerToBeReadyInWorkloadCluster(
ctx,
WaitForServiceLoadBalancerToBeReadyInWorkloadClusterInput{
Expand Down
74 changes: 74 additions & 0 deletions test/e2e/cosi_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//go:build e2e

// Copyright 2025 Nutanix. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package e2e

import (
"context"
"fmt"

. "github.com/onsi/ginkgo/v2"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"

"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
apivariables "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/variables"
)

type WaitForCOSIControllerToBeReadyInWorkloadClusterInput struct {
COSI *apivariables.COSI
WorkloadCluster *clusterv1.Cluster
ClusterProxy framework.ClusterProxy
DeploymentIntervals []interface{}
HelmReleaseIntervals []interface{}
}

func WaitForCOSIControllerToBeReadyInWorkloadCluster(
ctx context.Context,
input WaitForCOSIControllerToBeReadyInWorkloadClusterInput, //nolint:gocritic // This hugeParam is OK in tests.
) {
if input.COSI == nil {
return
}

switch ptr.Deref(input.COSI.Strategy, "") {
case v1alpha1.AddonStrategyHelmAddon:
WaitForHelmReleaseProxyReadyForCluster(
ctx,
WaitForHelmReleaseProxyReadyForClusterInput{
GetLister: input.ClusterProxy.GetClient(),
Cluster: input.WorkloadCluster,
HelmReleaseName: "cosi-controller",
},
input.HelmReleaseIntervals...,
)
case "":
Fail("COSI strategy is not set")
default:
Fail(
fmt.Sprintf(
"Do not know how to wait for COSI using strategy %s to be ready",
*input.COSI.Strategy,
),
)
}

workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
).GetClient()

WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: workloadClusterClient,
Deployment: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "container-object-storage-controller",
Namespace: "container-object-storage-system",
},
},
}, input.DeploymentIntervals...)
}
Loading