Skip to content

Commit 30362d1

Browse files
authored
Merge pull request #2890 from kinvolk/invidian/flatcar-e2e-tests
Add Flatcar Container Linux template
2 parents 9b2bf83 + 8dad8f0 commit 30362d1

File tree

15 files changed

+900
-18
lines changed

15 files changed

+900
-18
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ kind-create: $(KUBECTL) ## Create capz kind cluster if needed.
706706

707707
.PHONY: tilt-up
708708
tilt-up: install-tools kind-create ## Start tilt and build kind cluster if needed.
709-
EXP_CLUSTER_RESOURCE_SET=true EXP_MACHINE_POOL=true tilt up
709+
EXP_CLUSTER_RESOURCE_SET=true EXP_MACHINE_POOL=true EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true tilt up
710710

711711
.PHONY: delete-cluster
712712
delete-cluster: delete-workload-cluster ## Deletes the example kind cluster "capz".

Tiltfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ settings = {
2323
"cert_manager_version": "v1.10.0",
2424
"kubernetes_version": "v1.24.6",
2525
"aks_kubernetes_version": "v1.24.6",
26+
"flatcar_version": "3374.2.1",
2627
}
2728

2829
keys = ["AZURE_SUBSCRIPTION_ID", "AZURE_TENANT_ID", "AZURE_CLIENT_SECRET", "AZURE_CLIENT_ID"]
@@ -337,6 +338,7 @@ def deploy_worker_templates(template, substitutions):
337338
"AZURE_CONTROL_PLANE_MACHINE_TYPE": "Standard_B2s",
338339
"WORKER_MACHINE_COUNT": "2",
339340
"AZURE_NODE_MACHINE_TYPE": "Standard_B2s",
341+
"FLATCAR_VERSION": settings.get("flatcar_version"),
340342
}
341343

342344
if flavor == "aks":
@@ -347,9 +349,9 @@ def deploy_worker_templates(template, substitutions):
347349
value = substitutions[substitution]
348350
yaml = yaml.replace("${" + substitution + "}", value)
349351

350-
yaml = yaml.replace('"', '\\"') # add escape character to double quotes in yaml
352+
yaml = shlex.quote(yaml)
351353
flavor_name = os.path.basename(flavor)
352-
flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo \"" + yaml + "\" > ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f - && echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\""
354+
flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); export CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo " + yaml + "> ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f - && echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\""
353355

354356
# wait for kubeconfig to be available
355357
flavor_cmd += "; until " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig > /dev/null 2>&1; do sleep 5; done; " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig -o jsonpath={.data.value} | base64 --decode > ./${CLUSTER_NAME}.kubeconfig; chmod 600 ./${CLUSTER_NAME}.kubeconfig; until " + kubectl_cmd + " --kubeconfig=./${CLUSTER_NAME}.kubeconfig get nodes > /dev/null 2>&1; do sleep 5; done"

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [Virtual Networks](./topics/custom-vnet.md)
3131
- [VM Identity](./topics/vm-identity.md)
3232
- [Windows](./topics/windows.md)
33+
- [Flatcar](./topics/flatcar.md)
3334
- [Development](./developers/development.md)
3435
- [Kubernetes Developers](./developers/kubernetes-developers.md)
3536
- [Releasing](./developers/releasing.md)

docs/book/src/topics/flatcar.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Flatcar Clusters
2+
3+
## Overview
4+
5+
CAPZ enables you to create Kubernetes clusters using Flatcar Container Linux on Microsoft Azure.
6+
7+
### Image creation
8+
9+
The testing reference images are built using [image-builder](https://github.com/kubernetes-sigs/image-builder) by Flatcar maintainers and published to the Flatcar CAPI Community Gallery on Azure with community gallery name `flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0`.
10+
11+
<aside class="note warning">
12+
13+
<h1> Security </h1>
14+
15+
The reference images are not updated with security fixes. They are intended only to facilitate testing and to help users try out Cluster API for Azure.
16+
17+
The reference images should not be used in a production environment. It is highly recommended to [maintain your own custom image](#building-a-custom-image) instead.
18+
19+
</aside>
20+
21+
Find the latest published images:
22+
23+
```console
24+
$ az sig image-definition list-community --location westeurope --public-gallery-name flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0 --only-show-errors
25+
HyperVGeneration Location Name OsState OsType UniqueId
26+
------------------ ---------- ---------------------------------- ----------- -------- ---------------------------------------------------------------------------------------------------------------
27+
V2 westeurope flatcar-stable-amd64-capi-v1.23.13 Generalized Linux /CommunityGalleries/flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0/Images/flatcar-stable-amd64-capi-v1.23.13
28+
V2 westeurope flatcar-stable-amd64-capi-v1.25.4 Generalized Linux /CommunityGalleries/flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0/Images/flatcar-stable-amd64-capi-v1.25.4
29+
V2 westeurope flatcar-stable-amd64-capi-v1.26.0 Generalized Linux /CommunityGalleries/flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0/Images/flatcar-stable-amd64-capi-v1.26.0
30+
$
31+
$ az sig image-version list-community --location westeurope --public-gallery-name flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0 --only-show-errors --gallery-image-definition flatcar-stable-amd64-capi-v1.26.0
32+
ExcludeFromLatest Location Name PublishedDate UniqueId
33+
------------------- ---------- -------- -------------------------------- --------------------------------------------------------------------------------------------------------------------------------
34+
False westeurope 3227.2.3 2022-12-09T18:05:58.830464+00:00 /CommunityGalleries/flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0/Images/flatcar-stable-amd64-capi-v1.26.0/Versions/3227.2.3
35+
```
36+
37+
If you would like customize your images please refer to the documentation on building your own [custom images](custom-images.md).
38+
39+
## Trying it out
40+
41+
To create a cluster using Flatcar Container Linux, use `flatcar` cluster flavor.

templates/cluster-template-flatcar.yaml

Lines changed: 265 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace: default
2+
resources:
3+
- ../base
4+
- machine-deployment.yaml
5+
- ../../azure-cluster-identity
6+
7+
patchesStrategicMerge:
8+
- patches/kubeadm-controlplane.yaml
9+
- ../../azure-cluster-identity/azurecluster-identity-ref.yaml

0 commit comments

Comments
 (0)