Skip to content

Commit

Permalink
Merge release v0.1.11
Browse files Browse the repository at this point in the history
Release v0.1.11
  • Loading branch information
bdevcich authored Oct 21, 2024
2 parents 0e9952f + 08e1200 commit 5f7daaa
Show file tree
Hide file tree
Showing 66 changed files with 25,632 additions and 292 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# These ARGs must be before the first FROM. This allows them to be valid for
# use in FROM instructions.
ARG NNFMFU_TAG_BASE=ghcr.io/nearnodeflash/nnf-mfu
ARG NNFMFU_VERSION=0.1.2
ARG NNFMFU_VERSION=0.1.3

# Build the manager binary
FROM golang:1.21-alpine AS builder
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ IMAGE_TARGET ?= production

# The NNF-MFU container image to use in NNFContainerProfile resources.
NNFMFU_TAG_BASE ?= ghcr.io/nearnodeflash/nnf-mfu
NNFMFU_VERSION ?= 0.1.2
NNFMFU_VERSION ?= 0.1.3

CONTAINER_BUILDARGS=--build-arg NNFMFU_TAG_BASE=$(NNFMFU_TAG_BASE) --build-arg NNFMFU_VERSION=$(NNFMFU_VERSION)

Expand Down
16 changes: 8 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1"
nnfv1alpha2 "github.com/NearNodeFlash/nnf-sos/api/v1alpha2"
nnfv1alpha3 "github.com/NearNodeFlash/nnf-sos/api/v1alpha3"

controllers "github.com/NearNodeFlash/nnf-dm/internal/controller"
//+kubebuilder:scaffold:imports
Expand All @@ -57,7 +57,7 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(lusv1beta1.AddToScheme(scheme))
utilruntime.Must(nnfv1alpha2.AddToScheme(scheme))
utilruntime.Must(nnfv1alpha3.AddToScheme(scheme))

//+kubebuilder:scaffold:scheme
}
Expand Down Expand Up @@ -177,7 +177,7 @@ func (*managerController) GetType() string { return ManagerController }
func (*managerController) SetOptions(opts *ctrl.Options) {
namespaceCache := make(map[string]cache.Config)
namespaceCache[corev1.NamespaceDefault] = cache.Config{}
namespaceCache[nnfv1alpha2.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha3.DataMovementNamespace] = cache.Config{}
opts.Cache = cache.Options{DefaultNamespaces: namespaceCache}
}

Expand All @@ -200,16 +200,16 @@ func (*defaultController) GetType() string { return DefaultController }
func (*defaultController) SetOptions(opts *ctrl.Options) {
namespaceCache := make(map[string]cache.Config)
namespaceCache[corev1.NamespaceDefault] = cache.Config{}
namespaceCache[nnfv1alpha2.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha2.DataMovementProfileNamespace] = cache.Config{}
namespaceCache[nnfv1alpha3.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha3.DataMovementProfileNamespace] = cache.Config{}
opts.Cache = cache.Options{DefaultNamespaces: namespaceCache}
}

func (c *defaultController) SetupReconcilers(mgr manager.Manager) (err error) {
if err = (&controllers.DataMovementReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
WatchNamespace: nnfv1alpha2.DataMovementNamespace,
WatchNamespace: nnfv1alpha3.DataMovementNamespace,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", c.GetType())
os.Exit(1)
Expand All @@ -227,8 +227,8 @@ func (*nodeController) GetType() string { return NodeController }
func (*nodeController) SetOptions(opts *ctrl.Options) {
namespaceCache := make(map[string]cache.Config)
namespaceCache[corev1.NamespaceDefault] = cache.Config{}
namespaceCache[nnfv1alpha2.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha2.DataMovementProfileNamespace] = cache.Config{}
namespaceCache[nnfv1alpha3.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha3.DataMovementProfileNamespace] = cache.Config{}
namespaceCache[os.Getenv("NNF_NODE_NAME")] = cache.Config{}
opts.Cache = cache.Options{DefaultNamespaces: namespaceCache}
}
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/nearnodeflash/nnf-dm
newTag: 0.1.10
newTag: 0.1.11
- name: nnf-mfu
newName: ghcr.io/nearnodeflash/nnf-mfu
newTag: 0.1.2
newTag: 0.1.3
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
---
apiVersion: nnf.cray.hpe.com/v1alpha2
apiVersion: nnf.cray.hpe.com/v1alpha3
kind: NnfDataMovementManager
metadata:
name: manager-controller-manager
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager_imagepullsecret_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
imagePullSecrets:
- name: name_of_secret
---
apiVersion: nnf.cray.hpe.com/v1alpha2
apiVersion: nnf.cray.hpe.com/v1alpha3
kind: NnfDataMovementManager
metadata:
name: manager-controller-manager
Expand Down
84 changes: 42 additions & 42 deletions daemons/compute/server/servers/server_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import (

dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1"
nnfv1alpha2 "github.com/NearNodeFlash/nnf-sos/api/v1alpha2"
nnfv1alpha3 "github.com/NearNodeFlash/nnf-sos/api/v1alpha3"

pb "github.com/NearNodeFlash/nnf-dm/daemons/compute/client-go/api"

Expand All @@ -76,7 +76,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(dwsv1alpha2.AddToScheme(scheme))
utilruntime.Must(nnfv1alpha2.AddToScheme(scheme))
utilruntime.Must(nnfv1alpha3.AddToScheme(scheme))
utilruntime.Must(lusv1beta1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}
Expand Down Expand Up @@ -244,7 +244,7 @@ func (s *defaultServer) setupWithManager(mgr ctrl.Manager) error {
p := predicate.Funcs{
CreateFunc: func(ce event.CreateEvent) bool { return false },
UpdateFunc: func(ue event.UpdateEvent) bool {
if initiator := ue.ObjectNew.GetLabels()[nnfv1alpha2.DataMovementInitiatorLabel]; initiator == s.name {
if initiator := ue.ObjectNew.GetLabels()[nnfv1alpha3.DataMovementInitiatorLabel]; initiator == s.name {
return true
}
return false
Expand All @@ -253,7 +253,7 @@ func (s *defaultServer) setupWithManager(mgr ctrl.Manager) error {
}

err := ctrl.NewControllerManagedBy(mgr).
For(&nnfv1alpha2.NnfDataMovement{}, builder.WithPredicates(p)).
For(&nnfv1alpha3.NnfDataMovement{}, builder.WithPredicates(p)).
Complete(&dataMovementReconciler{s})
if err != nil {
return err
Expand All @@ -268,7 +268,7 @@ type dataMovementReconciler struct {

func (r *dataMovementReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

dm := &nnfv1alpha2.NnfDataMovement{}
dm := &nnfv1alpha3.NnfDataMovement{}
if err := r.server.client.Get(ctx, req.NamespacedName, dm); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (s *defaultServer) Create(ctx context.Context, req *pb.DataMovementCreateRe
}, nil
}

var dm *nnfv1alpha2.NnfDataMovement
var dm *nnfv1alpha3.NnfDataMovement
dmFunc := ""
switch computeMountInfo.Type {
case "lustre":
Expand Down Expand Up @@ -365,7 +365,7 @@ func (s *defaultServer) Create(ctx context.Context, req *pb.DataMovementCreateRe
}, nil
}
dm.Spec.ProfileReference = corev1.ObjectReference{
Kind: reflect.TypeOf(nnfv1alpha2.NnfDataMovementProfile{}).Name(),
Kind: reflect.TypeOf(nnfv1alpha3.NnfDataMovementProfile{}).Name(),
Name: profile.Name,
Namespace: profile.Namespace,
}
Expand All @@ -379,7 +379,7 @@ func (s *defaultServer) Create(ctx context.Context, req *pb.DataMovementCreateRe

// Label the NnfDataMovement with a teardown state of "post_run" so the NNF workflow
// controller can identify compute initiated data movements.
nnfv1alpha2.AddDataMovementTeardownStateLabel(dm, dwsv1alpha2.StatePostRun)
nnfv1alpha3.AddDataMovementTeardownStateLabel(dm, dwsv1alpha2.StatePostRun)

// Allow the user to override/supplement certain settings
setUserConfig(req, dm)
Expand All @@ -398,8 +398,8 @@ func (s *defaultServer) Create(ctx context.Context, req *pb.DataMovementCreateRe
}

// Set the DM's UserConfig options based on the incoming requests's options
func setUserConfig(req *pb.DataMovementCreateRequest, dm *nnfv1alpha2.NnfDataMovement) {
dm.Spec.UserConfig = &nnfv1alpha2.NnfDataMovementConfig{}
func setUserConfig(req *pb.DataMovementCreateRequest, dm *nnfv1alpha3.NnfDataMovement) {
dm.Spec.UserConfig = &nnfv1alpha3.NnfDataMovementConfig{}
dm.Spec.UserConfig.Dryrun = req.Dryrun
dm.Spec.UserConfig.MpirunOptions = req.MpirunOptions
dm.Spec.UserConfig.DcpOptions = req.DcpOptions
Expand All @@ -414,13 +414,13 @@ func setUserConfig(req *pb.DataMovementCreateRequest, dm *nnfv1alpha2.NnfDataMov
}
}

func (s *defaultServer) getProfile(ctx context.Context, profileName string) (*nnfv1alpha2.NnfDataMovementProfile, error) {
func (s *defaultServer) getProfile(ctx context.Context, profileName string) (*nnfv1alpha3.NnfDataMovementProfile, error) {
ns := "nnf-system"

// If a profile is named then verify that it exists. Otherwise, verify that a default profile
// can be found.
if len(profileName) == 0 {
NnfDataMovementProfiles := &nnfv1alpha2.NnfDataMovementProfileList{}
NnfDataMovementProfiles := &nnfv1alpha3.NnfDataMovementProfileList{}
if err := s.client.List(ctx, NnfDataMovementProfiles, &client.ListOptions{Namespace: ns}); err != nil {
return nil, err
}
Expand All @@ -440,7 +440,7 @@ func (s *defaultServer) getProfile(ctx context.Context, profileName string) (*nn
profileName = profilesFound[0]
}

profile := &nnfv1alpha2.NnfDataMovementProfile{
profile := &nnfv1alpha3.NnfDataMovementProfile{
ObjectMeta: metav1.ObjectMeta{
Name: profileName,
Namespace: ns,
Expand All @@ -462,15 +462,15 @@ func getDirectiveIndexFromClientMount(object *dwsv1alpha2.ClientMount) (string,
return "", fmt.Errorf("unable to find labels on compute ClientMount, namespaces=%s, name=%s", object.Namespace, object.Name)
}

dwIndex, found := labels[nnfv1alpha2.DirectiveIndexLabel]
dwIndex, found := labels[nnfv1alpha3.DirectiveIndexLabel]
if !found {
return "", fmt.Errorf("unable to find directive index label on compute ClientMount, namespace=%s name=%s", object.Namespace, object.Name)
}

return dwIndex, nil
}

func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataMovementCreateRequest, computeMountInfo *dwsv1alpha2.ClientMountInfo, computeClientMount *dwsv1alpha2.ClientMount) (*nnfv1alpha2.NnfDataMovement, error) {
func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataMovementCreateRequest, computeMountInfo *dwsv1alpha2.ClientMountInfo, computeClientMount *dwsv1alpha2.ClientMount) (*nnfv1alpha3.NnfDataMovement, error) {

// Find the ClientMount for the rabbit.
source, err := s.findRabbitRelativeSource(ctx, computeMountInfo, req)
Expand All @@ -490,25 +490,25 @@ func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataM
return nil, err
}

dm := &nnfv1alpha2.NnfDataMovement{
dm := &nnfv1alpha3.NnfDataMovement{
ObjectMeta: metav1.ObjectMeta{
// Be careful about how much you put into GenerateName.
// The MPI operator will use the resulting name as a
// prefix for its own names.
GenerateName: nameBase,
// Use the data movement namespace.
Namespace: nnfv1alpha2.DataMovementNamespace,
Namespace: nnfv1alpha3.DataMovementNamespace,
Labels: map[string]string{
nnfv1alpha2.DataMovementInitiatorLabel: s.name,
nnfv1alpha2.DirectiveIndexLabel: dwIndex,
nnfv1alpha3.DataMovementInitiatorLabel: s.name,
nnfv1alpha3.DirectiveIndexLabel: dwIndex,
},
},
Spec: nnfv1alpha2.NnfDataMovementSpec{
Source: &nnfv1alpha2.NnfDataMovementSpecSourceDestination{
Spec: nnfv1alpha3.NnfDataMovementSpec{
Source: &nnfv1alpha3.NnfDataMovementSpecSourceDestination{
Path: source,
StorageReference: computeMountInfo.Device.DeviceReference.ObjectReference,
},
Destination: &nnfv1alpha2.NnfDataMovementSpecSourceDestination{
Destination: &nnfv1alpha3.NnfDataMovementSpecSourceDestination{
Path: req.Destination,
StorageReference: corev1.ObjectReference{
Kind: reflect.TypeOf(*lustrefs).Name(),
Expand All @@ -522,27 +522,27 @@ func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataM
return dm, nil
}

func (s *defaultServer) createNnfNodeDataMovement(ctx context.Context, req *pb.DataMovementCreateRequest, computeMountInfo *dwsv1alpha2.ClientMountInfo) (*nnfv1alpha2.NnfDataMovement, error) {
func (s *defaultServer) createNnfNodeDataMovement(ctx context.Context, req *pb.DataMovementCreateRequest, computeMountInfo *dwsv1alpha2.ClientMountInfo) (*nnfv1alpha3.NnfDataMovement, error) {
// Find the ClientMount for the rabbit.
source, err := s.findRabbitRelativeSource(ctx, computeMountInfo, req)
if err != nil {
return nil, err
}

dm := &nnfv1alpha2.NnfDataMovement{
dm := &nnfv1alpha3.NnfDataMovement{
ObjectMeta: metav1.ObjectMeta{
GenerateName: nodeNameBase,
Namespace: s.namespace, // Use the rabbit
Labels: map[string]string{
nnfv1alpha2.DataMovementInitiatorLabel: s.name,
nnfv1alpha3.DataMovementInitiatorLabel: s.name,
},
},
Spec: nnfv1alpha2.NnfDataMovementSpec{
Source: &nnfv1alpha2.NnfDataMovementSpecSourceDestination{
Spec: nnfv1alpha3.NnfDataMovementSpec{
Source: &nnfv1alpha3.NnfDataMovementSpecSourceDestination{
Path: source,
StorageReference: computeMountInfo.Device.DeviceReference.ObjectReference,
},
Destination: &nnfv1alpha2.NnfDataMovementSpecSourceDestination{
Destination: &nnfv1alpha3.NnfDataMovementSpecSourceDestination{
Path: req.Destination,
},
},
Expand All @@ -561,7 +561,7 @@ func (s *defaultServer) List(ctx context.Context, req *pb.DataMovementListReques
}),
}

list := nnfv1alpha2.NnfDataMovementList{}
list := nnfv1alpha3.NnfDataMovementList{}
if err := s.client.List(ctx, &list, opts...); err != nil {
return nil, err
}
Expand All @@ -580,7 +580,7 @@ func (s *defaultServer) Status(ctx context.Context, req *pb.DataMovementStatusRe

ns := s.getNamespace(req.Uid)

dm := &nnfv1alpha2.NnfDataMovement{}
dm := &nnfv1alpha3.NnfDataMovement{}
if err := s.client.Get(ctx, types.NamespacedName{Name: req.Uid, Namespace: ns}, dm); err != nil {
if errors.IsNotFound(err) {
return &pb.DataMovementStatusResponse{
Expand Down Expand Up @@ -608,7 +608,7 @@ func (s *defaultServer) Status(ctx context.Context, req *pb.DataMovementStatusRe
}
}

if dm.Status.StartTime.IsZero() && dm.Status.Status != nnfv1alpha2.DataMovementConditionReasonInvalid {
if dm.Status.StartTime.IsZero() && dm.Status.Status != nnfv1alpha3.DataMovementConditionReasonInvalid {
return &pb.DataMovementStatusResponse{
State: pb.DataMovementStatusResponse_PENDING,
Status: pb.DataMovementStatusResponse_UNKNOWN_STATUS,
Expand All @@ -617,9 +617,9 @@ func (s *defaultServer) Status(ctx context.Context, req *pb.DataMovementStatusRe

stateMap := map[string]pb.DataMovementStatusResponse_State{
"": pb.DataMovementStatusResponse_UNKNOWN_STATE,
nnfv1alpha2.DataMovementConditionTypeStarting: pb.DataMovementStatusResponse_STARTING,
nnfv1alpha2.DataMovementConditionTypeRunning: pb.DataMovementStatusResponse_RUNNING,
nnfv1alpha2.DataMovementConditionTypeFinished: pb.DataMovementStatusResponse_COMPLETED,
nnfv1alpha3.DataMovementConditionTypeStarting: pb.DataMovementStatusResponse_STARTING,
nnfv1alpha3.DataMovementConditionTypeRunning: pb.DataMovementStatusResponse_RUNNING,
nnfv1alpha3.DataMovementConditionTypeFinished: pb.DataMovementStatusResponse_COMPLETED,
}

state, ok := stateMap[dm.Status.State]
Expand All @@ -637,10 +637,10 @@ func (s *defaultServer) Status(ctx context.Context, req *pb.DataMovementStatusRe

statusMap := map[string]pb.DataMovementStatusResponse_Status{
"": pb.DataMovementStatusResponse_UNKNOWN_STATUS,
nnfv1alpha2.DataMovementConditionReasonFailed: pb.DataMovementStatusResponse_FAILED,
nnfv1alpha2.DataMovementConditionReasonSuccess: pb.DataMovementStatusResponse_SUCCESS,
nnfv1alpha2.DataMovementConditionReasonInvalid: pb.DataMovementStatusResponse_INVALID,
nnfv1alpha2.DataMovementConditionReasonCancelled: pb.DataMovementStatusResponse_CANCELLED,
nnfv1alpha3.DataMovementConditionReasonFailed: pb.DataMovementStatusResponse_FAILED,
nnfv1alpha3.DataMovementConditionReasonSuccess: pb.DataMovementStatusResponse_SUCCESS,
nnfv1alpha3.DataMovementConditionReasonInvalid: pb.DataMovementStatusResponse_INVALID,
nnfv1alpha3.DataMovementConditionReasonCancelled: pb.DataMovementStatusResponse_CANCELLED,
}

status, ok := statusMap[dm.Status.Status]
Expand Down Expand Up @@ -744,7 +744,7 @@ func (s *defaultServer) Cancel(ctx context.Context, req *pb.DataMovementCancelRe
ns := s.getNamespace(req.Uid)

err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
dm := &nnfv1alpha2.NnfDataMovement{}
dm := &nnfv1alpha3.NnfDataMovement{}
if err := s.client.Get(ctx, types.NamespacedName{Name: req.Uid, Namespace: ns}, dm); err != nil {
return err
}
Expand Down Expand Up @@ -784,7 +784,7 @@ func (s *defaultServer) Delete(ctx context.Context, req *pb.DataMovementDeleteRe

ns := s.getNamespace(req.Uid)

dm := &nnfv1alpha2.NnfDataMovement{}
dm := &nnfv1alpha3.NnfDataMovement{}
if err := s.client.Get(ctx, types.NamespacedName{Name: req.Uid, Namespace: ns}, dm); err != nil {
if errors.IsNotFound(err) {
return &pb.DataMovementDeleteResponse{
Expand All @@ -795,7 +795,7 @@ func (s *defaultServer) Delete(ctx context.Context, req *pb.DataMovementDeleteRe
return nil, err
}

if dm.Status.State != nnfv1alpha2.DataMovementConditionTypeFinished {
if dm.Status.State != nnfv1alpha3.DataMovementConditionTypeFinished {
return &pb.DataMovementDeleteResponse{
Status: pb.DataMovementDeleteResponse_ACTIVE,
}, nil
Expand Down Expand Up @@ -922,5 +922,5 @@ func (s *defaultServer) getNamespace(uid string) string {
return s.namespace
}

return nnfv1alpha2.DataMovementNamespace
return nnfv1alpha3.DataMovementNamespace
}
Loading

0 comments on commit 5f7daaa

Please sign in to comment.