@@ -146,9 +146,9 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
146146 }
147147
148148 workflowLength := len (instance .Spec .Workflow )
149- nextAction , nextWorkflowStep , err := r .NextAction (ctx , instance , workflowLength )
150- if nextWorkflowStep < workflowLength {
151- MergeSections (& instance .Spec , instance .Spec .Workflow [nextWorkflowStep ])
149+ nextAction , workflowStepIndex , err := r .NextAction (ctx , instance , workflowLength )
150+ if workflowStepIndex < workflowLength {
151+ MergeSections (& instance .Spec , instance .Spec .Workflow [workflowStepIndex ])
152152 }
153153
154154 switch nextAction {
@@ -185,7 +185,7 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
185185 return ctrl.Result {RequeueAfter : RequeueAfterValue }, err
186186 }
187187
188- Log .Info (fmt .Sprintf (InfoCreatingFirstPod , nextWorkflowStep ))
188+ Log .Info (fmt .Sprintf (InfoCreatingFirstPod , workflowStepIndex ))
189189
190190 case CreateNextPod :
191191 // Confirm that we still hold the lock. This is useful to check if for
@@ -197,23 +197,23 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
197197 return ctrl.Result {RequeueAfter : RequeueAfterValue }, err
198198 }
199199
200- Log .Info (fmt .Sprintf (InfoCreatingNextPod , nextWorkflowStep ))
200+ Log .Info (fmt .Sprintf (InfoCreatingNextPod , workflowStepIndex ))
201201
202202 default :
203203 return ctrl.Result {}, ErrReceivedUnexpectedAction
204204 }
205205
206206 serviceLabels := map [string ]string {
207207 common .AppSelector : tempest .ServiceName ,
208- workflowStepLabel : strconv .Itoa (nextWorkflowStep ),
208+ workflowStepLabel : strconv .Itoa (workflowStepIndex ),
209209 instanceNameLabel : instance .Name ,
210210 operatorNameLabel : "test-operator" ,
211211 }
212212
213- workflowStepNum := 0
213+ pvcIndex := 0
214214 // Create multiple PVCs for parallel execution
215- if instance .Spec .Parallel && nextWorkflowStep < len (instance .Spec .Workflow ) {
216- workflowStepNum = nextWorkflowStep
215+ if instance .Spec .Parallel && workflowStepIndex < len (instance .Spec .Workflow ) {
216+ pvcIndex = workflowStepIndex
217217 }
218218
219219 err = r .ValidateOpenstackInputs (ctx , instance , instance .Spec .OpenStackConfigMap , instance .Spec .OpenStackConfigSecret )
@@ -248,7 +248,7 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
248248 helper ,
249249 serviceLabels ,
250250 instance .Spec .StorageClass ,
251- workflowStepNum ,
251+ pvcIndex ,
252252 )
253253
254254 if err != nil {
@@ -259,7 +259,7 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
259259 // Create PersistentVolumeClaim - end
260260
261261 // Generate ConfigMaps
262- err = r .generateServiceConfigMaps (ctx , helper , instance , nextWorkflowStep )
262+ err = r .generateServiceConfigMaps (ctx , helper , instance , workflowStepIndex )
263263 if err != nil {
264264 instance .Status .Conditions .Set (condition .FalseCondition (
265265 condition .ServiceConfigReadyCondition ,
@@ -286,10 +286,10 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
286286
287287 // Create a new pod
288288 mountCerts := r .CheckSecretExists (ctx , instance , "combined-ca-bundle" )
289- customDataConfigMapName := GetCustomDataConfigMapName (instance , nextWorkflowStep )
290- EnvVarsConfigMapName := GetEnvVarsConfigMapName (instance , nextWorkflowStep )
291- podName := r .GetPodName (instance , nextWorkflowStep )
292- logsPVCName := r .GetPVCLogsName (instance , workflowStepNum )
289+ customDataConfigMapName := GetCustomDataConfigMapName (instance , workflowStepIndex )
290+ EnvVarsConfigMapName := GetEnvVarsConfigMapName (instance , workflowStepIndex )
291+ podName := r .GetPodName (instance , workflowStepIndex )
292+ logsPVCName := r .GetPVCLogsName (instance , pvcIndex )
293293 containerImage , err := r .GetContainerImage (ctx , instance )
294294 if err != nil {
295295 return ctrl.Result {}, err
@@ -341,7 +341,7 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
341341 instance ,
342342 instance .Spec .NetworkAttachments ,
343343 serviceLabels ,
344- nextWorkflowStep ,
344+ workflowStepIndex ,
345345 & instance .Status .Conditions ,
346346 & instance .Status .NetworkAttachments ,
347347 )
@@ -385,7 +385,7 @@ func (r *TempestReconciler) SetupWithManager(mgr ctrl.Manager) error {
385385func (r * TempestReconciler ) setTempestConfigVars (envVars map [string ]string ,
386386 customData map [string ]string ,
387387 instance * testv1beta1.Tempest ,
388- workflowStepNum int ,
388+ workflowStepIndex int ,
389389) {
390390 tRun := instance .Spec .TempestRun
391391
@@ -421,7 +421,7 @@ func (r *TempestReconciler) setTempestConfigVars(envVars map[string]string,
421421 })
422422 }
423423
424- envVars ["TEMPEST_WORKFLOW_STEP_DIR_NAME" ] = r .GetPodName (instance , workflowStepNum )
424+ envVars ["TEMPEST_WORKFLOW_STEP_DIR_NAME" ] = r .GetPodName (instance , workflowStepIndex )
425425
426426 for _ , img := range tRun .ExtraImages {
427427 SetDictEnvVar (envVars , map [string ]string {
@@ -509,7 +509,7 @@ func (r *TempestReconciler) generateServiceConfigMaps(
509509 ctx context.Context ,
510510 h * helper.Helper ,
511511 instance * testv1beta1.Tempest ,
512- workflowStepNum int ,
512+ workflowStepIndex int ,
513513) error {
514514 // Create/update configmaps from template
515515 cmLabels := labels .GetLabels (instance , labels .GetGroupLabel (tempest .ServiceName ), map [string ]string {})
@@ -528,7 +528,7 @@ func (r *TempestReconciler) generateServiceConfigMaps(
528528 customData := make (map [string ]string )
529529 envVars := make (map [string ]string )
530530
531- r .setTempestConfigVars (envVars , customData , instance , workflowStepNum )
531+ r .setTempestConfigVars (envVars , customData , instance , workflowStepIndex )
532532 r .setTempestconfConfigVars (envVars , customData , instance )
533533
534534 for key , data := range instance .Spec .ConfigOverwrite {
@@ -544,7 +544,7 @@ func (r *TempestReconciler) generateServiceConfigMaps(
544544 cms := []util.Template {
545545 // ConfigMap
546546 {
547- Name : GetCustomDataConfigMapName (instance , workflowStepNum ),
547+ Name : GetCustomDataConfigMapName (instance , workflowStepIndex ),
548548 Namespace : instance .Namespace ,
549549 InstanceType : instance .Kind ,
550550 Labels : cmLabels ,
@@ -553,7 +553,7 @@ func (r *TempestReconciler) generateServiceConfigMaps(
553553 },
554554 // configMap - EnvVars
555555 {
556- Name : GetEnvVarsConfigMapName (instance , workflowStepNum ),
556+ Name : GetEnvVarsConfigMapName (instance , workflowStepIndex ),
557557 Namespace : instance .Namespace ,
558558 InstanceType : instance .Kind ,
559559 Labels : cmLabels ,
@@ -566,11 +566,11 @@ func (r *TempestReconciler) generateServiceConfigMaps(
566566}
567567
568568// GetEnvVarsConfigMapName returns the name of the environment variables ConfigMap for the given workflow step
569- func GetEnvVarsConfigMapName (instance * testv1beta1.Tempest , workflowStepNum int ) string {
570- return instance .Name + envVarsConfigMapInfix + strconv .Itoa (workflowStepNum )
569+ func GetEnvVarsConfigMapName (instance * testv1beta1.Tempest , workflowStepIndex int ) string {
570+ return instance .Name + envVarsConfigMapInfix + strconv .Itoa (workflowStepIndex )
571571}
572572
573573// GetCustomDataConfigMapName returns the name of the custom data ConfigMap for the given workflow step
574- func GetCustomDataConfigMapName (instance * testv1beta1.Tempest , workflowStepNum int ) string {
575- return instance .Name + customDataConfigMapInfix + strconv .Itoa (workflowStepNum )
574+ func GetCustomDataConfigMapName (instance * testv1beta1.Tempest , workflowStepIndex int ) string {
575+ return instance .Name + customDataConfigMapInfix + strconv .Itoa (workflowStepIndex )
576576}
0 commit comments