Aleksei Sviridkin 7bf48125ca fix(cluster-api): pin the ConfigMap version in every provider selector (#5400)
## What this PR does

Closes #5394.

capi-operator v0.30 lists every ConfigMap a provider's
`fetchConfig.selector` matches and returns an error when more than one
comes back, before it reads `spec.version`
(`processProviderConfigMaps`). Five of the six provider packages here
selected their bundle on a provider-kind label alone, so a version bump
— which renames the ConfigMap — left the old and the new ConfigMap
matching for the length of the Helm upgrade and failed that reconcile.
Helm deletes the old one in the same upgrade, so the next reconcile
succeeds: an error window rather than data loss, but one that hits every
upgrade of those providers.

`capi-providers-core` and the kubeadm half of `capi-providers-bootstrap`
already put `provider.cluster.x-k8s.io/version` on the ConfigMap and in
the selector. This does the same for the remaining five pairs:

| package | provider | version pinned |
|---|---|---|
| `capi-providers-bootstrap` | talos | `v0.6.13-bootstrap-talos` |
| `capi-providers-infraprovider` | kubevirt | `v0.1.10-infraprovider` |
| `capi-providers-infraprovider-proxmox` | proxmox |
`v0.7.7-infraprovider-proxmox` |
| `capi-providers-cpprovider` | kamaji | `v0.19.0-cozystack.0` |
| `capi-providers-ipam-in-cluster` | in-cluster |
`v1.0.3-ipam-in-cluster` |

The kind label each package already had (`infraprovider-provider`,
`cp-components`, `ipamprovider-provider`, `bootstrap-provider`) stays:
it is what keeps one provider's bundle out of another's selector, and it
is unrelated to the version match.

The comment in the Proxmox ConfigMap said the operator would still
install the right one because it keys every matched ConfigMap by name.
That is not what v0.30 does any more — it rejects the multiple match
outright — so the comment is replaced with what the operator does now,
and the reason the version label is there.

## Verification

New asserts in `hack/capi-provider-components_test.bats`, run with bats
1.14.0 and helm 3.19.0:

- `every provider selector pins the ConfigMap version` — for each of the
five packages plus core: exactly one provider object and one compressed
bundle render, the bundle's `provider.cluster.x-k8s.io/version` label is
non-empty, and both the selector and `spec.version` carry that same
value.
- `an upgrade with the previous ConfigMap present still matches one
bundle` — synthesises the upgrade window by adding the previous
release's bundle beside the rendered one; the selector has to keep
matching exactly one object.
- `the double-match fixture fails when the version label is removed` —
the negative control: with the version label dropped from both the
selector and the ConfigMap copy, that same fixture has to match two, so
the assertion above is known to be able to fail.
- `both bootstrap providers pin their own ConfigMap version` — the Talos
pair, which the single-provider helper cannot cover.

```
$ bats hack/capi-provider-components_test.bats
ok 25 every provider selector pins the ConfigMap version
ok 26 an upgrade with the previous ConfigMap present still matches one bundle
ok 27 the double-match fixture fails when the version label is removed
ok 28 both bootstrap providers pin their own ConfigMap version
```

A/B: with the template changes stashed and the tests kept, all four new
asserts fail (`selector does not pin the ConfigMap version`, `an upgrade
matches more than one ConfigMap`, `talos does not select exactly one
bundle`); restored, they pass.

Also run, unchanged by this PR:

- `bats hack/capi-upgrade-chart_test.bats` — 16/16
- `bats hack/capi-upgrade_test.bats` — 44/44
- `bats hack/capk-provider_test.bats` — 4/4
- `bats hack/bats-no-negated-assert.bats`, `bats-strict-setup.bats`,
`bats-no-exit-trap.bats` — 10/10, 19/19, 22/22
- `make -C packages/system/capi-providers-bootstrap test` (helm-unittest
1.1.2) — 9/9
- `bash hack/check-commit-trailers.sh origin/main..HEAD` — OK
- `python3 hack/check-helm-document-indices.py main` — clean
- `git diff --check` — clean

Not covered locally: 8 asserts in
`hack/capi-provider-components_test.bats` fail on this machine both
before and after this change, all with `sed: illegal option -- -` —
`check_sums` / `check_patched_sums` use GNU `sed --quiet`, which is not
POSIX and not present in macOS's BSD sed. They are unrelated to this
diff and pass in CI on Linux. No full ctest/Go build was needed: the
change is Helm templates and bats only.

## Downstream repositories

No downstream repository is affected. This changes the labels and
selectors inside five `packages/system/` charts; nothing in
`cozystack/website`, `terraform-provider-cozystack`,
`ansible-cozystack`, `ccp`, `talm`, `cozyhr`, `cozy-proxy`,
`cozystack-telemetry-server`, `external-apps-example`, `examples` or
`community` reads those label keys or restates these templates.
`packages/system/` is not imported into the website's managed-apps
reference, and no values key, schema, or release-notes convention
changes.

```release-note
fix(cluster-api): pin the ConfigMap version in every provider selector

Bumping the Talos bootstrap, KubeVirt, Kamaji, Proxmox or in-cluster IPAM provider left its old and new components ConfigMap both matching the provider's selector for the length of the Helm upgrade, which capi-operator v0.30 rejects with "multiple ConfigMaps match selector". Each selector now carries `provider.cluster.x-k8s.io/version`, as the core and kubeadm providers already did, so an upgrade matches exactly one bundle.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Provider configurations now select the components bundle matching
their version, avoiding ambiguous matches when older and newer bundles
coexist during upgrades.
* Bootstrap providers now select their own version-specific bundle, so
each provider uses the correct components configuration.
* Provider and bundle versions remain aligned across supported
infrastructure, IPAM, control-plane, and bootstrap providers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-12-02 08:08:15 +03:00
2026-11-04 00:56:56 +01:00
2025-10-08 09:43:34 +05:00
2024-02-08 12:04:32 +01:00

Cozystack Cozystack

GitHub Release Apache-2.0 License Commit activity OpenSSF Best Practices OpenSSF Scorecard CLOMonitor Support

Cozystack

Cozystack is a free and open-source platform and framework for building clouds.

Cozystack is a CNCF Sandbox project that was originally built and sponsored by Ænix.

With Cozystack, you can transform a bunch of servers into an intelligent system with a simple REST API for spawning Kubernetes clusters, Database-as-a-Service, virtual machines, load balancers, HTTP caching services, and other services with ease.

Use Cozystack to build your own cloud or provide a cost-effective development environment.

Cozystack user interface

Use-Cases

Documentation

The documentation is located on the cozystack.io website.

Read the Getting Started section for a quick start.

If you encounter any difficulties, start with the troubleshooting guide and work your way through the process that we've outlined.

Versioning

Versioning adheres to the Semantic Versioning principles.
A full list of the available releases is available in the GitHub repository's Release section.

Contributions

Contributions are highly appreciated and very welcomed!

In case of bugs, please check if the issue has already been opened by checking the GitHub Issues section. If it isn't, you can open a new one. A detailed report will help us replicate it, assess it, and work on a fix.

You are welcome to take on the fix yourself. Commits are used to generate the changelog, and their author will be referenced in it.

If you have a concrete feature request, open an issue. For a cross-cutting or architectural change, open a design proposal in the community repo. For questions or early ideas, use GitHub Discussions. See CONTRIBUTING.md for the full routing.

Community

You are welcome to join us in #cozystack, on either CNCF Slack (get an invite) or Kubernetes Slack (get an invite), in our Telegram group, and at our community meetings. Add them to your Google Calendar or iCal for convenience.

Project documents

Document What it covers
Governance How decisions are made and who makes them
Contributor Ladder How to grow from contributor to maintainer
Maintainers Who maintains the project
Code of Conduct What we expect of each other
Security Policy Reporting a vulnerability, and which releases get fixes
Adopters Who runs Cozystack in production
Roadmap Where the project is going

License

Cozystack is licensed under Apache 2.0.
The code is provided as-is with no warranties.

Commercial Support

A list of companies providing commercial support for this project can be found on official site.

Languages
Go 53.3%
Shell 33.1%
TypeScript 6.6%
Go Template 4.7%
Makefile 1.2%
Other 1%