You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add more context to MetalLB config apply conflict errors (#1232)
**What problem does this PR solve?**:
Backport of #1225
When there is a conflict writing the MetalLB configuration, we want to
give more information to the user.
**Which issue(s) this PR fixes**:
Fixes https://jira.nutanix.com/browse/NCN-107584
**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.
-->
**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. -->
---------
**What problem does this PR solve?**:
**Which issue(s) this PR fixes**:
Fixes #
**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.
-->
**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.
-->
Co-authored-by: Jimmi Dyson <jimmidyson@gmail.com>
returnfmt.Errorf("failed to generate MetalLB configuration: %w", err)
142
144
}
@@ -160,6 +162,21 @@ func (n *MetalLB) Apply(
160
162
},
161
163
},
162
164
); err!=nil {
165
+
ifapierrors.IsConflict(err) {
166
+
switcho.GetKind() {
167
+
case"IPAddressPool":
168
+
err=fmt.Errorf(
169
+
"%w. This resource has been modified in the workload cluster: it must contain exactly the addresses listed in the Cluster configuration", //nolint:lll // Long error message,
170
+
err,
171
+
)
172
+
case"L2Advertisement":
173
+
err=fmt.Errorf(
174
+
"%w. This resource has been modified in the workload cluster, it must only contain the %q IP Address Pool", //nolint:lll // Long error message,
175
+
err,
176
+
configInput.Name,
177
+
)
178
+
}
179
+
}
163
180
applyErr=fmt.Errorf(
164
181
"failed to apply MetalLB configuration %s %s: %w",
0 commit comments