Skip to content

Switch default Windows image to windows-2022#6282

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mboersma:windows-2022-default
May 6, 2026
Merged

Switch default Windows image to windows-2022#6282
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mboersma:windows-2022-default

Conversation

@mboersma
Copy link
Copy Markdown
Contributor

@mboersma mboersma commented May 6, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Updates CAPZ's in-tree Windows defaults from windows-2019 to windows-2022. Windows Server 2019 entered extended support in Jan 2024 and we no longer publish 2019 reference images, so any user creating an AzureMachine without explicitly setting windowsServerVersion would land on a stale, no-longer-published image.

CI scripts (scripts/ci-e2e.sh, ci-conformance.sh, ci-entrypoint.sh) already export WINDOWS_SERVER_VERSION="${WINDOWS_SERVER_VERSION:-windows-2022}" and the existing [REQUIRED] HA Windows worker e2e is consistently green at 2022, so the risk profile is low.

Changes:

  • azure/defaults.go: DefaultWindowsGalleryImageName and DefaultWindowsOsAndVersion flipped to 2022
  • azure/services/virtualmachineimages/images.go: the year-substitution in GetDefaultWindowsImage no longer assumes the default name contains "2019". Switched the brittle strings.Replace(imageName, "2019", match[1], 1) to regexp.ReplaceAllString(imageName, "\d{4}", match[1]), so any future default-year flip won't require touching this code again.
  • test/e2e/helpers.go: the Windows version-intersection check in resolveKubernetesVersions now queries capi-win-2022-containerd (only runs when TEST_WINDOWS=true).

Intentionally not changed:

  • The deprecated marketplace fallback path for old Kubernetes versions (oldWindows2019Versions map and the windows-2019-containerd-gen1 SKU) — those are hardcoded for k8s ≤ 1.28.12 etc. and reflect what was published to the Azure Marketplace at the time.
  • Existing unit tests for windows-2019 osAndVersion in images_test.go and machine_test.go — they now serve as regression coverage for the explicit-override path.

Which issue(s) this PR fixes:
Fixes #5357

Special notes for your reviewer:

None.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

Switch default Windows image to windows-2022

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels May 6, 2026
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 6, 2026
@mboersma mboersma force-pushed the windows-2022-default branch from 2c9af12 to ca71a36 Compare May 6, 2026 15:18
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.95%. Comparing base (bd0f01b) to head (ca71a36).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6282   +/-   ##
=======================================
  Coverage   43.95%   43.95%           
=======================================
  Files         289      289           
  Lines       25351    25351           
=======================================
  Hits        11143    11143           
  Misses      13435    13435           
  Partials      773      773           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mboersma mboersma requested review from jackfrancis and removed request for jsturtevant May 6, 2026 15:24
@mboersma
Copy link
Copy Markdown
Contributor Author

mboersma commented May 6, 2026

/test pull-cluster-api-provider-azure-conformance-with-ci-artifacts

Copy link
Copy Markdown
Contributor

@willie-yao willie-yao left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: ce523f30bd4691bc4c79ea1eb5ca0e98041a5a64

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: willie-yao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2026
@k8s-ci-robot k8s-ci-robot merged commit 3c97271 into kubernetes-sigs:main May 6, 2026
20 of 24 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone May 6, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in CAPZ Planning May 6, 2026
@mboersma mboersma deleted the windows-2022-default branch May 7, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Switch to windows-2022 images by default and in e2e

3 participants