Skip to content

Commit

Permalink
Profile support
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich committed Nov 15, 2023
1 parent 774a789 commit 7345e20
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/v1alpha1/nnf_datamovement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const (
// data movement. Individual nodes may also perform data movement in which case they use the
// NNF Node Name as the namespace.
DataMovementNamespace = "nnf-dm-system"

// The name of the default profile stored in the nnf-dm-config ConfigMap that is used to
// configure Data Movement.
DataMovementProfileDefault = "default"
)

// NnfDataMovementSpec defines the desired state of NnfDataMovement
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ spec:
operation.
format: int32
type: integer
profile:
default: default
description: Profile specifies the name of profile in the nnf-dm-config
ConfigMap to be used for configuring data movement. Defaults to
the default profile.
type: string
source:
description: Source describes the source of the data movement operation
properties:
Expand Down
8 changes: 8 additions & 0 deletions internal/controller/nnf_workflow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,12 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo
return path
}

// Use a non-default profile for data movement, if supplied
dmProfile, found := dwArgs["profile"]
if !found {
dmProfile = nnfv1alpha1.DataMovementProfileDefault
}

switch fsType {
case "xfs", "gfs2":

Expand Down Expand Up @@ -690,6 +696,7 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo
},
UserId: workflow.Spec.UserID,
GroupId: workflow.Spec.GroupID,
Profile: dmProfile,
},
}

Expand Down Expand Up @@ -726,6 +733,7 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo
},
UserId: workflow.Spec.UserID,
GroupId: workflow.Spec.GroupID,
Profile: dmProfile,
},
}

Expand Down
5 changes: 4 additions & 1 deletion internal/controller/nnf_workflow_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,16 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
"Name": Equal(fmt.Sprintf("%s-%d", workflow.Name, 0)),
"Namespace": Equal(workflow.Namespace),
}))

Expect(dm.Spec.Profile).To(Equal(nnfv1alpha1.DataMovementProfileDefault))
})
})

When("using $DW_PERSISTENT_ references", func() {
BeforeEach(func() {
workflow.Spec.DWDirectives = []string{
fmt.Sprintf("#DW persistentdw name=%s", persistentStorageName),
fmt.Sprintf("#DW copy_in source=/lus/maui/my-file.in destination=$DW_PERSISTENT_%s/my-persistent-file.out", strings.ReplaceAll(persistentStorageName, "-", "_")),
fmt.Sprintf("#DW copy_in source=/lus/maui/my-file.in profile=test destination=$DW_PERSISTENT_%s/my-persistent-file.out", strings.ReplaceAll(persistentStorageName, "-", "_")),
}

createPersistentStorageInstance(persistentStorageName, "lustre")
Expand Down Expand Up @@ -581,6 +583,7 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
"Name": Equal(persistentStorageName),
"Namespace": Equal(workflow.Namespace),
}))
Expect(dm.Spec.Profile).To(Equal("test"))
})
})
}) // When("Using copy_in directives", func()
Expand Down

0 comments on commit 7345e20

Please sign in to comment.