Skip to content

Commit

Permalink
Check Data Movement Manager for Ready Flag for DataIn/DataOut (#238)
Browse files Browse the repository at this point in the history
- Add check in DataIn/DataOut and requeue when DMM is not ready
- Remove omitempty from ddm ready flag so this shows up as false when not
ready.
- RBAC fix
- Accidentally dropped GetStatus() when rebasing last PR, so added that back

Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich authored Nov 14, 2023
1 parent cffd3ca commit 1a62f95
Show file tree
Hide file tree
Showing 46 changed files with 1,313 additions and 535 deletions.
8 changes: 3 additions & 5 deletions api/v1alpha1/nnf_datamovement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

const (
// The required namespace for an NNF Data Movement operation. This is for system wide (lustre) data movement.
// Individual nodes may also perform data movement in which case they use the NNF Node Name as the namespace.
// The required namespace for an NNF Data Movement operation. This is for system wide (lustre)
// 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"
)

Expand Down
13 changes: 12 additions & 1 deletion api/v1alpha1/nnf_datamovementmanager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/DataWorkflowServices/dws/utils/updater"
)

const (
DataMovementWorkerLabel = "dm.cray.hpe.com/worker"

// The name of the expected Data Movement manager. This is to ensure Data Movement is ready in
// the DataIn/DataOut stages before attempting data movement operations.
DataMovementManagerName = "nnf-dm-manager-controller-manager"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand Down Expand Up @@ -58,7 +64,8 @@ type NnfDataMovementManagerStatus struct {

// Ready indicates that the Data Movement Manager has achieved the desired readiness state
// and all managed resources are initialized.
Ready bool `json:"ready,omitempty"`
// +kubebuilder:default:=false
Ready bool `json:"ready"`
}

//+kubebuilder:object:root=true
Expand All @@ -75,6 +82,10 @@ type NnfDataMovementManager struct {
Status NnfDataMovementManagerStatus `json:"status,omitempty"`
}

func (m *NnfDataMovementManager) GetStatus() updater.Status[*NnfDataMovementManagerStatus] {
return &m.Status
}

//+kubebuilder:object:root=true

// NnfDataMovementManagerList contains a list of NnfDataMovementManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7637,9 +7637,12 @@ spec:
NnfDataMovementManager
properties:
ready:
default: false
description: Ready indicates that the Data Movement Manager has achieved
the desired readiness state and all managed resources are initialized.
type: boolean
required:
- ready
type: object
type: object
served: true
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ require (
github.com/NearNodeFlash/nnf-ec v0.0.0-20231010162453-a8168bb6a52f
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.4
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/kubeflow/common v0.4.6
github.com/kubeflow/mpi-operator v0.3.1-0.20230228224311-5946ef415759
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/prometheus/client_golang v1.16.0
go.openly.dev/pointy v1.3.0
go.uber.org/zap v1.25.0
golang.org/x/sync v0.2.0
golang.org/x/sync v0.3.0
k8s.io/api v0.28.1
k8s.io/apimachinery v0.28.1
k8s.io/client-go v0.28.1
Expand Down Expand Up @@ -52,7 +52,7 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20221103000818-d260c55eee4c // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.0 // indirect
Expand All @@ -79,14 +79,14 @@ require (
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.13.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.3 // indirect
golang.org/x/tools v0.10.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8-0.20221117013220-504804fb50de // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
35 changes: 17 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/pprof v0.0.0-20221103000818-d260c55eee4c h1:lvddKcYTQ545ADhBujtIJmqQrZBDsGo7XIMbAQe/sNY=
github.com/google/pprof v0.0.0-20221103000818-d260c55eee4c/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down Expand Up @@ -251,7 +251,7 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -276,8 +276,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -294,16 +294,16 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand All @@ -315,8 +315,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -348,8 +348,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -362,7 +362,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
32 changes: 31 additions & 1 deletion internal/controller/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var _ = Describe("Integration Test", func() {
nodeNames []string
setup sync.Once
storageProfile *nnfv1alpha1.NnfStorageProfile
dmm *nnfv1alpha1.NnfDataMovementManager
)

advanceState := func(state dwsv1alpha2.WorkflowState, w *dwsv1alpha2.Workflow, testStackOffset int) {
Expand Down Expand Up @@ -966,20 +967,45 @@ var _ = Describe("Integration Test", func() {
WLMID: "Test WLMID",
},
}

dmm = &nnfv1alpha1.NnfDataMovementManager{
ObjectMeta: metav1.ObjectMeta{
Name: nnfv1alpha1.DataMovementManagerName,
Namespace: nnfv1alpha1.DataMovementNamespace,
},
Spec: nnfv1alpha1.NnfDataMovementManagerSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "dm-worker-dummy",
Image: "nginx",
}},
},
},
},
Status: nnfv1alpha1.NnfDataMovementManagerStatus{
Ready: true,
},
}

})

// Bring the workflow up to Data In; assign the necessary servers and computes
// resource. This isn't meant to be a vigorous test of the proposal and setup
// stages; that is provided by the topmost integration test.
JustBeforeEach(func() {
By("Create the workflow")
By("Creating the workflow")
Expect(k8sClient.Create(context.TODO(), workflow)).To(Succeed())

By("Checking for workflow creation")
Eventually(func() error {
return k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(workflow), workflow)
}).Should(Succeed())

By("Creating the NnfDataMovementManager")
Expect(k8sClient.Create(context.TODO(), dmm)).To(Succeed())
WaitForDMMReady(dmm)

/*************************** Proposal ****************************/

By("Checking for proposal state and ready")
Expand Down Expand Up @@ -1034,6 +1060,10 @@ var _ = Describe("Integration Test", func() {

advanceStateAndCheckReady(dwsv1alpha2.StateTeardown, workflow)

Expect(k8sClient.Delete(context.TODO(), dmm)).To(Succeed())
Eventually(func() error { // Delete can still return the cached object. Wait until the object is no longer present
return k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)
}).ShouldNot(Succeed())
})

var lustre *lusv1beta1.LustreFileSystem
Expand Down
12 changes: 12 additions & 0 deletions internal/controller/nnf_workflow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,18 @@ func (r *NnfWorkflowReconciler) startDataInOutState(ctx context.Context, workflo
}
}

// Verify data movement is ready
dmm := &nnfv1alpha1.NnfDataMovementManager{ObjectMeta: metav1.ObjectMeta{
Name: nnfv1alpha1.DataMovementManagerName,
Namespace: nnfv1alpha1.DataMovementNamespace,
}}
if err := r.Get(ctx, client.ObjectKeyFromObject(dmm), dmm); err != nil {
return nil, dwsv1alpha2.NewResourceError("could not get NnfDataMovementManager %v", client.ObjectKeyFromObject(dmm)).WithError(err).WithUserMessage("could not determine data movement readiness")
}
if !dmm.Status.Ready {
return Requeue("pending data movement readiness").withObject(dmm).after(2 * time.Second), nil
}

// Retrieve the target storage that is to perform the data movement.
// For copy_in, the destination is the Rabbit and therefore the target
// For copy_out, the source is the Rabbit and therefore the target
Expand Down
46 changes: 42 additions & 4 deletions internal/controller/nnf_workflow_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ import (
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
)

// TODO:
// BeforeEach - initialize the workflow
// AfterEach - destroy the workflow

var (
baseWorkflowUserID uint32 = 1042
baseWorkflowGroupID uint32 = 1043
Expand Down Expand Up @@ -120,6 +116,7 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
Eventually(func() error { // Delete can still return the cached object. Wait until the object is no longer present
return k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(storageProfile), profExpected)
}).ShouldNot(Succeed())

})

getErroredDriverStatus := func(workflow *dwsv1alpha2.Workflow) *dwsv1alpha2.WorkflowDriverStatus {
Expand Down Expand Up @@ -387,6 +384,9 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
})

When("Using copy_in directives", func() {
var (
dmm *nnfv1alpha1.NnfDataMovementManager
)

JustBeforeEach(func() {
Expect(k8sClient.Create(context.TODO(), workflow)).To(Succeed(), "create workflow")
Expand Down Expand Up @@ -418,6 +418,28 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
}

k8sClient.Create(context.TODO(), ns) // Ignore errors as namespace may be created from other tests

dmm = &nnfv1alpha1.NnfDataMovementManager{
ObjectMeta: metav1.ObjectMeta{
Name: nnfv1alpha1.DataMovementManagerName,
Namespace: nnfv1alpha1.DataMovementNamespace,
},
Spec: nnfv1alpha1.NnfDataMovementManagerSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "name-manager dummy",
Image: "nginx",
}},
},
},
},
Status: nnfv1alpha1.NnfDataMovementManagerStatus{
Ready: true,
},
}
Expect(k8sClient.Create(ctx, dmm)).To(Succeed())
WaitForDMMReady(dmm)
})

BeforeEach(func() {
Expand All @@ -438,6 +460,11 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
AfterEach(func() {
Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(lustre), lustre)).To(Succeed())
Expect(k8sClient.Delete(context.TODO(), lustre)).To(Succeed())

Expect(k8sClient.Delete(context.TODO(), dmm)).To(Succeed())
Eventually(func() error { // Delete can still return the cached object. Wait until the object is no longer present
return k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)
}).ShouldNot(Succeed())
})

When("using $DW_JOB_ references", func() {
Expand Down Expand Up @@ -1408,3 +1435,14 @@ var _ = Describe("NnfStorageProfile Webhook test", func() {
Expect(createNnfStorageProfile(profileInvalid, false)).To(BeNil())
})
})

func WaitForDMMReady(dmm *nnfv1alpha1.NnfDataMovementManager) {
Eventually(func(g Gomega) bool {
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
if !dmm.Status.Ready {
dmm.Status.Ready = true
g.Expect(k8sClient.Status().Update(context.TODO(), dmm)).To(Succeed())
}
return dmm.Status.Ready
}).Should(BeTrue())
}
9 changes: 0 additions & 9 deletions vendor/github.com/google/uuid/.travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions vendor/github.com/google/uuid/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1a62f95

Please sign in to comment.