Skip to content

Commit 7707bfa

Browse files
authored
> fix nfs dataset pvc/pv bound incorrect (#2)
1 parent 58af574 commit 7707bfa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: internal/controller/dataset/dataset_controller.go

+5
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func (r *DatasetReconciler) reconcilePVC(ctx context.Context, ds *datasetv1alpha
184184

185185
forceStorageClass := ""
186186
var spec *corev1.PersistentVolumeClaimSpec
187+
volumeNameOverride := ""
187188

188189
switch ds.Spec.Source.Type {
189190
case datasetv1alpha1.DatasetTypeReference:
@@ -379,6 +380,7 @@ spec:
379380
}
380381
// 标记 ds.Status.LastSucceedRound = ds.Spec.DataSyncRound
381382
ds.Status.LastSucceedRound = ds.Spec.DataSyncRound
383+
volumeNameOverride = pvTemp.Name
382384
default:
383385
// 其他类型先不做特殊逻辑
384386
}
@@ -434,6 +436,9 @@ spec:
434436
spec.StorageClassName = lo.ToPtr(forceStorageClass)
435437
}
436438
}
439+
if volumeNameOverride != "" {
440+
spec.VolumeName = volumeNameOverride
441+
}
437442

438443
if k8serrors.IsNotFound(err) {
439444
// 不存在就创建

0 commit comments

Comments
 (0)