Skip to content

Migrate to V2 API - #21

Merged
Gerrit91 merged 28 commits into
masterfrom
migrate-to-metal-apiserver
Aug 18, 2026
Merged

Migrate to V2 API#21
Gerrit91 merged 28 commits into
masterfrom
migrate-to-metal-apiserver

Conversation

@majst01

@majst01 majst01 commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

Description

First microservice which gets migrated to MEP-4

Closes: #23

TODO:

  • add a helper to create proper tokens which is suitable for this service (image.list and partition.list is only required)
  • maybe also add a regular token refresh call into this service as well

References:

Tested in mini-lab with this output:

 bin/metal-image-cache-sync --metal-apiserver-token eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vdjIuYXBpLjE3Mi4xNy4wLjEubmlwLmlvOjgwODAiLCJzdWIiOiJDaVF3TURBd01EQXdNQzB3TURBd0xUQXdNREF0TURBd01DMHdNREF3TURBd01EQXdNREVTQld4dlkyRnNAb2lkYyIsImV4cCI6MTc1MDQ2MDAwMCwibmJmIjoxNzUwNDMxMjAwLCJpYXQiOjE3NTA0MzEyMDAsImp0aSI6IjI2YjcwMDFlLTkxNjYtNDcwOS05MjYyLTUxZjk1NTFiYmNiNCIsInR5cGUiOiJUT0tFTl9UWVBFX0NPTlNPTEUifQ.AT9oLTE-IXSUxZpaStJxwbHmyCRFs_ehW5BWOYR0aynxLc-iuItm5Mjncb3YUCWEhIP_AxMv6633MkajcqkX_V7WAOF22RZrRKodkDTGv2WJBWYDFrVtrsUqWpKjMuRr0UPrVQXOuvX8ABjjPgizXy0jKA2vMdsAwsCSlQwXGWsXtR0_ --metal-apiserver-url http://v2.api.172.17.0.1.nip.io:8080 --cache-root-path /tmp
{"time":"2025-06-20T17:02:47.776421354+02:00","level":"INFO","msg":"start metal stack image sync","version":"migrate-to-metal-apiserver (605223d9), heads/migrate-to-metal-apiserver-0-g605223d, 2025-06-20T17:01:50+02:00, go1.24.4"}
{"time":"2025-06-20T17:02:47.776556957+02:00","level":"INFO","msg":"starting to serve files","bind-address":"0.0.0.0:3000","directory":"/tmp/images"}
{"time":"2025-06-20T17:02:47.776661824+02:00","level":"INFO","msg":"starting to serve files","bind-address":"0.0.0.0:3001","directory":"/tmp/kernels"}
{"time":"2025-06-20T17:02:47.776731555+02:00","level":"INFO","msg":"starting to serve files","bind-address":"0.0.0.0:3002","directory":"/tmp/boot-images"}
{"time":"2025-06-20T17:02:49.166192125+02:00","level":"WARN","msg":"cannot reduce anymore images (all at minimum size), exceeding maximum cache size"}
{"time":"2025-06-20T17:02:49.166261777+02:00","level":"INFO","msg":"sync plan","syncer":{"amount":3,"cache-size-after-sync":"1.527GiB"}}
┌─────────────────────┬─────────────────────────────────────────────────┬─────────┬──────────┐
│         ID          │                      PATH                       │  SIZE   │  ACTION  │
├─────────────────────┼─────────────────────────────────────────────────┼─────────┼──────────┤
│ debian-12.0         │ metal-os/stable/debian/12/img.tar.lz4           │ 482.1MB │ download │
│ firewall-ubuntu-3.0 │ metal-os/stable/firewall/3.0-ubuntu/img.tar.lz4 │ 654.1MB │ download │
│ ubuntu-24.4         │ metal-os/stable/ubuntu/24.04/img.tar.lz4        │ 503.3MB │ download │
└─────────────────────┴─────────────────────────────────────────────────┴─────────┴──────────┘
{"time":"2025-06-20T17:02:49.166878885+02:00","level":"INFO","msg":"downloading file","syncer":{"id":"debian-12.0","key":"metal-os/stable/debian/12/img.tar.lz4","size":482149203,"to":"/tmp/tmp/tmp"}}
{"time":"2025-06-20T17:03:29.081186289+02:00","level":"INFO","msg":"downloading md5 checksum","syncer":{"id":"debian-12.0","key":"metal-os/stable/debian/12/img.tar.lz4","to":"/tmp/images/metal-os/stable/debian/12/img.tar.lz4.md5"}}
{"time":"2025-06-20T17:03:29.139434343+02:00","level":"INFO","msg":"downloading file","syncer":{"id":"firewall-ubuntu-3.0","key":"metal-os/stable/firewall/3.0-ubuntu/img.tar.lz4","size":654080673,"to":"/tmp/tmp/tmp"}}
{"time":"2025-06-20T17:04:23.369369117+02:00","level":"INFO","msg":"downloading md5 checksum","syncer":{"id":"firewall-ubuntu-3.0","key":"metal-os/stable/firewall/3.0-ubuntu/img.tar.lz4","to":"/tmp/images/metal-os/stable/firewall/3.0-ubuntu/img.tar.lz4.md5"}}
{"time":"2025-06-20T17:04:23.436291878+02:00","level":"INFO","msg":"downloading file","syncer":{"id":"ubuntu-24.4","key":"metal-os/stable/ubuntu/24.04/img.tar.lz4","size":503291842,"to":"/tmp/tmp/tmp"}}
{"time":"2025-06-20T17:05:06.701310056+02:00","level":"INFO","msg":"downloading md5 checksum","syncer":{"id":"ubuntu-24.4","key":"metal-os/stable/ubuntu/24.04/img.tar.lz4","to":"/tmp/images/metal-os/stable/ubuntu/24.04/img.tar.lz4.md5"}}
{"time":"2025-06-20T17:05:07.686407408+02:00","level":"INFO","msg":"sync plan","syncer":{"amount":1,"cache-size-after-sync":"8.72MiB"}}
┌────────────┬──────────────────────────────────────────────────────────────┬─────────┬──────────┐
│     ID     │                             PATH                             │  SIZE   │  ACTION  │
├────────────┼──────────────────────────────────────────────────────────────┼─────────┼──────────┤
│ 6.12.32-93 │ metal-stack/kernel/releases/download/6.12.32-93/metal-kernel │ 9.143MB │ download │
└────────────┴──────────────────────────────────────────────────────────────┴─────────┴──────────┘
{"time":"2025-06-20T17:05:07.688278986+02:00","level":"INFO","msg":"downloading file","syncer":{"id":"6.12.32-93","key":"metal-stack/kernel/releases/download/6.12.32-93/metal-kernel","size":9143296,"to":"/tmp/tmp/tmp"}}
{"time":"2025-06-20T17:05:10.411025673+02:00","level":"INFO","msg":"sync plan","syncer":{"amount":1,"cache-size-after-sync":"58.4MiB"}}
┌─────────┬─────────────────────────────────────────────────────────────────────────────────┬─────────┬──────────┐
│   ID    │                                      PATH                                       │  SIZE   │  ACTION  │
├─────────┼─────────────────────────────────────────────────────────────────────────────────┼─────────┼──────────┤
│ 0.13.11 │ metal-stack/metal-hammer/releases/download/v0.13.11/metal-hammer-initrd.img.lz4 │ 61.24MB │ download │
└─────────┴─────────────────────────────────────────────────────────────────────────────────┴─────────┴──────────┘
{"time":"2025-06-20T17:05:10.411515666+02:00","level":"INFO","msg":"downloading file","syncer":{"id":"0.13.11","key":"metal-stack/metal-hammer/releases/download/v0.13.11/metal-hammer-initrd.img.lz4","size":61241660,"to":"/tmp/tmp/tmp"}}
{"time":"2025-06-20T17:05:15.814912146+02:00","level":"INFO","msg":"downloading md5 checksum","syncer":{"id":"0.13.11","key":"metal-stack/metal-hammer/releases/download/v0.13.11/metal-hammer-initrd.img.lz4","to":"/tmp/boot-images/metal-stack/metal-hammer/releases/download/v0.13.11/metal-hammer-initrd.img.lz4.md5"}}
{"time":"2025-06-20T17:05:16.266958184+02:00","level":"INFO","msg":"scheduling next sync","at":"2025-06-20 17:10:00 +0200 CEST"}

The temporary output seems a bit weird though: "to":"/tmp/tmp/tmp"

Breaking Change

The metal-image-cache-sync has been migrated to the metal-stack V2 API. This means that it is no longer possible to connect to the metal-api, but instead to the new metal-apiserver, which was introduced in an earlier release. Please check the metal-roles release notes and adapt your deployment accordingly.

@majst01 majst01 self-assigned this Jun 20, 2025
@majst01
majst01 requested a review from Gerrit91 June 20, 2025 11:56
@majst01 majst01 moved this to Upcoming in Development Jun 20, 2025
Comment thread pkg/api/config.go
Comment thread cmd/main.go Outdated
Comment thread cmd/main.go Outdated
@Gerrit91 Gerrit91 moved this from Upcoming to In Progress in Development Oct 20, 2025
@Gerrit91 Gerrit91 moved this from In Progress to Upcoming in Development Oct 20, 2025
@Gerrit91 Gerrit91 changed the title Migrate to metal-apiserver Migrate to V2 API Aug 18, 2026
@Gerrit91
Gerrit91 marked this pull request as ready for review August 18, 2026 12:28
@Gerrit91
Gerrit91 requested a review from a team as a code owner August 18, 2026 12:28

@Gerrit91 Gerrit91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The temporary output seems a bit weird though: "to":"/tmp/tmp/tmp"

As no related code in this regard was changed, I will just merge. If this comes up in a real environment to, we might need to forward-fix this.

@Gerrit91
Gerrit91 merged commit b51ef3c into master Aug 18, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Upcoming to Done in Development Aug 18, 2026
@Gerrit91
Gerrit91 deleted the migrate-to-metal-apiserver branch August 18, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Migrate to MEP-4

2 participants