fix deep equal check failure in CreateOrUpdateWork(), by replace the marshaler

Signed-off-by: zach593 <zach_li@outlook.com>
This commit is contained in:
zach593 2024-12-11 22:56:14 +08:00
parent 8313813f76
commit ce1ca9912f
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package ctrlutil
import (
"context"
"encoding/json"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -48,7 +49,7 @@ func CreateOrUpdateWork(ctx context.Context, client client.Client, workMeta meta
}
}
workloadJSON, err := resource.MarshalJSON()
workloadJSON, err := json.Marshal(resource)
if err != nil {
klog.Errorf("Failed to marshal workload(%s/%s), error: %v", resource.GetNamespace(), resource.GetName(), err)
return err