Skip to content

Commit 4e1b8f2

Browse files
committed
Add support for Flatcar Linux on Azure
* Accept `os_image` "flatcar-stable" and "flatcar-beta" to use Kinvolk's Flatcar Linux images from the Azure Marketplace Note: Flatcar Linux Azure Marketplace images require terms be accepted before use
1 parent ab7913a commit 4e1b8f2

File tree

7 files changed

+46
-8
lines changed

7 files changed

+46
-8
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Notable changes between versions.
2121
* Switch to Azure's new Linux VM and Linux VM Scale Set resources
2222
* Set controller's Azure disk caching to None
2323
* Associate subnets (in addition to NICs) with security groups (aesthetic)
24+
* Add support for Flatcar Container Linux ([#664](https://github.com/poseidon/typhoon/pull/664))
25+
* Requires accepting Flatcar Linux Azure Marketplace terms
2426

2527
#### Bare-Metal
2628

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Typhoon is available for [Flatcar Container Linux](https://www.flatcar-linux.org
4242
| Platform | Operating System | Terraform Module | Status |
4343
|---------------|------------------|------------------|--------|
4444
| AWS | Flatcar Linux | [aws/container-linux/kubernetes](aws/container-linux/kubernetes) | stable |
45+
| Azure | Flatcar Linux | [azure/container-linux/kubernetes](azure/container-linux/kubernetes) | alpha |
4546
| Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](bare-metal/container-linux/kubernetes) | stable |
4647
| Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](google-cloud/container-linux/kubernetes) | alpha |
4748
| Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](digital-ocean/container-linux/kubernetes) | alpha |

azure/container-linux/kubernetes/controllers.tf

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ resource "azurerm_dns_a_record" "etcds" {
1515
}
1616

1717
locals {
18-
# Channel for a Container Linux derivative
18+
# Container Linux derivative
1919
# coreos-stable -> Container Linux Stable
20+
# flatcar-stable -> Flatcar Linux Stable
21+
flavor = split("-", var.os_image)[0]
2022
channel = split("-", var.os_image)[1]
2123
}
2224

@@ -52,12 +54,23 @@ resource "azurerm_linux_virtual_machine" "controllers" {
5254
}
5355

5456
source_image_reference {
55-
publisher = "CoreOS"
56-
offer = "CoreOS"
57+
publisher = local.flavor == "flatcar" ? "Kinvolk" : "CoreOS"
58+
offer = local.flavor == "flatcar" ? "flatcar-container-linux" : "CoreOS"
5759
sku = local.channel
5860
version = "latest"
5961
}
6062

63+
# Gross hack just for Flatcar Linux
64+
dynamic "plan" {
65+
for_each = local.flavor == "flatcar" ? [1] : []
66+
67+
content {
68+
name = local.channel
69+
publisher = "kinvolk"
70+
product = "flatcar-container-linux"
71+
}
72+
}
73+
6174
# network
6275
network_interface_ids = [
6376
azurerm_network_interface.controllers.*.id[count.index]

azure/container-linux/kubernetes/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ variable "worker_type" {
4949
variable "os_image" {
5050
type = string
5151
default = "coreos-stable"
52-
description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha)"
52+
description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta)"
5353
}
5454

5555
variable "disk_size" {

azure/container-linux/kubernetes/workers/workers.tf

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
locals {
2-
# Channel for a Container Linux derivative
32
# coreos-stable -> Container Linux Stable
3+
# flatcar-stable -> Flatcar Linux Stable
4+
flavor = split("-", var.os_image)[0]
45
channel = split("-", var.os_image)[1]
56
}
67

@@ -24,12 +25,23 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" {
2425
}
2526

2627
source_image_reference {
27-
publisher = "CoreOS"
28-
offer = "CoreOS"
28+
publisher = local.flavor == "flatcar" ? "Kinvolk" : "CoreOS"
29+
offer = local.flavor == "flatcar" ? "flatcar-container-linux" : "CoreOS"
2930
sku = local.channel
3031
version = "latest"
3132
}
3233

34+
# Gross hack just for Flatcar Linux
35+
dynamic "plan" {
36+
for_each = local.flavor == "flatcar" ? [1] : []
37+
38+
content {
39+
name = local.channel
40+
publisher = "kinvolk"
41+
product = "flatcar-container-linux"
42+
}
43+
}
44+
3345
# Azure requires setting admin_ssh_key, though Ignition custom_data handles it too
3446
admin_username = "core"
3547
admin_ssh_key {

docs/cl/azure.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ module "ramius" {
8585

8686
Reference the [variables docs](#variables) or the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/container-linux/kubernetes/variables.tf) source.
8787

88+
### Flatcar Linux Only
89+
90+
Flatcar Linux publishes images to the Azure Marketplace and requires accepting their legal terms.
91+
92+
```
93+
az vm image terms show --publish kinvolk --offer flatcar-container-linux --plan stable
94+
az vm image terms accept --publish kinvolk --offer flatcar-container-linux --plan stable
95+
```
96+
8897
## ssh-agent
8998

9099
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
@@ -223,7 +232,7 @@ Reference the DNS zone with `azurerm_dns_zone.clusters.name` and its resource gr
223232
| worker_count | Number of workers | 1 | 3 |
224233
| controller_type | Machine type for controllers | "Standard_B2s" | See below |
225234
| worker_type | Machine type for workers | "Standard_DS1_v2" | See below |
226-
| os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha |
235+
| os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta |
227236
| disk_size | Size of the disk in GB | 40 | 100 |
228237
| worker_priority | Set priority to Spot to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Spot |
229238
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Typhoon is available for [Flatcar Container Linux](https://www.flatcar-linux.org
4242
| Platform | Operating System | Terraform Module | Status |
4343
|---------------|------------------|------------------|--------|
4444
| AWS | Flatcar Linux | [aws/container-linux/kubernetes](cl/aws.md) | stable |
45+
| Azure | Flatcar Linux | [azure/container-linux/kubernetes](cl/azure.md) | alpha |
4546
| Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](cl/bare-metal.md) | stable |
4647
| Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](cl/google-cloud.md) | alpha |
4748
| Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](cl/digital-ocean.md) | alpha |

0 commit comments

Comments
 (0)