fix: preserve Service spec fields including NodePort information

This commit is contained in:
loveuer
2025-11-13 14:49:18 +08:00
parent a632f68c29
commit 488c7b90bf

View File

@@ -581,6 +581,7 @@ func K8sResourceFetch(ctx context.Context, db *gorm.DB, store store.Store) fiber
service.CreationTimestamp = metav1.Time{} service.CreationTimestamp = metav1.Time{}
service.SelfLink = "" service.SelfLink = ""
service.Generation = 0 service.Generation = 0
// Don't clean spec fields as they contain important information like NodePort
yamlData, err = yaml.Marshal(service) yamlData, err = yaml.Marshal(service)
case "ConfigMap": case "ConfigMap":
var configmap *corev1.ConfigMap var configmap *corev1.ConfigMap