Skip to content

Conversation

@dlipovetsky
Copy link
Contributor

@dlipovetsky dlipovetsky commented Nov 13, 2025

What problem does this PR solve?:
It is possible for some resource to exist, but a copy of it cannot be created. For example, CAPX validation became more strict without changing its API version. Templates already on the cluster remain usable. However, they cannot be copied, because the copy does not pass validation.

Prior to this change, we always copied the template, and ignored the "already exists" error. Now we first check if the template exist, and only create it if it does not.

Which issue(s) this PR fixes:
Fixes NCN-110980

How Has This Been Tested?:

New unit tests exercise the changes.

Special notes for your reviewer:

@dkoshkin
Copy link
Contributor

When a failure like this happens, does it prevent the rest of the resources from being copied or is this more about fixing the controller from continuously failing?

@dlipovetsky dlipovetsky marked this pull request as draft November 14, 2025 05:36
It is possible for some resource to exist, but a copy of it cannot be
created. For example, CAPX validation became more strict without
changing its API version. Templates already on the cluster remain
usable. However, they cannot be copied, because the copy does not pass
validation.

Prior to this change, we always copied the template, and ignored the
"already exists" error. Now we first check if the template exist, and
only create it if it does not.
@dlipovetsky dlipovetsky force-pushed the dlipovetsky/namespacesync-get-before-create branch from 18c472b to 2359a8c Compare December 1, 2025 21:01
@dlipovetsky
Copy link
Contributor Author

When a failure like this happens, does it prevent the rest of the resources from being copied or is this more about fixing the controller from continuously failing?

Good question. The failure does prevent the rest of the resources from being copied.

In practice, we have only seen this failure when attempting to copy (a second time) a ClusterClass that is already copied, but that cannot be copied again (due to a backward incompatible change in the CEL validation for the resource).

@dlipovetsky dlipovetsky marked this pull request as ready for review December 1, 2025 22:17
@github-actions github-actions bot added fix and removed fix labels Dec 5, 2025
@jimmidyson jimmidyson merged commit 93002a8 into main Jan 7, 2026
25 checks passed
@jimmidyson jimmidyson deleted the dlipovetsky/namespacesync-get-before-create branch January 7, 2026 16:23
@github-actions github-actions bot mentioned this pull request Jan 7, 2026
@github-actions github-actions bot added fix and removed fix labels Jan 7, 2026
dlipovetsky added a commit that referenced this pull request Jan 7, 2026
#1386)

**What problem does this PR solve?**:
It is possible for some resource to exist, but a copy of it cannot be
created. For example, CAPX validation became more strict without
changing its API version. Templates already on the cluster remain
usable. However, they cannot be copied, because the copy does not pass
validation.

Prior to this change, we always copied the template, and ignored the
"already exists" error. Now we first check if the template exist, and
only create it if it does not.

**Which issue(s) this PR fixes**:
Fixes NCN-110955

**How Has This Been Tested?**:
<!--
Please describe the tests that you ran to verify your changes.
Provide output from the tests and any manual steps needed to replicate
the tests.
-->
New unit tests exercise the changes.

**Special notes for your reviewer**:
<!--
Use this to provide any additional information to the reviewers.
This may include:
- Best way to review the PR.
- Where the author wants the most review attention on.
- etc.
-->

(cherry picked from commit 93002a8)
@dlipovetsky
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
release/v0.41.x

Questions ?

Please refer to the Backport tool documentation

kshitij-kumar-ngt added a commit that referenced this pull request Jan 10, 2026
🤖 I have created a release *beep* *boop*
---


## 0.42.0 (2026-01-08)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: Enable multus installation for Nutanix infra by
@kshitij-kumar-ngt in
#1445
### Fixes 🔧
* fix: update CoreDNS mapping file by @dkoshkin in
#1447
* fix: Copy ClusterClass and Templates only if they do not already exist
by @dlipovetsky in
#1386

## New Contributors
* @kshitij-kumar-ngt made their first contribution in
#1445

**Full Changelog**:
v0.41.3...v0.42.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants