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

Conversation

okozachenko1203
Copy link
Member

@okozachenko1203 okozachenko1203 commented Nov 17, 2022

fix #42

fix #45

MAGNUM-2

@mnaser
Copy link
Member

mnaser commented Nov 17, 2022

by doing this, we're fully committing to Flatcar and not running anything on Ubuntu.

I think the cleaner thing is that we should create a variable called operatingSystem in the ClusterClass, and then in there, it can be an enum of either ubuntu or flatcar, by default it will be set to ubuntu.

And then, we should create a patch, conditional on operatingSystem being equal to flatcar to make all the changes that are needed for Flatcar, that way we can support both.

Then, we will have to update the driver to detect os_distro and use the appropriate model. Also, I think that means we'll also need to update the image builder script to allow building flatcar images and publish them too.

@okozachenko1203
Copy link
Member Author

okozachenko1203 commented Nov 18, 2022

@okozachenko1203 okozachenko1203 changed the title fix: use flatcar [WIP] fix: use flatcar Nov 18, 2022
Copy link
Member

@mnaser mnaser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good progress, let's make sure to switch to patches on the ClusterClass as mentioned

Also, let's update title to be feat since this is a feature addition.

magnum_cluster_api/resources.py Outdated Show resolved Hide resolved
magnum_cluster_api/resources.py Outdated Show resolved Hide resolved
@okozachenko1203 okozachenko1203 changed the title [WIP] fix: use flatcar [WIP] feat: use flatcar Nov 22, 2022
Copy link
Member

@mnaser mnaser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nits, otherwise is this ready to land @okozachenko1203 -- shall we drop the WIP?

magnum_cluster_api/cmd/image_builder.py Show resolved Hide resolved
magnum_cluster_api/cmd/image_builder.py Outdated Show resolved Hide resolved
@okozachenko1203
Copy link
Member Author

okozachenko1203 commented Nov 23, 2022

small nits, otherwise is this ready to land @okozachenko1203 -- shall we drop the WIP?

@mnaser
All patches are rendered exactly but now I am facing kcp unavailable issue. Seems kubernetes-sigs/image-builder#939 (comment) is not working. Btw, I need to dig more by jump into the machine. But key auth is not working with flatcar image. Created an issue to the upstream.
Flatcar images built by image-builder does not support key auth · Issue #1018 · kubernetes-sigs/image-builder

@okozachenko1203 okozachenko1203 changed the title [WIP] feat: use flatcar feat: Support Flatcar OS Nov 24, 2022
@okozachenko1203
Copy link
Member Author

small nits, otherwise is this ready to land @okozachenko1203 -- shall we drop the WIP?

@mnaser All patches are rendered exactly but now I am facing kcp unavailable issue. Seems kubernetes-sigs/image-builder#939 (comment) is not working. Btw, I need to dig more by jump into the machine. But key auth is not working with flatcar image. Created an issue to the upstream. Flatcar images built by image-builder does not support key auth · Issue #1018 · kubernetes-sigs/image-builder

I close this kubernetes-sigs/image-builder#1018 and land openstack provider specific override in this driver.

@okozachenko1203 okozachenko1203 changed the title feat: Support Flatcar OS feat: Support Flatcar OS and custom NTP servers Nov 25, 2022
Comment on lines +98 to +99
# https://github.com/flatcar/Flatcar/issues/823
"ansible_user_vars": "oem_id=openstack",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of hacks around this because we're using an ISO image, @okozachenko1203 is going to contribute to image-builder an openstack image so that it uses OpenStack to deploy and publish directly to Glance.

Once we have that in place, we should switch the image builder to use that instead. It'll drive down the dependencies and we can remove this after.

Comment on lines +98 to +99
# https://github.com/flatcar/Flatcar/issues/823
"ansible_user_vars": "oem_id=openstack",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of hacks around this because we're using an ISO image, @okozachenko1203 is going to contribute to image-builder an openstack image so that it uses OpenStack to deploy and publish directly to Glance.

Once we have that in place, we should switch the image builder to use that instead. It'll drive down the dependencies and we can remove this after.

Comment on lines +1018 to +1033
units:
- name: coreos-metadata.service
dropins:
- name: 20-clct-provider-override.conf
contents: |
[Service]
# Set Openstack as coreos-metadata provider
Environment=COREOS_METADATA_OPT_PROVIDER=--provider=openstack-metadata
- name: coreos-metadata-sshkeys@.service
enabled: true
dropins:
- name: 20-clct-provider-override.conf
contents: |
[Service]
# Set Openstack as coreos-metadata provider
Environment=COREOS_METADATA_OPT_PROVIDER=--provider=openstack-metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this after moving to openstack built images.

Comment on lines +1109 to +1121
- name: coreos-metadata.service
dropins:
- name: 20-clct-provider-override.conf
contents: |
[Service]
Environment=COREOS_METADATA_OPT_PROVIDER=--provider=openstack-metadata
- name: coreos-metadata-sshkeys@.service
enabled: true
dropins:
- name: 20-clct-provider-override.conf
contents: |
[Service]
Environment=COREOS_METADATA_OPT_PROVIDER=--provider=openstack-metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this after moving to openstack built images

Comment on lines +1034 to +1047
- name: kubeadm.service
dropins:
- name: 10-flatcar.conf
contents: |
[Unit]
# kubeadm must run after coreos-metadata populated /run/metadata directory.
Requires=coreos-metadata.service
After=coreos-metadata.service
[Service]
# Ensure kubeadm service has access to kubeadm binary in /opt/bin on Flatcar.
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/bin
# To make metadata environment variables available for pre-kubeadm commands.
EnvironmentFile=/run/metadata/*
""" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels like it should live inside image-builder, so I think as a separate PR we should fix this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PATH modifying part should not be needed anymore since kubernetes-sigs/image-builder@f4864de, but I think dependence on coreos-metadata.service is platform-specific, so I don't think image-builder is a good place to put this.

Comment on lines +1122 to +1136
- name: kubeadm.service
dropins:
- name: 10-flatcar.conf
contents: |
[Unit]
# kubeadm must run after coreos-metadata populated /run/metadata directory.
Requires=coreos-metadata.service
After=coreos-metadata.service
[Service]
# In Flatcar /usr is immutable, so image-builder puts the binaries in /opt/bin instead.
# Ensure kubeadm service has access to kubeadm binary in /opt/bin on Flatcar.
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/bin
# To make metadata environment variables available for pre-kubeadm commands.
EnvironmentFile=/run/metadata/*
""" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this

@t-lo t-lo mentioned this pull request Jan 4, 2023
1 task
@tormath1
Copy link

Hello, Flatcar is now supported by CAPO - did you give a try with Magnum recently ? @mnaser I see you're in the #cluster-api-openstack Slack channel, do not hesitate to ping me if you need a hand on this topic. :)

@mnaser
Copy link
Member

mnaser commented May 30, 2023

I think perhaps maybe if there's some documentation on building images and how clusters are defined for a flatcar system.. that would be helpful

@tormath1
Copy link

@mnaser there is this documentation on the CAPO handbook: https://cluster-api-openstack.sigs.k8s.io/clusteropenstack/configuration.html#ignition-based-images to build and use Flatcar images (and as you know there is this issue: kubernetes-sigs/cluster-api-provider-openstack#1502)

@Mazorius
Copy link

Mazorius commented Jul 7, 2023

I am waiting for the NTP fix as on autoscaling it is not possible to always change the internal NTP server.

Can the NTP fix be extracted so it can be merged @okozachenko1203 ?

@mnaser
Copy link
Member

mnaser commented Oct 13, 2023

@Mazorius you shouldn't have any ntp issues with the latest images as you'll be getting the NTP server from DHCP, and the Flatcar part has been merged so I'm closing thsi

@mnaser mnaser closed this Oct 13, 2023
@mnaser mnaser deleted the use-flatcar branch October 13, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom NTP server Add support for Flatcar Linux
5 participants