Skip to content

Commit

Permalink
optional flatcar tests will create a loadbalancer
Browse files Browse the repository at this point in the history
- Set cloudControllerManager.caCertDir to `/usr/share/ca-certificates`
- and check if loadbalancer can spin up successfully
- add caCertDir to CCM in tiltfile
- add Note about caCertDir to CCM in azure external docs
  • Loading branch information
nawazkh committed May 9, 2023
1 parent 5329913 commit 7af32d1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,14 @@ def deploy_worker_templates(template, substitutions):
calico_values = "./templates/addons/calico-dual-stack/values.yaml"
else:
calico_values = "./templates/addons/calico/values.yaml"
flavor_cmd += "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://docs.tigera.io/calico/charts calico tigera-operator -f " + calico_values + " --namespace tigera-operator --create-namespace"

flavor_cmd += "; " + helm_cmd + " repo add projectcalico https://docs.tigera.io/calico/charts; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install calico projectcalico/tigera-operator -f " + calico_values + " --namespace tigera-operator --create-namespace"

if "intree-cloud-provider" not in flavor_name:
flavor_cmd += "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME}"
if "flatcar" in flavor_name: # append to helm command in the flavor_cmd above
flavor_cmd += " --set-string cloudControllerManager.caCertDir=/usr/share/ca-certificates"

local_resource(
name = flavor_name,
cmd = ["sh", "-ec", flavor_cmd],
Expand Down
7 changes: 7 additions & 0 deletions docs/book/src/topics/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ Then install the Helm chart on the workload cluster:
helm install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME} --set "cloudControllerManager.clusterCIDR=${CCM_CIDR_BLOCK}"
```

- **Note**:
When working with **Flatcar machines**, append `--set-string cloudControllerManager.caCertDir=/usr/share/ca-certificates` to the `cloud-provider-azure` _helm_ command. The helm command to install cloud provider azure for Flatcar-flavored workload cluster will be:

```bash
helm install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME} --set "cloudControllerManager.clusterCIDR=${CCM_CIDR_BLOCK}" --set-string "cloudControllerManager.caCertDir=/usr/share/ca-certificates"
```

The Helm chart will pick the right version of `cloud-controller-manager` and `cloud-node-manager` to work with the version of Kubernetes your cluster is running.

After running `helm install`, you should eventually see a set of pods like these in a `Running` state:
Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/topics/flatcar.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ If you would like customize your images please refer to the documentation on bui
## Trying it out

To create a cluster using Flatcar Container Linux, use `flatcar` cluster flavor.

- Note: When working with **Flatcar machines**, append `--set-string cloudControllerManager.caCertDir=/usr/share/ca-certificates` to the `cloud-provider-azure` _helm_ command. Refer ["External Cloud Provider's Note for flatcar-flavored machine"](https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/764aa1e8bd02d150dff90ff6bc7f8daa2b38810f/docs/book/src/topics/addons.md#external-cloud-provider)
- However, no changes are needed when using tilt to bring up flatcar-flavored workload clusters.
21 changes: 20 additions & 1 deletion test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ var _ = Describe("Workload cluster creation", func() {
Context("Creating a Flatcar cluster [OPTIONAL]", func() {
It("With Flatcar control-plane and worker nodes", func() {
clusterName = getClusterName(clusterNamePrefix, "flatcar")

clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput(
specName,
withFlavor("flatcar"),
Expand All @@ -309,7 +308,27 @@ var _ = Describe("Workload cluster creation", func() {
withControlPlaneWaiters(clusterctl.ControlPlaneWaiters{
WaitForControlPlaneInitialized: EnsureControlPlaneInitialized,
}),
withPostMachinesProvisioned(func() {
EnsureDaemonsets(ctx, func() DaemonsetsSpecInput {
return DaemonsetsSpecInput{
BootstrapClusterProxy: bootstrapClusterProxy,
Namespace: namespace,
ClusterName: clusterName,
}
})
}),
), result)

By("can create and access a load balancer", func() {
AzureLBSpec(ctx, func() AzureLBSpecInput {
return AzureLBSpecInput{
BootstrapClusterProxy: bootstrapClusterProxy,
Namespace: namespace,
ClusterName: clusterName,
SkipCleanup: skipCleanup,
}
})
})
})
})

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/cloud-provider-azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func InstallCalicoAndCloudProviderAzureHelmChart(ctx context.Context, input clus
options.StringValues = append(options.StringValues, fmt.Sprintf("cloudNodeManager.imageTag=%s", os.Getenv("IMAGE_TAG_CNM")))
}

if input.ConfigCluster.Flavor == "flatcar" {
options.StringValues = append(options.StringValues, "cloudControllerManager.caCertDir=/usr/share/ca-certificates")
}

clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.ConfigCluster.Namespace, input.ConfigCluster.ClusterName)
InstallHelmChart(ctx, clusterProxy, defaultNamespace, cloudProviderAzureHelmRepoURL, cloudProviderAzureChartName, cloudProviderAzureHelmReleaseName, options)

Expand Down

0 comments on commit 7af32d1

Please sign in to comment.