@@ -72,6 +72,14 @@ func populateFn(ctx context.Context, params populatorMachinery.PopulatorParams)
7272 // Implement the provider-specific logic to initiate volume population.
7373 // This may involve calling cloud-native APIs or creating temporary Kubernetes resources
7474 // 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+
7583 klog .Infof ("Run populateFn" )
7684 return nil
7785}
@@ -80,13 +88,27 @@ func populateCompleteFn(ctx context.Context, params populatorMachinery.Populator
8088 // Implement the provider-specific logic to determine the status of volume population.
8189 // This may involve calling cloud-native APIs or checking the completion status of
8290 // 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+
8398 klog .Infof ("Run populateCompleteFn" )
8499 return true , nil
85100}
86101
87102func populateCleanupFn (ctx context.Context , params populatorMachinery.PopulatorParams ) error {
88103 // 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+
90112 klog .Infof ("Run populateCleanupFn" )
91113 return nil
92114}
0 commit comments