Skip to content

Support CAPI in-place version updates#1332

Open
apedriza wants to merge 2 commits intok0sproject:mainfrom
apedriza:inplace-upgrades
Open

Support CAPI in-place version updates#1332
apedriza wants to merge 2 commits intok0sproject:mainfrom
apedriza:inplace-upgrades

Conversation

@apedriza
Copy link
Copy Markdown
Contributor

@apedriza apedriza commented Jan 14, 2026

fix #1307

@apedriza apedriza changed the title Support CAPI in-place version updates WIP: Support CAPI in-place version updates Jan 14, 2026
@apedriza apedriza force-pushed the inplace-upgrades branch 16 times, most recently from 79562f1 to 69fc056 Compare January 19, 2026 15:58
@apedriza apedriza force-pushed the inplace-upgrades branch 2 times, most recently from fbd9464 to fdcbd9c Compare January 26, 2026 14:53
@apedriza apedriza force-pushed the inplace-upgrades branch 2 times, most recently from ddab6e4 to 5719058 Compare February 27, 2026 12:42
@apedriza apedriza changed the title WIP: Support CAPI in-place version updates Support CAPI in-place version updates Feb 27, 2026
@apedriza apedriza marked this pull request as ready for review February 27, 2026 14:03
@apedriza apedriza requested a review from a team as a code owner February 27, 2026 14:03
// TODO: use DownloadURL from K0sControllerConfig/K0sWorkerConfig when available
amd64DownloadURL := `https://get.k0sproject.io/` + desiredMachine.Spec.Version + `/k0s-` + desiredMachine.Spec.Version + `-amd64`
arm64DownloadURL := `https://get.k0sproject.io/` + desiredMachine.Spec.Version + `/k0s-` + desiredMachine.Spec.Version + `-arm64`
armDownloadURL := `https://get.k0sproject.io/` + desiredMachine.Spec.Version + `/k0s-` + desiredMachine.Spec.Version + `-arm`
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.

we should add and respect downloadURL as we do for control planes now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added the downloadurl from the config associated to the machine

}
}

func DoCanUpdateMachine(ctx context.Context, req *runtimehooksv1.CanUpdateMachineRequest, resp *runtimehooksv1.CanUpdateMachineResponse) {
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.

should we somehow check that workers can be updated only after controllers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mm I guess that is the general assumption for cluster updates in k8s

"` + target + `": {
"discovery": {
"static": {
"nodes": ["` + desiredMachine.Name + `"]
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.

I don't really like the idea that we're creating a Plan per machine, but looks like this is how that Extension works. In future we might think and detect a higher object (like Cluster) changes and update the whole cluster at once

Copy link
Copy Markdown
Contributor Author

@apedriza apedriza Mar 26, 2026

Choose a reason for hiding this comment

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

agree, we should try to combine k0s plan declaring multiple nodes with this upgrade extension. We can think about it in the future but I dont know how from capi controllers POV this case can be done..mm

type: RuntimeExtensionProvider
versions:
- name: v1.10.99 # next; use manifest from source files
value: ../../extension/config/default
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.

A typo in extensions ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ive removed aws configuration, we have docker infra atm


func isCAPIVersionSuitableForInplaceUpdate(ctx context.Context, c client.Client) (bool, error) {
var capiProvider clusterctlv1.Provider
err := c.Get(ctx, client.ObjectKey{Name: clusterctlconfig.ClusterAPIProviderName, Namespace: "capi-system"}, &capiProvider)
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.

We need to check, there is a chance that k0rdent installs everything including CAPI providers and objects in kcm-system namespace, not standard capi-system

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed logic to list core providers in the cluster instead retrieve it from capi-system

Signed-off-by: apedriza <adripedriza@gmail.com>
Signed-off-by: apedriza <adripedriza@gmail.com>
@apedriza apedriza requested a review from makhov March 31, 2026 08:20
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 CAPI in-place upgrades in k0smotron

2 participants