Skip to content

Windows support PoC#1317

Open
makhov wants to merge 8 commits intok0sproject:v1beta2-api-versionfrom
makhov:windows-support
Open

Windows support PoC#1317
makhov wants to merge 8 commits intok0sproject:v1beta2-api-versionfrom
makhov:windows-support

Conversation

@makhov
Copy link
Contributor

@makhov makhov commented Dec 12, 2025

Windows workers support for bootstrap controller. It generates user-data as powershell script or AWS compatible "powershell-xml" format (which just wraps the powershell script in xml tags)

Note: this change introduce new spec.provisioner struct to let end-user decide which user-data format to use, which effectively deprecates spec.ignition and moves it to spec.provisioner.ignition

@makhov makhov force-pushed the windows-support branch 4 times, most recently from 0bde38c to c48a0f1 Compare December 29, 2025 10:01
@makhov makhov force-pushed the windows-support branch 4 times, most recently from b0ae235 to 3d710c2 Compare January 5, 2026 11:15
@makhov makhov marked this pull request as ready for review January 7, 2026 07:15
@makhov makhov requested a review from a team as a code owner January 7, 2026 07:15
Copy link
Contributor

@apedriza apedriza left a comment

Choose a reason for hiding this comment

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

wdyt about adding some flavor in the e2e for windows provisioning and use our current AWS nightly workflow?


// ProvisionerSpec defines the provisioner configuration.§
type ProvisionerSpec struct {
Type provisioner.ProvisioningFormat `json:"type,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

we could add +kubebuilder:validation:Enum for static validation about supported types

}

func getProvisioner(ignitionSpec *bootstrapv1.IgnitionSpec) provisioner.Provisioner {
func getProvisioner(provisionerSpec bootstrapv1.ProvisionerSpec, ignitionSpec *bootstrapv1.IgnitionSpec) provisioner.Provisioner {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about add some condition here or even some api/admission webhook validation to avoid set/instantiate a widnows provisioner for controller nodes? that way we fail earlier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

return []byte(content), nil
}

// GetFormat returns the format 'cloud-config' of the provisioner.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// GetFormat returns the format 'cloud-config' of the provisioner.
// GetFormat returns the format 'powershell' of the provisioner.

Comment on lines +122 to +125
return &provisioner.IgnitionProvisioner{
Variant: provisionerSpec.Ignition.Variant,
Version: provisionerSpec.Ignition.Version,
AdditionalConfig: provisionerSpec.Ignition.AdditionalConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible invalid memory address here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks!

@apedriza
Copy link
Contributor

apedriza commented Jan 7, 2026

Should we add some checks in code about from which k0s version windows provisioning is supported?

@apedriza
Copy link
Contributor

apedriza commented Jan 7, 2026

another doubt that I have is poweshell vs powershell-xml from my limited knowledge about windows. It is because some windows nodes cannot be provisioned using poweshell format, right? for that reason support for both alternatives?

@makhov
Copy link
Contributor Author

makhov commented Jan 7, 2026

another doubt that I have is poweshell vs powershell-xml from my limited knowledge about windows. It is because some windows nodes cannot be provisioned using poweshell format, right? for that reason support for both alternatives?

It's because different cloud providers support different formats. I wasn't able to test all of them, but cloudbase-init docs claim that they support plain powershell, EC2 format (powershell-xml) and cloud-init format:
https://cloudbase-init.readthedocs.io/en/latest/userdata.html

Should we add some checks in code about from which k0s version windows provisioning is supported?

Yeah, I tried to avoid adding validation webhook for K0sWorkerConfig, but considering number of checks we need - it's unavoidable :)

@apedriza
Copy link
Contributor

apedriza commented Jan 7, 2026

Yeah, I tried to avoid adding validation webhook for K0sWorkerConfig, but considering number of checks we need - it's unavoidable :)

Ive wrote one in this PR #1312 in case you want to reuse it or merge it first

@makhov makhov force-pushed the windows-support branch 11 times, most recently from 6ef709e to 18435c0 Compare January 12, 2026 11:28
// +kubebuilder:validation:Optional
// +kubebuilder:default="linux"
// +kubebuilder:validation:Enum=linux;windows
Platform string `json:"platform,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we infer the platform from the provisioner type and remove this field? if not, add a new admission rule to avoid an unsupported provider for the choosen platform I think can help.

Or maybe create a top-level field platform and specify there the platform provisioner, defaulting to platform.linux.cloud-init. Just thinking aloud

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cloud-init could be used both for windows and linux with RemoteMachines, so we can't reliably guess. I moved it to the provisioning section, is it better?

@makhov makhov changed the base branch from main to v1beta2-api-version February 13, 2026 20:37
@makhov makhov force-pushed the windows-support branch 3 times, most recently from f85130f to a9c606b Compare February 23, 2026 10:16
* v1beta2. wip

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/controller/controlplane/k0s_controlplane_controller_test.go

# Conflicts:
#	config/crd/bases/bootstrap/bootstrap.cluster.x-k8s.io_k0scontrollerconfigs.yaml
#	config/crd/bases/bootstrap/bootstrap.cluster.x-k8s.io_k0sworkerconfigs.yaml
#	config/crd/bases/bootstrap/bootstrap.cluster.x-k8s.io_k0sworkerconfigtemplates.yaml

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go

* v1beta2. controlplane api. wip

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/controller/controlplane/k0s_controlplane_controller_test.go

* v1beta2. controlplane api. wip

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/controller/controlplane/k0s_controlplane_controller_test.go

* v1beta2. linter fixes

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/controller/controlplane/k0s_controlplane_controller_test.go

* v1beta2 contracts

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	internal/controller/bootstrap/controlplane_bootstrap_controller_test.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/controller/controlplane/k0s_controlplane_controller_test.go

* v1beta2 contracts. printcolumns

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

* v1beta2 contracts. review fixes

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

* v1beta2 contracts. pointers everywhere

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

---------

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
# Conflicts:
#	api/bootstrap/v1beta1/k0s_types.go
#	api/controlplane/v1beta1/k0s_types.go
#	config/clusterapi/controlplane/crd/bases/controlplane.cluster.x-k8s.io_k0scontrolplanes.yaml
#	config/crd/controlplane.cluster.x-k8s.io_k0scontrolplanes.yaml
#	docs/resource-reference/controlplane.cluster.x-k8s.io-v1beta1.md
#	internal/controller/controlplane/k0s_controlplane_controller.go
#	inttest/util/util.go
@makhov makhov force-pushed the v1beta2-api-version branch from 1db9739 to 96078d0 Compare February 23, 2026 11:40
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	config/clusterapi/bootstrap/bases/bootstrap.cluster.x-k8s.io_k0sworkerconfigs.yaml
#	config/clusterapi/bootstrap/bases/bootstrap.cluster.x-k8s.io_k0sworkerconfigtemplates.yaml
#	config/crd/bases/bootstrap/bootstrap.cluster.x-k8s.io_k0sworkerconfigs.yaml
#	config/crd/bases/bootstrap/bootstrap.cluster.x-k8s.io_k0sworkerconfigtemplates.yaml
#	internal/controller/bootstrap/common.go
#	internal/controller/bootstrap/controlplane_bootstrap_controller.go
#	internal/controller/bootstrap/worker_bootstrap_controller.go
#	internal/controller/bootstrap/worker_bootstrap_controller_test.go
#	internal/provisioner/provisioner.go
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>

# Conflicts:
#	api/bootstrap/v1beta1/k0s_types.go
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
Signed-off-by: makhov <amakhov@mirantis.com>
Copy link
Contributor

@apedriza apedriza left a comment

Choose a reason for hiding this comment

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

I would like to final review this. @makhov can you rebase v1beta2 branch? I'm a bit confused with what belongs where. I recently rebase v1beta2 with main

@apedriza apedriza force-pushed the v1beta2-api-version branch 2 times, most recently from 7b8da8a to 2725e5a Compare March 5, 2026 16:33
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.

2 participants