diff --git a/api/v1alpha1/nnf_datamovement_types.go b/api/v1alpha1/nnf_datamovement_types.go index 315a9c444..bb6dcd113 100644 --- a/api/v1alpha1/nnf_datamovement_types.go +++ b/api/v1alpha1/nnf_datamovement_types.go @@ -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 diff --git a/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml b/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml index 5c7e51286..c008b0528 100644 --- a/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml +++ b/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml @@ -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: diff --git a/internal/controller/nnf_workflow_controller.go b/internal/controller/nnf_workflow_controller.go index 2e7f6250b..0f0f1e9c3 100644 --- a/internal/controller/nnf_workflow_controller.go +++ b/internal/controller/nnf_workflow_controller.go @@ -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": @@ -690,6 +696,7 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo }, UserId: workflow.Spec.UserID, GroupId: workflow.Spec.GroupID, + Profile: dmProfile, }, } @@ -726,6 +733,7 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo }, UserId: workflow.Spec.UserID, GroupId: workflow.Spec.GroupID, + Profile: dmProfile, }, } diff --git a/internal/controller/nnf_workflow_controller_test.go b/internal/controller/nnf_workflow_controller_test.go index 76d6b9690..e4c206dc3 100644 --- a/internal/controller/nnf_workflow_controller_test.go +++ b/internal/controller/nnf_workflow_controller_test.go @@ -514,6 +514,8 @@ 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)) }) }) @@ -521,7 +523,7 @@ var _ = Describe("NNF Workflow Unit Tests", 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") @@ -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()