@@ -72,6 +72,14 @@ func populateFn(ctx context.Context, params populatorMachinery.PopulatorParams)
72
72
// Implement the provider-specific logic to initiate volume population.
73
73
// This may involve calling cloud-native APIs or creating temporary Kubernetes resources
74
74
// such as Pods or Jobs for data transfer.
75
+
76
+ // Example steps:
77
+ // 1. Retrieve data source details from the defined CRD.
78
+ // 2. Initiate a data transfer job to params.PvcPrime using params.KubeClient.
79
+ // 3. Report the volume population status to the original PVC's through params.Recorder.
80
+ // 4. You should check if the transfer job already exists before creating it, otherwise the transfer job might
81
+ // get created multiple times if everytime you use a unique name.
82
+
75
83
klog .Infof ("Run populateFn" )
76
84
return nil
77
85
}
@@ -80,13 +88,27 @@ func populateCompleteFn(ctx context.Context, params populatorMachinery.Populator
80
88
// Implement the provider-specific logic to determine the status of volume population.
81
89
// This may involve calling cloud-native APIs or checking the completion status of
82
90
// temporary Kubernetes resources like Pods or Jobs.
91
+
92
+ // Example steps:
93
+ // 1. Fetch the transfer job using params.KubeClient.
94
+ // 2. Verify if the job has finished successfully (returns true) or is still running (returns false).
95
+ // 3. If the transfer job encountered an error, evaluate the need for cleanup.
96
+ // 4. Report the volume population status to the original PVC through params.Recorder.
97
+
83
98
klog .Infof ("Run populateCompleteFn" )
84
99
return true , nil
85
100
}
86
101
87
102
func populateCleanupFn (ctx context.Context , params populatorMachinery.PopulatorParams ) error {
88
103
// Implement the provider-specific logic to clean up any temporary resources
89
- // that were created during the volume population process.
104
+ // that were created during the volume population process. This step happens after PV rebind to the original PVC
105
+ // and before the PVC' gets deleted.
106
+
107
+ // Example steps:
108
+ // 1. Fetch the transfer job using params.KubeClient.
109
+ // 2. If the transfer job still exists delete the job.
110
+ // 3. Report the volume population status to the original PVC through params.Recorder.
111
+
90
112
klog .Infof ("Run populateCleanupFn" )
91
113
return nil
92
114
}
0 commit comments