Skip to content

Commit 1f37d9b

Browse files
committed
Update documentation for syncing with CKS Cluster
1 parent aa250fb commit 1f37d9b

13 files changed

+21
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ E2E_TIMEOUT ?= 3h
293293
run-e2e: e2e-essentials ## Run e2e testing. JOB is an optional REGEXP to select certainn test cases to run. e.g. JOB=PR-Blocking, JOB=Conformance
294294
$(KUBECTL) apply -f cloud-config.yaml && \
295295
cd test/e2e && \
296-
$(GINKGO) -vv --trace --tags=e2e --focus=$(JOB) --timeout=$(E2E_TIMEOUT) --skip=Conformance --skip-package=kubeconfig_helper --nodes=1 --no-color=false ./... -- \
296+
$(GINKGO) -v --trace --tags=e2e --focus=$(JOB) --timeout=$(E2E_TIMEOUT) --skip=Conformance --skip-package=kubeconfig_helper --nodes=1 --no-color=false ./... -- \
297297
-e2e.artifacts-folder=${REPO_ROOT}/_artifacts \
298298
-e2e.config=${E2E_CONFIG} \
299299
-e2e.skip-resource-cleanup=false -e2e.use-existing-cluster=true

config/manager/manager.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
- "--metrics-bind-addr=localhost:8080"
2828
- "--cloudstackcluster-concurrency=${CAPC_CLOUDSTACKCLUSTER_CONCURRENCY:=10}"
2929
- "--cloudstackmachine-concurrency=${CAPC_CLOUDSTACKMACHINE_CONCURRENCY:=10}"
30+
- "--enable-cloudstack-cks-sync=${CAPC_CLOUDSTACKMACHINE_CKS_SYNC:=false}"
3031
image: controller:latest
3132
name: manager
3233
securityContext:

controllers/cks_cluster_controller.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,12 @@ func (reconciler *CksClusterReconciler) Reconcile(ctx context.Context, req ctrl.
7070

7171
// Reconcile actually reconciles the CloudStackCluster.
7272
func (r *CksClusterReconciliationRunner) Reconcile() (res ctrl.Result, reterr error) {
73-
if !r.CSCluster.Spec.SyncWithACS {
73+
if !r.CSCluster.Spec.SyncWithACS || len(r.FailureDomains.Items) == 0 {
7474
return ctrl.Result{}, nil
7575
}
7676
// Prevent premature deletion.
7777
controllerutil.AddFinalizer(r.ReconciliationSubject, CksClusterFinalizer)
7878

79-
if len(r.FailureDomains.Items) == 0 {
80-
return r.RequeueWithMessage("No failure domains found")
81-
}
82-
8379
res, err := r.AsFailureDomainUser(&r.FailureDomains.Items[0].Spec)()
8480
if r.ShouldReturn(res, err) {
8581
return res, err

controllers/cloudstackmachine_controller_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ var _ = Describe("CloudStackMachineReconciler", func() {
5454
// Setup a failure domain for the machine reconciler to find.
5555
Ω(k8sClient.Create(ctx, dummies.CSFailureDomain1)).Should(Succeed())
5656
setClusterReady(k8sClient)
57-
58-
mockCloudClient.EXPECT().GetOrCreateCksCluster(gomock.Any(), gomock.Any(), gomock.Any()).Do(
59-
func(arg1, _, _ interface{}) {
60-
arg1.(*infrav1.CloudStackCluster).Status.CloudStackClusterID = "cluster-id-123"
61-
}).AnyTimes().Return(nil)
6257
})
6358

6459
It("Should call GetOrCreateVMInstance and set Status.Ready to true", func() {

docs/book/src/development/common.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
3434
# The SSH KeyPair to log into the VM (Optional: you must use clusterctl --flavor *managed-ssh*)
3535
export CLOUDSTACK_SSH_KEY_NAME=CAPCKeyPair6
36+
37+
# Sync resources created by CAPC in Apache Cloudstack CKS. Default is false.
38+
# Requires setting CAPC_CLOUDSTACKMACHINE_CKS_SYNC=true before initialising the cloudstack provider.
39+
# Or set enable-cloudstack-cks-sync to true in the deployment for capc-controller.
40+
export CLOUDSTACK_SYNC_WITH_ACS=true
3641
```
3742
3843
2. Generate the CAPC cluster spec yaml file

docs/book/src/getting-started.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Run the following command to turn your cluster into a management cluster and loa
5151
5252
clusterctl init --infrastructure cloudstack
5353
54+
> If you wish to enable syncing of CAPC resources with cloudstack, set the environment variable
55+
> `CAPC_CLOUDSTACKMACHINE_CKS_SYNC=true` before initializing the cloudstack provider. Or set
56+
> `enable-cloudstack-cks-sync` to true in the deployment for capc-controller.
57+
> This is only supported for Apache CloudStack version 4.19 and above.
58+
5459
<!-- References -->
5560
5661
[capi-quick-start]: https://cluster-api.sigs.k8s.io/user/quick-start.html

pkg/cloud/cks_cluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ func (c *client) GetOrCreateCksCluster(cluster *clusterv1.Cluster, csCluster *in
102102

103103
func (c *client) DeleteCksCluster(csCluster *infrav1.CloudStackCluster) error {
104104
if csCluster.Status.CloudStackClusterID != "" {
105-
csCksCluster, count, err := c.cs.Kubernetes.GetKubernetesClusterByID(csCluster.Status.CloudStackClusterID, withExternalManaged())
105+
csCksCluster, count, err := c.cs.Kubernetes.GetKubernetesClusterByID(
106+
csCluster.Status.CloudStackClusterID, withExternalManaged(), cloudstack.WithProject(c.user.Project.ID))
106107
if err != nil && strings.Contains(err.Error(), " not found") {
107108
return nil
108109
}

templates/cluster-template-managed-ssh.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ kind: CloudStackCluster
2323
metadata:
2424
name: ${CLUSTER_NAME}
2525
spec:
26+
syncWithACS: ${CLOUDSTACK_SYNC_WITH_ACS=false}
2627
controlPlaneEndpoint:
2728
host: ${CLUSTER_ENDPOINT_IP}
2829
port: ${CLUSTER_ENDPOINT_PORT=6443}

templates/cluster-template-ssh-material.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ kind: CloudStackCluster
2323
metadata:
2424
name: ${CLUSTER_NAME}
2525
spec:
26+
syncWithACS: ${CLOUDSTACK_SYNC_WITH_ACS=false}
2627
controlPlaneEndpoint:
2728
host: ${CLUSTER_ENDPOINT_IP}
2829
port: ${CLUSTER_ENDPOINT_PORT=6443}

templates/cluster-template-with-disk-offering.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ kind: CloudStackCluster
2323
metadata:
2424
name: ${CLUSTER_NAME}
2525
spec:
26+
syncWithACS: ${CLOUDSTACK_SYNC_WITH_ACS=false}
2627
controlPlaneEndpoint:
2728
host: ${CLUSTER_ENDPOINT_IP}
2829
port: ${CLUSTER_ENDPOINT_PORT=6443}

0 commit comments

Comments
 (0)