Skip to content

Commit 24798b0

Browse files
authored
Merge pull request #1465 from vincepri/fix-e2e-cabpk-kcp
🏃 Install cabpk and kcp components in e2e tests
2 parents 09bb239 + 90d5a68 commit 24798b0

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

examples/generate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ if [[ ${CAPI_BRANCH} == "stable" ]]; then
112112
echo "Downloaded ${COMPONENTS_CLUSTER_API_GENERATED_FILE} from cluster-api stable branch - v0.2.5"
113113
elif [[ ${CAPI_BRANCH} == "dev" ]]; then
114114
kustomize build ../cluster-api/config/default > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
115+
kustomize build ../cluster-api/bootstrap/kubeadm/config/default > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
116+
kustomize build ../cluster-api/controlplane/kubeadm/config/default > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
115117
echo "Generated ${COMPONENTS_CLUSTER_API_GENERATED_FILE} from cluster-api - ${CAPI_BRANCH}"
116118
else
117119
kustomize build "github.com/kubernetes-sigs/cluster-api/config/default/?ref=${CAPI_BRANCH}" > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
120+
kustomize build "github.com/kubernetes-sigs/cluster-api/bootstrap/kubeadm/config/default/?ref=${CAPI_BRANCH}" > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
121+
kustomize build "github.com/kubernetes-sigs/cluster-api/controlplane/kubeadm/config/default/?ref=${CAPI_BRANCH}" > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
118122
echo "Generated ${COMPONENTS_CLUSTER_API_GENERATED_FILE} from cluster-api - ${CAPI_BRANCH}"
119123
fi
120124

test/e2e/e2e_suite_test.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ var _ = BeforeSuite(func() {
158158
// Wait for CertManager to be available before continuing
159159
common.WaitDeployment(kindClient, "cert-manager", "cert-manager-webhook")
160160

161-
// Deploy the CAPI components
161+
// Deploy the CAPI, CABPK, and KCP components from Cluster API repository,
162162
// workaround since there isn't a v1alpha3 capi release yet
163163
deployCAPIComponents(kindCluster)
164+
deployCABPKComponents(kindCluster)
165+
deployKCPComponents(kindCluster)
164166

165167
// Deploy the CAPA components
166168
deployCAPAComponents(kindCluster)
@@ -310,6 +312,46 @@ func deployCAPIComponents(kindCluster kind.Cluster) {
310312
applyManifests(kindCluster, &manifestFile)
311313
}
312314

315+
func deployCABPKComponents(kindCluster kind.Cluster) {
316+
fmt.Fprintf(GinkgoWriter, "Generating CABPK manifests\n")
317+
318+
// Build the manifests using kustomize
319+
cabpkManifests, err := exec.Command(*kustomizeBinary, "build", "https://github.com/kubernetes-sigs/cluster-api//bootstrap/kubeadm/config/default").Output()
320+
if err != nil {
321+
if exitError, ok := err.(*exec.ExitError); ok {
322+
fmt.Fprintf(GinkgoWriter, "Error: %s\n", string(exitError.Stderr))
323+
}
324+
}
325+
Expect(err).NotTo(HaveOccurred())
326+
327+
// write out the manifests
328+
manifestFile := path.Join(suiteTmpDir, "bootstrap-components.yaml")
329+
Expect(ioutil.WriteFile(manifestFile, cabpkManifests, 0644)).To(Succeed())
330+
331+
// apply generated manifests
332+
applyManifests(kindCluster, &manifestFile)
333+
}
334+
335+
func deployKCPComponents(kindCluster kind.Cluster) {
336+
fmt.Fprintf(GinkgoWriter, "Generating KCP manifests\n")
337+
338+
// Build the manifests using kustomize
339+
kcpManifests, err := exec.Command(*kustomizeBinary, "build", "https://github.com/kubernetes-sigs/cluster-api//controlplane/kubeadm/config/default").Output()
340+
if err != nil {
341+
if exitError, ok := err.(*exec.ExitError); ok {
342+
fmt.Fprintf(GinkgoWriter, "Error: %s\n", string(exitError.Stderr))
343+
}
344+
}
345+
Expect(err).NotTo(HaveOccurred())
346+
347+
// write out the manifests
348+
manifestFile := path.Join(suiteTmpDir, "control-plane-components.yaml")
349+
Expect(ioutil.WriteFile(manifestFile, kcpManifests, 0644)).To(Succeed())
350+
351+
// apply generated manifests
352+
applyManifests(kindCluster, &manifestFile)
353+
}
354+
313355
func deployCAPAComponents(kindCluster kind.Cluster) {
314356
if capaComponents != nil && *capaComponents != "" {
315357
applyManifests(kindCluster, capaComponents)

0 commit comments

Comments
 (0)