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

OEM: Provide Proxmox images #1783

Merged
merged 2 commits into from
Nov 12, 2024
Merged

OEM: Provide Proxmox images #1783

merged 2 commits into from
Nov 12, 2024

Conversation

pothos
Copy link
Member

@pothos pothos commented Mar 22, 2024

This pulls in flatcar/bootengine#91
and flatcar/init#115 to run afterburn for
hostname, network, SSH key, and metadata attribute setup. The afterburn
support for the SSH key and hostname parses the user-data when it's
cloud-init. The coreos-cloudinit support is not there but can be added
in addition: We need to add a new provider that varies from the existing
config drive support because the file is called user-data and not
user_data, and it needs to look for a filesystem label cidata and not
config-2.

Related to: flatcar/Flatcar#1040

How to use

Follow-up: fix coreos-cloudinit as mentioned above, and better don't make it work through the mount unit trigger but explicitly

Testing done

Jenkins

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

Copy link

github-actions bot commented Mar 22, 2024

Build action triggered: https://github.com/flatcar/scripts/actions/runs/11834695974

@arcln
Copy link

arcln commented Apr 24, 2024

Hello, there is an existing Igntion PR that should work at coreos/ignition#1790. Could you include the Ignition PR into this one so we can do further testing?

@pothos
Copy link
Member Author

pothos commented Apr 24, 2024

Hello, there is an existing Igntion PR that should work at coreos/ignition#1790. Could you include the Ignition PR into this one so we can do further testing?

This needs to be reworked first and we have to drop the afterburn integration in Flatcar as the afterburn PR relies on cloud-init userdata and because Flatcar will run coreos-cloudinit anyway if it doesn't see Ignition user-data we would have it processed twice. For the network config that can be quite confusing because the afterburn network unit would only support a subset.

@pothos pothos force-pushed the kai/proxmox-support branch 2 times, most recently from 64b0e74 to 7c833ba Compare May 6, 2024 13:19
@pothos
Copy link
Member Author

pothos commented May 6, 2024

Triggered a new build with the Ignition PR included

@arcln
Copy link

arcln commented May 27, 2024

@pothos hey, it looks like the build never started, can you take a look please ? (cc @plgueugnon)

@tormath1
Copy link
Contributor

@pothos hey, it looks like the build never started, can you take a look please ? (cc @plgueugnon)

@arcln hey, pothos is AFK for now. I'll take over this PR. A CI build has been triggered :)

@tormath1
Copy link
Contributor

@arcln
Copy link

arcln commented May 29, 2024

Thank you, I tried the image and it didn't work because of a problem in the ignition PR (see coreos/ignition#1790 (comment)). Can you please run a new build when the PR is fixed ? Thanks

@tormath1
Copy link
Contributor

Thank you, I tried the image and it didn't work because of a problem in the ignition PR (see coreos/ignition#1790 (comment)). Can you please run a new build when the PR is fixed ? Thanks

@arcln ah I see, I already got this issue once. I started a new build with an updated patch: https://github.com/flatcar/scripts/pull/1783/files#diff-c65e2140094c80c4b4ce5c7c8494b6e4e72b78ef0692d236ffee1fb3932e11c5R157

@arcln
Copy link

arcln commented May 30, 2024

great. it seems that the build needs approval once again @tormath1

@tormath1
Copy link
Contributor

@arcln it builds directly on our Jenkins (github actions only build for qemu targets) - I'll let you know once it's done.

@tormath1
Copy link
Contributor

@arcln image is available here: http://bincache.flatcar-linux.net/images/amd64/9999.0.102+kai-proxmox-support/flatcar_production_proxmoxve_image.img.bz2

@tormath1
Copy link
Contributor

@fhemberger @mcbenjemaa many thanks for trying again Flatcar on Proxmox! I started a discussion to avoid spamming and distracting the PR review. You can continue the discussion here if you need: flatcar/Flatcar#1573

@fhemberger
Copy link

@pothos Could you please add the following change to your PR:

https://github.com/flatcar/scripts/blob/main/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service

--- coreos-metadata.service             2024-10-25 16:14:39.499357398 +0200
+++ coreos-metadata.service-proxmoxve   2024-10-25 16:14:55.180153512 +0200
@@ -25,6 +25,8 @@

 ConditionKernelCommandLine=|flatcar.oem.id=akamai

+ConditionKernelCommandLine=|flatcar.oem.id=proxmoxve
+
 Description=Flatcar Metadata Agent

 [Service]

@donch
Copy link

donch commented Oct 28, 2024

Hi @tormath1 , i've tested your build on Proxmox using the cloud-init configuration and it works well (at least for network configuration and SSH keys). By the way, the hostname configuration process strips any FQDN: if you set 'test.vm-1', only 'test' will be retained as the hostname.

Will continue testing the ignition part.

@tormath1
Copy link
Contributor

@pothos Could you please add the following change to your PR:

https://github.com/flatcar/scripts/blob/main/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service

--- coreos-metadata.service             2024-10-25 16:14:39.499357398 +0200
+++ coreos-metadata.service-proxmoxve   2024-10-25 16:14:55.180153512 +0200
@@ -25,6 +25,8 @@

 ConditionKernelCommandLine=|flatcar.oem.id=akamai

+ConditionKernelCommandLine=|flatcar.oem.id=proxmoxve
+
 Description=Flatcar Metadata Agent

 [Service]

Now available here: http://bincache.flatcar-linux.net/images/amd64/9999.9.101+kai-proxmox-support/flatcar_production_proxmoxve_image.img.bz2

@fhemberger
Copy link

@tormath1 Works fine for me, /run/metadata/flatcar is now created successfully. 👍

@donch
Copy link

donch commented Oct 29, 2024

I was able to sucessfully configure a proxmox VM using ignition including user creation, file creation, custom sysext deployment, systemd unit 🎉
By the way, the service [email protected] is failing when no ssh pub key are supplied but may not be related to this PR

@tormath1
Copy link
Contributor

Thanks everyone involved in the testing of the image, that's truly appreciated ❤️ There is one last thing to sort out: flatcar/Flatcar#1573 (reply in thread) before going ahead.

@abuisine
Copy link

Thanks everyone involved in the testing of the image, that's truly appreciated ❤️ There is one last thing to sort out: flatcar/Flatcar#1573 (reply in thread) before going ahead.

Hi, we got an extra test with @donch if you do not mind : complete configuration via terraform (upload of snippets and cicustom). We should have the feedback today.

@fhemberger
Copy link

fhemberger commented Oct 31, 2024

@abuisine I used Terraform provider bpg/[email protected] to create a VM with an ignition.json config snippet. Worked for me with just this little caveat:

Error: resizing disk: error waiting for VM disk resize: All attempts fail:
│ #1: task "UPID:xxx:0028F421:0E5B0594:67237B38:resize:1000:xxx@xxx!xxx:" failed to complete with exit code: shrinking disks is not supported
│ 
│   with proxmox_virtual_environment_vm.flatcar,
│   on virtual_machine.tf line 1, in resource "proxmox_virtual_environment_vm" "flatcar":
│    1: resource "proxmox_virtual_environment_vm" "flatcar" {

But this is an issue with the provider, starting the VM and everything after worked as expected.

@donch
Copy link

donch commented Oct 31, 2024

Thanks everyone involved in the testing of the image, that's truly appreciated ❤️ There is one last thing to sort out: flatcar/Flatcar#1573 (reply in thread) before going ahead.

Hi, we got an extra test with @donch if you do not mind : complete configuration via terraform (upload of snippets and cicustom). We should have the feedback today.

Hi @tormath1 , i was able to create a VM using Terraform with these providers :

  • community-terraform-providers/ignition v2.3.5 to generate the ignition config
  • bpg/proxmox v0.66.3 to create the VM and attach the generated snippet.

All is working fine 👌

@fhemberger
Copy link

@donch Did you run into the resize issue as well? If not, it would be great if you could share your snippet for proxmox_virtual_environment_vm and proxmox_virtual_environment_file (ISO).

@donch
Copy link

donch commented Oct 31, 2024

@fhemberger no issue on my side. You may have a disk smaller than the image size ? That's why you get the "shrinking" issue i guess.

Here are my snippets:

resource "proxmox_virtual_environment_file" "cloud_config" {
  content_type = "snippets"
  datastore_id = "mystore"
  node_name    = "pve-1"

  source_raw {
    data      = data.ignition_config.config.rendered
    file_name = local.ignition_filename
  }
}


resource "proxmox_virtual_environment_vm" "flatcar" {
  name        = "donch.flatcar-2"
  node_name   = "pve-1"
  vm_id       = local.vm_id
  started     = false

  clone {
    vm_id = 9051
    full  = true
  }

  memory {
    dedicated = 2048
  }

  cpu {
    cores = 2
  }

  disk {
    size            = 12
    datastore_id    = "mystore"
    interface       = "scsi0"
  }

  network_device {
    bridge = "vmbr0"
    model  = "virtio"
    vlan_id = 1234
  }

  agent {
    enabled = true
  }

  initialization {
    datastore_id = "mystore"
    user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
  }

}

@abuisine
Copy link

abuisine commented Nov 4, 2024

Alright so it seems ok except the default behavior while no configuration is provided.
Is this a go then ? or no go ?

@tormath1
Copy link
Contributor

tormath1 commented Nov 4, 2024

Alright so it seems ok except the default behavior while no configuration is provided. Is this a go then ? or no go ?

Hi, it's not only a default behavior: the instance does not boot if no configuration is provided. I'm currently checking this. We aim for a Flatcar release by the end of the week, if it's not solved by this time I will merge this PR. It's ok to have this support in Alpha, even incomplete, we will get more feedback on it.

EDIT: Upstream issue: coreos/afterburn#1126

tormath1 and others added 2 commits November 12, 2024 12:51
Co-authored-by: Kai Lüke <[email protected]>
Signed-off-by: Mathieu Tortuyaux <[email protected]>
Without configdrive the instance is failing to boot - this patch is
currently under review on PR#1128 (coreos/afterburn)

Signed-off-by: Mathieu Tortuyaux <[email protected]>
@tormath1 tormath1 merged commit c80760c into main Nov 12, 2024
@tormath1 tormath1 deleted the kai/proxmox-support branch November 12, 2024 11:52
@deependhulla
Copy link

waiting for seeing on Proxmox

@tormath1
Copy link
Contributor

waiting for seeing on Proxmox

@deependhulla it's available here: https://www.flatcar.org/releases#release-4152.0.0 / documentation: flatcar/flatcar-website#337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

8 participants