Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support Flatcar OS and custom NTP servers #44

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
befc19b
fix: use flatcar
okozachenko1203 Nov 17, 2022
fc3a172
Add preKubeadmCommands for node name replacement
okozachenko1203 Nov 17, 2022
dbc43b2
Fix mdlint
okozachenko1203 Nov 17, 2022
fafcaac
Build flatcar image
okozachenko1203 Nov 18, 2022
51b67e2
Add flatcardriver
okozachenko1203 Nov 18, 2022
9a4f259
Add flatcarDriver in poetry plugin list
okozachenko1203 Nov 18, 2022
65bdd68
Fix prekubeadmcommands format
okozachenko1203 Nov 18, 2022
62bd1f0
Enable required feature gate and update ignition
okozachenko1203 Nov 18, 2022
f38ad5d
Support os switch
okozachenko1203 Nov 22, 2022
facabee
Fix lint
okozachenko1203 Nov 22, 2022
11fe3c1
Fix lint
okozachenko1203 Nov 22, 2022
e18d24a
Fix lint
okozachenko1203 Nov 22, 2022
e2b6dea
Fix fake8 lint
okozachenko1203 Nov 22, 2022
18acf68
Fix clusterclas patches
okozachenko1203 Nov 22, 2022
2408d37
Fix lint
okozachenko1203 Nov 22, 2022
a04544e
Remove default os in image build cmd
okozachenko1203 Nov 23, 2022
1aa707d
Update ignition
okozachenko1203 Nov 24, 2022
a1dc6b9
Fix ignition ignoring error
okozachenko1203 Nov 24, 2022
ded7eb4
Fix lint
okozachenko1203 Nov 24, 2022
7c46bb5
Add comment about PATH overwrite in flatcar
okozachenko1203 Nov 24, 2022
0429d08
Update TODO comment
okozachenko1203 Nov 24, 2022
e46788a
Land clct openstack provider override
okozachenko1203 Nov 25, 2022
9e58cb0
Remove comments
okozachenko1203 Nov 25, 2022
35fbe03
Support ntp servers
okozachenko1203 Nov 25, 2022
4e18f36
Fix syntax
okozachenko1203 Nov 25, 2022
5e0e344
Fix condition for ntpserver length
okozachenko1203 Nov 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

## [0.2.0](https://github.com/vexxhost/magnum-cluster-api/compare/v0.1.2...v0.2.0) (2022-11-16)


### Bug Fixes

* added flux + node labels ([5f04d4e](https://github.com/vexxhost/magnum-cluster-api/commit/5f04d4ed8b00ba0d45cc59edd678bdf72679b00b))


### Miscellaneous Chores

* release 0.2.0 ([9c8fe82](https://github.com/vexxhost/magnum-cluster-api/commit/9c8fe8252e61b43019a0c45d31284467ec99af15))
Expand Down
1 change: 1 addition & 0 deletions hack/stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ kubectl label node kind-control-plane openstack-control-plane=enabled

# Initialize the `clusterctl` CLI
export EXP_CLUSTER_RESOURCE_SET=true
export EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true #Used by the kubeadm bootstrap provider
export CLUSTER_TOPOLOGY=true
clusterctl init \
--core cluster-api:v1.3.0-rc.0 \
Expand Down
2 changes: 1 addition & 1 deletion magnum_cluster_api/cmd/image_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"--operating-system",
show_default=True,
default="ubuntu-2004",
okozachenko1203 marked this conversation as resolved.
Show resolved Hide resolved
type=click.Choice(["ubuntu-2004"]),
type=click.Choice(["ubuntu-2004", "flatcar"]),
okozachenko1203 marked this conversation as resolved.
Show resolved Hide resolved
help="Operating system to build image for",
)
@click.option(
Expand Down
8 changes: 8 additions & 0 deletions magnum_cluster_api/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,11 @@ def provides(self):
return [
{"server_type": "vm", "os": "ubuntu-focal", "coe": "kubernetes"},
]


class FlatcarDriver(BaseDriver):
@property
def provides(self):
return [
{"server_type": "vm", "os": "flatcar", "coe": "kubernetes"},
]
36 changes: 31 additions & 5 deletions magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,19 @@ def get_object(self) -> objects.KubeadmControlPlaneTemplate:
"template": {
"spec": {
"kubeadmConfigSpec": {
"format": "ignition",
"ignition": {
"containerLinuxConfig": {
"additionalConfig": "storage:\n links:\n - path: /etc/systemd/system/kubeadm.service.wants/containerd.service\n target: /usr/lib/systemd/system/containerd.service\n"
okozachenko1203 marked this conversation as resolved.
Show resolved Hide resolved
},
},
# In Flatcar kubeadm configuration is in different directory because /run
# can't be provisioned with ignition.
"preKubeadmCommands": [
"""
bash -c "sed -i 's/__REPLACE_NODE_NAME__/$(hostname -s)/g' /etc/kubeadm.yml"
"""
okozachenko1203 marked this conversation as resolved.
Show resolved Hide resolved
],
"clusterConfiguration": {
"apiServer": {
"extraArgs": {
Expand Down Expand Up @@ -449,15 +462,15 @@ def get_object(self) -> objects.KubeadmControlPlaneTemplate:
],
"initConfiguration": {
"nodeRegistration": {
"name": "{{ local_hostname }}",
"name": "__REPLACE_NODE_NAME__",
"kubeletExtraArgs": {
"cloud-provider": "external",
},
},
},
"joinConfiguration": {
"nodeRegistration": {
"name": "{{ local_hostname }}",
"name": "__REPLACE_NODE_NAME__",
"kubeletExtraArgs": {
"cloud-provider": "external",
},
Expand Down Expand Up @@ -485,17 +498,30 @@ def get_object(self) -> objects.KubeadmConfigTemplate:
"spec": {
"template": {
"spec": {
"format": "ignition",
"ignition": {
"containerLinuxConfig": {
"additionalConfig": "storage:\n links:\n - path: /etc/systemd/system/kubeadm.service.wants/containerd.service\n target: /usr/lib/systemd/system/containerd.service\n"
},
},
"files": [],
# In Flatcar kubeadm configuration is in different directory because /run
# can't be provisioned with ignition.
"preKubeadmCommands": [
"""
bash -c "sed -i 's/__REPLACE_NODE_NAME__/$(hostname -s)/g' /etc/kubeadm.yml"
"""
],
"joinConfiguration": {
"nodeRegistration": {
"name": "{{ local_hostname }}",
"name": "__REPLACE_NODE_NAME__",
"kubeletExtraArgs": {
"cloud-provider": "external",
},
},
},
}
}
},
},
},
},
)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ magnum-cluster-api-image-loader = "magnum_cluster_api.cmd.image_loader:main"

[tool.poetry.plugins."magnum.drivers"]
"k8s_cluster_api_ubuntu_focal" = "magnum_cluster_api.driver:UbuntuFocalDriver"
"k8s_cluster_api_flatcar" = "magnum_cluster_api.driver:FlatcarDriver"