Skip to content

Commit

Permalink
Move DataMovementManager to nnf-sos and rename to NnfDataMovementMana…
Browse files Browse the repository at this point in the history
…ger (#137)

This moves DMM to nnf-sos so that nnf-sos can use the DMM. This enables
nnf-sos to check if the DMM is ready before proceeding with
copy_in/copy_out directives.

* Moved type.go file and rbac roles to nnf-sos
* Removed `crd/` - there are no data movement types defined here anymore
* Added README.md to `api` to explain the types are in nnf-sos
* Update references to NnfDataMovementManager and also NnfDataMovement
* Re-vendored nnf-sos


Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich authored Nov 14, 2023
1 parent 3b41e1a commit 9b94462
Show file tree
Hide file tree
Showing 35 changed files with 235 additions and 473 deletions.
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,7 @@ minikube-push: VERSION ?= $(shell cat .version)
minikube-push: .version
minikube image load $(IMAGE_TAG_BASE):$(VERSION)

##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
## Deployment

deploy: VERSION ?= $(shell cat .version)
deploy: .version kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
Expand Down
14 changes: 2 additions & 12 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
domain: cray.hpe.com
layout:
- go.kubebuilder.io/v4
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: nnf-dm
repo: github.com/NearNodeFlash/nnf-dm
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cray.hpe.com
group: dm
kind: DataMovementManager
path: github.com/NearNodeFlash/nnf-dm/api/v1alpha1
version: v1alpha1
version: "3"
version: '3'
25 changes: 0 additions & 25 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,3 @@
3. Run `_setup-cluster.sh [lustre | xfs]` to setup your cluster for lustre or xfs, accordingly
4. Run `_create-dm.sh [lustre | xfs]` to create a data movement resource for lustre or xfs, accordingly
5. Run `source _aliases.sh` at any time to load some nice shell aliases to interrogate the KinD environment

## Custom Resource Definitions

### Data Movement CRD

Describes the data movement request at the very top level. References the Servers and Computes that are part of the request.

### Rsync Template CRD

The template for the Rsync Daemon Set that describes what is deployed to Rsync Nodes. Watches LustreFileSystems to ensure the proper PV/PVCs exist for each node.

### Rsync Node Data Movement CRD

Describes a Rsync Data Movement request on an Rsync Node.

## Bootstrapping

This repository was bootstrapped using the operator-sdk

```
operator-sdk init --domain cray.hpe.com --repo github.com/NearNodeFlash/nnf-dm
operator-sdk create api --group dm --version v1alpha1 --kind DataMovement --resource --controller
operator-sdk create api --group dm --version v1alpha1 --kind DataMovementManager --resource --controller
```
6 changes: 3 additions & 3 deletions _aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
# i.e. source ./_aliases.sh
function dmpods { kubectl get pods -n nnf-dm-system "${@:1}"; }

function dmmget { kubectl get -n nnf-dm-system datamovementmanagers --no-headers | head -n1 | awk '{print $1}'; }
function dmmyaml { kubectl get -n nnf-dm-system datamovementmanagers/"$(dmmget)" -o yaml; }
function dmmedit { kubectl edit -n nnf-dm-system datamovementmanagers/"$(dmmget)"; }
function dmmget { kubectl get -n nnf-dm-system nnfdatamovementmanagers --no-headers | head -n1 | awk '{print $1}'; }
function dmmyaml { kubectl get -n nnf-dm-system nnfdatamovementmanagers/"$(dmmget)" -o yaml; }
function dmmedit { kubectl edit -n nnf-dm-system nnfdatamovementmanagers/"$(dmmget)"; }
function dmmpod { kubectl get -n nnf-dm-system pods --no-headers | grep nnf-dm-manager | awk '{print $1}'; }
function dmmlog { kubectl logs -n nnf-dm-system "$(dmmpod)" -c manager "${@:1}"; }

Expand Down
3 changes: 3 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# NNF Data Movement Types

Data Movement types are defined in nnf-sos: <https://github.com/NearNodeFlash/nnf-sos/tree/master/api/>.
39 changes: 0 additions & 39 deletions api/v1alpha1/groupversion_info.go

This file was deleted.

119 changes: 0 additions & 119 deletions api/v1alpha1/zz_generated.deepcopy.go

This file was deleted.

12 changes: 5 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"

dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1"
controllers "github.com/NearNodeFlash/nnf-dm/internal/controller"
//+kubebuilder:scaffold:imports
)
Expand All @@ -58,7 +57,6 @@ func init() {

utilruntime.Must(lusv1beta1.AddToScheme(scheme))
utilruntime.Must(nnfv1alpha1.AddToScheme(scheme))
utilruntime.Must(dmv1alpha1.AddToScheme(scheme))

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

func (c *managerController) SetupReconcilers(mgr manager.Manager) (err error) {
if err = (&controllers.DataMovementManagerReconciler{
if err = (&controllers.NnfDataMovementManagerReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
Expand All @@ -180,15 +178,15 @@ func (*defaultController) GetType() string { return DefaultController }
func (*defaultController) SetOptions(opts *ctrl.Options) {
namespaceCache := make(map[string]cache.Config)
namespaceCache[corev1.NamespaceDefault] = cache.Config{}
namespaceCache[dmv1alpha1.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha1.DataMovementNamespace] = 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: dmv1alpha1.DataMovementNamespace,
WatchNamespace: nnfv1alpha1.DataMovementNamespace,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", c.GetType())
os.Exit(1)
Expand All @@ -206,7 +204,7 @@ func (*nodeController) GetType() string { return NodeController }
func (*nodeController) SetOptions(opts *ctrl.Options) {
namespaceCache := make(map[string]cache.Config)
namespaceCache[corev1.NamespaceDefault] = cache.Config{}
namespaceCache[dmv1alpha1.DataMovementNamespace] = cache.Config{}
namespaceCache[nnfv1alpha1.DataMovementNamespace] = cache.Config{}
namespaceCache[os.Getenv("NNF_NODE_NAME")] = cache.Config{}
opts.Cache = cache.Options{DefaultNamespaces: namespaceCache}
}
Expand Down
23 changes: 0 additions & 23 deletions config/crd/kustomization.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions config/crd/kustomizeconfig.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions config/crd/patches/cainjection_in_datamovementmanagers.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions config/crd/patches/webhook_in_datamovementmanagers.yaml

This file was deleted.

7 changes: 3 additions & 4 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ namePrefix: nnf-dm-
# someName: someValue

resources:
- ../crd
- ../rbac
- ../manager
- ../dm_config
- ../rbac
- ../manager
- ../dm_config
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
# - ../webhook
Expand Down
Loading

0 comments on commit 9b94462

Please sign in to comment.