Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): Use upstream CRS helpers #680

Merged
merged 1 commit into from
May 21, 2024
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
24 changes: 18 additions & 6 deletions test/e2e/clusterautoscaler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"

"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
Expand Down Expand Up @@ -53,14 +55,24 @@ func WaitForClusterAutoscalerToBeReadyInWorkloadCluster(

switch input.ClusterAutoscaler.Strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
waitForClusterResourceSetToApplyResourcesInCluster(
crs := &addonsv1.ClusterResourceSet{}
Expect(input.ClusterProxy.GetClient().Get(
ctx,
waitForClusterResourceSetToApplyResourcesInClusterInput{
name: clusterAutoscalerPrefix + input.WorkloadCluster.Name,
clusterProxy: input.ClusterProxy,
cluster: input.WorkloadCluster,
intervals: input.ClusterResourceSetIntervals,
types.NamespacedName{
Name: clusterAutoscalerPrefix + input.WorkloadCluster.Name,
Namespace: input.WorkloadCluster.Namespace,
},
crs,
)).To(Succeed())

framework.WaitForClusterResourceSetToApplyResources(
ctx,
framework.WaitForClusterResourceSetToApplyResourcesInput{
ClusterResourceSet: crs,
ClusterProxy: input.ClusterProxy,
Cluster: input.WorkloadCluster,
},
input.ClusterResourceSetIntervals...,
)
case v1alpha1.AddonStrategyHelmAddon:
WaitForHelmReleaseProxyReadyForCluster(
Expand Down
137 changes: 0 additions & 137 deletions test/e2e/clusterresourceset_helpers.go

This file was deleted.

47 changes: 35 additions & 12 deletions test/e2e/cni_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"

"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
Expand Down Expand Up @@ -89,14 +92,24 @@ func waitForCalicoToBeReadyInWorkloadCluster(
) {
switch input.strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
waitForClusterResourceSetToApplyResourcesInCluster(
crs := &addonsv1.ClusterResourceSet{}
Expect(input.clusterProxy.GetClient().Get(
ctx,
waitForClusterResourceSetToApplyResourcesInClusterInput{
name: "calico-cni-installation-" + input.workloadCluster.Name,
clusterProxy: input.clusterProxy,
cluster: input.workloadCluster,
intervals: input.clusterResourceSetIntervals,
types.NamespacedName{
Name: "calico-cni-installation-" + input.workloadCluster.Name,
Namespace: input.workloadCluster.Namespace,
},
crs,
)).To(Succeed())

framework.WaitForClusterResourceSetToApplyResources(
ctx,
framework.WaitForClusterResourceSetToApplyResourcesInput{
ClusterResourceSet: crs,
ClusterProxy: input.clusterProxy,
Cluster: input.workloadCluster,
},
input.clusterResourceSetIntervals...,
)
case v1alpha1.AddonStrategyHelmAddon:
WaitForHelmReleaseProxyReadyForCluster(
Expand Down Expand Up @@ -193,14 +206,24 @@ func waitForCiliumToBeReadyInWorkloadCluster(
) {
switch input.strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
waitForClusterResourceSetToApplyResourcesInCluster(
crs := &addonsv1.ClusterResourceSet{}
Expect(input.clusterProxy.GetClient().Get(
ctx,
waitForClusterResourceSetToApplyResourcesInClusterInput{
name: "cilium-cni-installation-" + input.workloadCluster.Name,
clusterProxy: input.clusterProxy,
cluster: input.workloadCluster,
intervals: input.clusterResourceSetIntervals,
types.NamespacedName{
Name: "cilium-cni-installation-" + input.workloadCluster.Name,
Namespace: input.workloadCluster.Namespace,
},
crs,
)).To(Succeed())

framework.WaitForClusterResourceSetToApplyResources(
ctx,
framework.WaitForClusterResourceSetToApplyResourcesInput{
ClusterResourceSet: crs,
ClusterProxy: input.clusterProxy,
Cluster: input.workloadCluster,
},
input.clusterResourceSetIntervals...,
)
case v1alpha1.AddonStrategyHelmAddon:
WaitForHelmReleaseProxyReadyForCluster(
Expand Down
25 changes: 19 additions & 6 deletions test/e2e/nfd_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"

"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
Expand All @@ -38,14 +41,24 @@ func WaitForNFDToBeReadyInWorkloadCluster(

switch input.NFD.Strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
waitForClusterResourceSetToApplyResourcesInCluster(
crs := &addonsv1.ClusterResourceSet{}
Expect(input.ClusterProxy.GetClient().Get(
ctx,
waitForClusterResourceSetToApplyResourcesInClusterInput{
name: "node-feature-discovery-" + input.WorkloadCluster.Name,
clusterProxy: input.ClusterProxy,
cluster: input.WorkloadCluster,
intervals: input.ClusterResourceSetIntervals,
types.NamespacedName{
Name: "node-feature-discovery-" + input.WorkloadCluster.Name,
Namespace: input.WorkloadCluster.Namespace,
},
crs,
)).To(Succeed())

framework.WaitForClusterResourceSetToApplyResources(
ctx,
framework.WaitForClusterResourceSetToApplyResourcesInput{
ClusterResourceSet: crs,
ClusterProxy: input.ClusterProxy,
Cluster: input.WorkloadCluster,
},
input.ClusterResourceSetIntervals...,
)
case v1alpha1.AddonStrategyHelmAddon:
WaitForHelmReleaseProxyReadyForCluster(
Expand Down
Loading