:= runtime.DefaultUnstructuredConverter.ToUnstructured(svc) if err != nil { return err } patch := &unstructured.Unstructured{ Object: obj, } var current corev1.Service err = r.Get(ctx, client.ObjectKey{Namespace: mdView.Namespace, Name: svcName}, ¤t) if err != nil && !errors.IsNotFound(err) { return err } currentSvc, err := corev1apply.ExtractService(¤t, constants.ControllerName) if err != nil { return err } if equality.Semantic.DeepEqual(svc, currentSvc) { return nil } err = r.Patch(ctx, patch, client.Apply, &client.PatchOptions{ FieldManager: constants.ControllerName, Force: pointer.Bool(true), })