Skip to content

Commit 688e174

Browse files
committed
chore: update patchOpenStackCluster to modify only apiServerFixedIP and apiServerPort in spec
Fixed an issue in patchOpenStackCluster where the previous implementation would overwrite the entire spec with just the apiServerFixedIP and apiServerPort fields, rather than updating only these specific fields.
1 parent d9b9220 commit 688e174

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

controllers/kamajicontrolplane_controller_cluster_patch.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,12 @@ func (r *KamajiControlPlaneReconciler) patchOpenStackCluster(ctx context.Context
226226
return errors.Wrap(err, "unable to create patch helper")
227227
}
228228

229-
if err = unstructured.SetNestedMap(osc.Object, map[string]interface{}{
230-
"apiServerFixedIP": endpoint,
231-
"apiServerPort": port,
232-
}, "spec"); err != nil {
233-
return errors.Wrap(err, fmt.Sprintf("unable to set unstructured %s spec patch", osc.GetKind()))
229+
if err = unstructured.SetNestedField(osc.Object, endpoint, "spec", "apiServerFixedIP"); err != nil {
230+
return errors.Wrap(err, fmt.Sprintf("unable to set unstructured %s spec apiServerFixedIP", osc.GetKind()))
231+
}
232+
233+
if err = unstructured.SetNestedField(osc.Object, port, "spec", "apiServerPort"); err != nil {
234+
return errors.Wrap(err, fmt.Sprintf("unable to set unstructured %s spec apiServerPort", osc.GetKind()))
234235
}
235236

236237
if err = patchHelper.Patch(ctx, &osc); err != nil {

0 commit comments

Comments
 (0)