From 32e3e47582aebad108737b8c5289c2d2384757c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Caama=C3=B1o=20Ruiz?= Date: Thu, 21 Sep 2023 18:11:31 +0000 Subject: [PATCH] Fix config status MTU migration not being updated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render has side effects in the passed in operConfig that are reflected later on in the status when it is being updated. This stopped working when the the passed in operConfig was changed to a copy that was not then used when applying the status. It makes sense to use the updated operConfig for everything that comes after, not just Render, so change that to fix the issue. Fixes: https://github.com/openshift/cluster-network-operator/pull/1952 Signed-off-by: Jaime CaamaƱo Ruiz --- pkg/controller/operconfig/operconfig_controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/controller/operconfig/operconfig_controller.go b/pkg/controller/operconfig/operconfig_controller.go index a5ce3e963b..541ca7bc28 100644 --- a/pkg/controller/operconfig/operconfig_controller.go +++ b/pkg/controller/operconfig/operconfig_controller.go @@ -343,8 +343,13 @@ func (r *ReconcileOperConfig) Reconcile(ctx context.Context, request reconcile.R } } - // Generate the objects - objs, progressing, err := network.Render(&newOperConfig.Spec, bootstrapResult, ManifestPath, r.client, r.featureGates) + // once updated, use the new config + operConfig = newOperConfig + + // Generate the objects. + // Note that Render might have side effects in the passed in operConfig that + // will be reflected later on in the updated status. + objs, progressing, err := network.Render(&operConfig.Spec, bootstrapResult, ManifestPath, r.client, r.featureGates) if err != nil { log.Printf("Failed to render: %v", err) r.status.SetDegraded(statusmanager.OperatorConfig, "RenderError",