Skip to content

Commit

Permalink
Install CAPI and providers with operator in e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>
  • Loading branch information
alexander-demicev committed Sep 12, 2023
1 parent 692aefa commit 32f8885
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
49 changes: 44 additions & 5 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
}

func initRancherTurtles(clusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig) {
By("Adding docker variables secret")
Expect(clusterProxy.Apply(ctx, dockerVariablesSecret)).To(Succeed())
By("Adding CAPI variables secret")
Expect(clusterProxy.Apply(ctx, capiProvidersSecret)).To(Succeed())

By("Installing rancher-turtles chart")
chart := &HelmChart{
Expand All @@ -259,11 +259,50 @@ func initRancherTurtles(clusterProxy framework.ClusterProxy, config *clusterctl.
}
_, err := chart.Run(map[string]string{
"cluster-api-operator.cert-manager.enabled": "true",
"cluster-api-operator.infrastructure": config.GetVariable(capiInfrastructure),
"cluster-api-operator.secretName": "variables",
"cluster-api-operator.secretNamespace": "default",
"clusterAPI.configSecret.namespace": "default",
"clusterAPI.configSecret.name": "variables",
})
Expect(err).ToNot(HaveOccurred())

By("Adding CAPI infrastructure providers")
Expect(clusterProxy.Apply(ctx, capiProviders)).To(Succeed())

By("Waiting for CAPI deployment to be available")
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: bootstrapClusterProxy.GetClient(),
Deployment: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "capi-controller-manager",
Namespace: "capi-system",
}},
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for CAPI kubeadm bootstrap deployment to be available")
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: bootstrapClusterProxy.GetClient(),
Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{
Name: "capi-kubeadm-bootstrap-controller-manager",
Namespace: "capi-kubeadm-bootstrap-system",
}},
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for CAPI kubeadm control plane deployment to be available")
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: bootstrapClusterProxy.GetClient(),
Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{
Name: "capi-kubeadm-control-plane-controller-manager",
Namespace: "capi-kubeadm-control-plane-system",
}},
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

By("Waiting for CAPI docker provider deployment to be available")
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: bootstrapClusterProxy.GetClient(),
Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{
Name: "capd-controller-manager",
Namespace: "capd-system",
}},
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
}

func initRancher(clusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig) {
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ var (
//go:embed resources/testdata/fleet-capi-test.yaml
fleetCAPITestdata []byte

//go:embed resources/config/docker-infra-secret.yaml
dockerVariablesSecret []byte
//go:embed resources/config/capi-providers-secret.yaml
capiProvidersSecret []byte

//go:embed resources/config/capi-providers.yaml
capiProviders []byte

//go:embed resources/config/ingress.yaml
ingressConfig []byte
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ metadata:
type: Opaque
stringData:
CLUSTER_TOPOLOGY: "true"
EXP_CLUSTER_RESOURCE_SET: "true"
EXP_CLUSTER_RESOURCE_SET: "true"

14 changes: 14 additions & 0 deletions test/e2e/resources/config/capi-providers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: capd-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
kind: InfrastructureProvider
metadata:
name: docker
namespace: capd-system
spec:
secretName: variables
secretNamespace: default

0 comments on commit 32f8885

Please sign in to comment.