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: 4 additions & 4 deletions test/e2e/air_gapped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
configMaps := []corev1.ConfigMap{}

for _, fileName := range []string{"core-cluster-api-v1.4.2.yaml", "core-cluster-api-v1.4.3.yaml"} {
for _, fileName := range []string{"core-cluster-api-v1.5.4.yaml", "core-cluster-api-v1.6.0.yaml"} {
coreProviderComponents, err := os.ReadFile(customManifestsFolder + fileName)
Expect(err).ToNot(HaveOccurred(), "Failed to read the core provider manifests file")

Expand Down Expand Up @@ -77,7 +77,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
},
},
},
Version: "v1.4.2",
Version: "v1.5.4",
},
},
}
Expand All @@ -101,7 +101,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
})

It("should successfully upgrade a CoreProvider (v1.4.2 -> latest)", func() {
It("should successfully upgrade a CoreProvider (v1.5.4 -> latest)", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
coreProvider := &operatorv1.CoreProvider{}
key := client.ObjectKey{Namespace: operatorNamespace, Name: coreProviderName}
Expand Down Expand Up @@ -153,7 +153,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
configMaps := []corev1.ConfigMap{}

for _, fileName := range []string{"core-cluster-api-v1.4.2.yaml", "core-cluster-api-v1.4.3.yaml"} {
for _, fileName := range []string{"core-cluster-api-v1.5.4.yaml", "core-cluster-api-v1.6.0.yaml"} {
coreProviderComponents, err := os.ReadFile(customManifestsFolder + fileName)
Expect(err).ToNot(HaveOccurred(), "Failed to read the core provider manifests file")

Expand Down
34 changes: 18 additions & 16 deletions test/e2e/compressed_manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
operatorv1alpha1 "sigs.k8s.io/cluster-api-operator/api/v1alpha1"
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
"sigs.k8s.io/cluster-api/test/framework"

"k8s.io/utils/ptr"
Expand All @@ -49,10 +49,12 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

It("should successfully create a CoreProvider", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
coreProvider := &operatorv1alpha1.CoreProvider{ObjectMeta: metav1.ObjectMeta{
Name: coreProviderName,
Namespace: operatorNamespace,
}}
coreProvider := &operatorv1.CoreProvider{
ObjectMeta: metav1.ObjectMeta{
Name: coreProviderName,
Namespace: operatorNamespace,
},
}
Expect(bootstrapCluster.Create(ctx, coreProvider)).To(Succeed())

By("Waiting for the core provider deployment to be ready")
Expand All @@ -63,7 +65,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

By("Waiting for core provider to be ready")
WaitFor(ctx, For(coreProvider).In(bootstrapCluster).ToSatisfy(
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1alpha1.ProviderInstalledCondition),
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for status.IntalledVersion to be set")
Expand All @@ -74,13 +76,13 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

It("should successfully create and delete an InfrastructureProvider for OCI", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
infraProvider := &operatorv1alpha1.InfrastructureProvider{
infraProvider := &operatorv1.InfrastructureProvider{
ObjectMeta: metav1.ObjectMeta{
Name: ociInfrastructureProviderName,
Namespace: operatorNamespace,
},
Spec: operatorv1alpha1.InfrastructureProviderSpec{
ProviderSpec: operatorv1alpha1.ProviderSpec{
Spec: operatorv1.InfrastructureProviderSpec{
ProviderSpec: operatorv1.ProviderSpec{
Version: ociInfrastructureProviderVersion,
},
},
Expand All @@ -90,7 +92,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

By("Waiting for the infrastructure provider to be ready")
WaitFor(ctx, For(infraProvider).In(bootstrapCluster).ToSatisfy(
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1alpha1.ProviderInstalledCondition),
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for status.IntalledVersion to be set")
Expand Down Expand Up @@ -134,14 +136,14 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

It("should successfully create and delete an InfrastructureProvider for OCI with custom name from a pre-created ConfigMap", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
infraProvider := &operatorv1alpha1.InfrastructureProvider{
infraProvider := &operatorv1.InfrastructureProvider{
ObjectMeta: metav1.ObjectMeta{
Name: ociInfrastructureProviderCustomName,
Namespace: operatorNamespace,
},
Spec: operatorv1alpha1.InfrastructureProviderSpec{
ProviderSpec: operatorv1alpha1.ProviderSpec{
FetchConfig: &operatorv1alpha1.FetchConfiguration{
Spec: operatorv1.InfrastructureProviderSpec{
ProviderSpec: operatorv1.ProviderSpec{
FetchConfig: &operatorv1.FetchConfiguration{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"provider.cluster.x-k8s.io/name": "oci",
Expand All @@ -163,7 +165,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

By("Waiting for the infrastructure provider to be ready")
WaitFor(ctx, For(infraProvider).In(bootstrapCluster).ToSatisfy(
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1alpha1.ProviderInstalledCondition)),
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1.ProviderInstalledCondition)),
e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for status.IntalledVersion to be set")
Expand Down Expand Up @@ -199,7 +201,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the

It("should successfully delete a CoreProvider", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
coreProvider := &operatorv1alpha1.CoreProvider{ObjectMeta: metav1.ObjectMeta{
coreProvider := &operatorv1.CoreProvider{ObjectMeta: metav1.ObjectMeta{
Name: coreProviderName,
Namespace: operatorNamespace,
}}
Expand Down
43 changes: 42 additions & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"k8s.io/klog/v2"
operatorv1alpha1 "sigs.k8s.io/cluster-api-operator/api/v1alpha1"
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

. "sigs.k8s.io/cluster-api-operator/test/framework"
"sigs.k8s.io/cluster-api/test/framework"
Expand Down Expand Up @@ -294,7 +295,7 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *

func initHelmCluster(clusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig) {
Expect(clusterProxy).ToNot(BeNil(), "Invalid argument. bootstrapClusterProxy can't be nil when calling initHelmCluster")
logFolder := filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName())
logFolder := filepath.Join(artifactFolder, "clusters", helmClusterProxy.GetName())
Expect(os.MkdirAll(logFolder, 0750)).To(Succeed(), "Invalid argument. Log folder can't be created for initHelmCluster")
ensureCertManager(clusterProxy, config)
}
Expand Down Expand Up @@ -374,6 +375,9 @@ var _ = SynchronizedAfterSuite(func() {
}, func() {
// After all ParallelNodes.

dumpClusterLogs(bootstrapClusterProxy)
dumpClusterLogs(helmClusterProxy)

By("Tearing down the management clusters")
if !skipCleanup {
tearDown(bootstrapClusterProvider, bootstrapClusterProxy)
Expand All @@ -389,3 +393,40 @@ func tearDown(clusterProvider bootstrap.ClusterProvider, clusterProxy framework.
clusterProvider.Dispose(ctx)
}
}

func dumpClusterLogs(clusterProxy framework.ClusterProxy) {
if clusterProxy == nil {
return
}

clusterLogCollector := clusterProxy.GetLogCollector()
if clusterLogCollector == nil {
return
}

nodes, err := clusterProxy.GetClientSet().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
if err != nil {
fmt.Printf("Failed to get nodes for the bootstrap cluster: %v\n", err)
return
}

for i := range nodes.Items {
nodeName := nodes.Items[i].GetName()
err = clusterLogCollector.CollectMachineLog(
ctx,
clusterProxy.GetClient(),
// The bootstrap cluster is not expected to be a CAPI cluster, so in order to re-use the logCollector,
// we create a fake machine that wraps the node.
// NOTE: This assumes a naming convention between machines and nodes, which e.g. applies to the bootstrap clusters generated with kind.
// This might not work if you are using an existing bootstrap cluster provided by other means.
&clusterv1.Machine{
Spec: clusterv1.MachineSpec{ClusterName: nodeName},
ObjectMeta: metav1.ObjectMeta{Name: nodeName},
},
filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName(), "machines", nodeName),
)
if err != nil {
fmt.Printf("Failed to get logs for the bootstrap cluster node %s: %v\n", nodeName, err)
}
}
}
22 changes: 11 additions & 11 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"core": "capi-custom-ns:cluster-api:v1.4.2",
"controlPlane": "kubeadm-control-plane-custom-ns:kubeadm:v1.4.2",
"bootstrap": "kubeadm-bootstrap-custom-ns:kubeadm:v1.4.2",
"infrastructure": "capd-custom-ns:docker:v1.4.2",
"core": "capi-custom-ns:cluster-api:v1.5.4",
"controlPlane": "kubeadm-control-plane-custom-ns:kubeadm:v1.5.4",
"bootstrap": "kubeadm-bootstrap-custom-ns:kubeadm:v1.5.4",
"infrastructure": "capd-custom-ns:docker:v1.5.4",
"addon": "helm-custom-ns:helm:v0.1.0-alpha.9",
})
Expect(err).ToNot(HaveOccurred())
Expand All @@ -72,10 +72,10 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"core": "cluster-api:v1.4.2",
"controlPlane": "kubeadm:v1.4.2",
"bootstrap": "kubeadm:v1.4.2",
"infrastructure": "docker:v1.4.2",
"core": "cluster-api:v1.5.4",
"controlPlane": "kubeadm:v1.5.4",
"bootstrap": "kubeadm:v1.5.4",
"infrastructure": "docker:v1.5.4",
"addon": "helm:v0.1.0-alpha.9",
})
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -145,7 +145,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"infrastructure": "capd-custom-ns:docker:v1.4.2;capz-custom-ns:azure:v1.10.0",
"infrastructure": "capd-custom-ns:docker:v1.5.4;capz-custom-ns:azure:v1.10.0",
})
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
Expand All @@ -158,7 +158,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"controlPlane": "kubeadm-control-plane-custom-ns:kubeadm:v1.4.2;rke2-control-plane-custom-ns:rke2:v0.3.0",
"controlPlane": "kubeadm-control-plane-custom-ns:kubeadm:v1.5.4;rke2-control-plane-custom-ns:rke2:v0.3.0",
})
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
Expand All @@ -171,7 +171,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"bootstrap": "kubeadm-bootstrap-custom-ns:kubeadm:v1.4.2;rke2-bootstrap-custom-ns:rke2:v0.3.0",
"bootstrap": "kubeadm-bootstrap-custom-ns:kubeadm:v1.5.4;rke2-bootstrap-custom-ns:rke2:v0.3.0",
})
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
const (
operatorNamespace = "capi-operator-system"

previousCAPIVersion = "v1.4.2"
previousCAPIVersion = "v1.5.4"

coreProviderName = "cluster-api"
coreProviderDeploymentName = "capi-controller-manager"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/minimal_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ metadata:
e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
})

It("should successfully upgrade a CoreProvider (v1.4.2 -> latest)", func() {
It("should successfully upgrade a CoreProvider (v1.5.4 -> latest)", func() {
bootstrapCluster := bootstrapClusterProxy.GetClient()
coreProvider := &operatorv1.CoreProvider{ObjectMeta: metav1.ObjectMeta{
Name: coreProviderName,
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/resources/all-providers-custom-ns-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -81,7 +81,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -96,7 +96,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -111,7 +111,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
8 changes: 4 additions & 4 deletions test/e2e/resources/all-providers-custom-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -81,7 +81,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -96,7 +96,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Expand All @@ -111,7 +111,7 @@ metadata:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.4.2
version: v1.5.4
configSecret:
name: test-secret-name
namespace: test-secret-namespace
Loading