From 2009d900b12a37d0a6882bd1a5a6163c2279887a Mon Sep 17 00:00:00 2001 From: Blake Devcich Date: Tue, 7 Nov 2023 10:11:22 -0600 Subject: [PATCH 1/2] Move DataMovementManager to nnf-sos and rename to NnfDataMovementManager 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 --- Makefile | 8 +- PROJECT | 14 +-- Readme.md | 2 +- _aliases.sh | 6 +- api/README.md | 3 + api/v1alpha1/groupversion_info.go | 39 ------ api/v1alpha1/zz_generated.deepcopy.go | 119 ------------------ cmd/main.go | 12 +- config/crd/kustomization.yaml | 23 ---- config/crd/kustomizeconfig.yaml | 19 --- .../cainjection_in_datamovementmanagers.yaml | 7 -- .../webhook_in_datamovementmanagers.yaml | 16 --- config/default/kustomization.yaml | 7 +- config/manager/manager.yaml | 72 +++++------ .../manager_imagepullsecret_patch.yaml | 8 +- .../rbac/datamovementmanager_editor_role.yaml | 24 ---- .../rbac/datamovementmanager_viewer_role.yaml | 20 --- config/rbac/role.yaml | 28 ++--- .../dm_v1alpha1_datamovementmanager.yaml | 6 - config/samples/kustomization.yaml | 5 - .../compute/server/servers/server_default.go | 6 +- deploy.sh | 8 +- go.mod | 2 +- go.sum | 4 +- .../controller/datamovement_controller.go | 7 +- .../datamovement_controller_test.go | 2 +- .../datamovementmanager_controller.go | 42 +++---- .../datamovementmanager_controller_test.go | 14 +-- internal/controller/suite_test.go | 8 +- .../api/v1alpha1/nnf_datamovement_types.go | 10 +- .../v1alpha1/nnf_datamovementmanager_types.go | 26 ++-- .../api/v1alpha1/zz_generated.deepcopy.go | 91 ++++++++++++++ ....cray.hpe.com_nnfdatamovementmanagers.yaml | 19 +-- .../nnf.cray.hpe.com_nnfdatamovements.yaml | 6 +- vendor/modules.txt | 2 +- 35 files changed, 236 insertions(+), 449 deletions(-) create mode 100644 api/README.md delete mode 100644 api/v1alpha1/groupversion_info.go delete mode 100644 api/v1alpha1/zz_generated.deepcopy.go delete mode 100644 config/crd/kustomization.yaml delete mode 100644 config/crd/kustomizeconfig.yaml delete mode 100644 config/crd/patches/cainjection_in_datamovementmanagers.yaml delete mode 100644 config/crd/patches/webhook_in_datamovementmanagers.yaml delete mode 100644 config/rbac/datamovementmanager_editor_role.yaml delete mode 100644 config/rbac/datamovementmanager_viewer_role.yaml delete mode 100644 config/samples/dm_v1alpha1_datamovementmanager.yaml delete mode 100644 config/samples/kustomization.yaml rename api/v1alpha1/datamovementmanager_types.go => vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovementmanager_types.go (78%) rename config/crd/bases/dm.cray.hpe.com_datamovementmanagers.yaml => vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml (99%) diff --git a/Makefile b/Makefile index a537445f..fb3d8769 100644 --- a/Makefile +++ b/Makefile @@ -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. diff --git a/PROJECT b/PROJECT index 12799d1c..6c18eefc 100644 --- a/PROJECT +++ b/PROJECT @@ -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' diff --git a/Readme.md b/Readme.md index b8eef626..4bd0f9db 100644 --- a/Readme.md +++ b/Readme.md @@ -29,6 +29,6 @@ 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 +operator-sdk create api --group dm --version v1alpha1 --kind NnfDataMovementManager --resource --controller ``` diff --git a/_aliases.sh b/_aliases.sh index a33508f8..b0014721 100755 --- a/_aliases.sh +++ b/_aliases.sh @@ -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}"; } diff --git a/api/README.md b/api/README.md new file mode 100644 index 00000000..4a36972a --- /dev/null +++ b/api/README.md @@ -0,0 +1,3 @@ +# NNF Data Movement Types + +Data Movement types are defined in nnf-sos: . diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go deleted file mode 100644 index 96282223..00000000 --- a/api/v1alpha1/groupversion_info.go +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2021, 2022 Hewlett Packard Enterprise Development LP - * Other additional copyright holders may be indicated within. - * - * The entirety of this work is licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Package v1alpha1 contains API Schema definitions for the dm v1alpha1 API group -// +kubebuilder:object:generate=true -// +groupName=dm.cray.hpe.com -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "dm.cray.hpe.com", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index fc3cba41..00000000 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build !ignore_autogenerated - -/* - * Copyright 2023 Hewlett Packard Enterprise Development LP - * Other additional copyright holders may be indicated within. - * - * The entirety of this work is licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMovementManager) DeepCopyInto(out *DataMovementManager) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMovementManager. -func (in *DataMovementManager) DeepCopy() *DataMovementManager { - if in == nil { - return nil - } - out := new(DataMovementManager) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataMovementManager) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMovementManagerList) DeepCopyInto(out *DataMovementManagerList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DataMovementManager, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMovementManagerList. -func (in *DataMovementManagerList) DeepCopy() *DataMovementManagerList { - if in == nil { - return nil - } - out := new(DataMovementManagerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataMovementManagerList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMovementManagerSpec) DeepCopyInto(out *DataMovementManagerSpec) { - *out = *in - in.Selector.DeepCopyInto(&out.Selector) - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMovementManagerSpec. -func (in *DataMovementManagerSpec) DeepCopy() *DataMovementManagerSpec { - if in == nil { - return nil - } - out := new(DataMovementManagerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMovementManagerStatus) DeepCopyInto(out *DataMovementManagerStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMovementManagerStatus. -func (in *DataMovementManagerStatus) DeepCopy() *DataMovementManagerStatus { - if in == nil { - return nil - } - out := new(DataMovementManagerStatus) - in.DeepCopyInto(out) - return out -} diff --git a/cmd/main.go b/cmd/main.go index fe2f3260..83139428 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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 ) @@ -58,7 +57,6 @@ func init() { utilruntime.Must(lusv1beta1.AddToScheme(scheme)) utilruntime.Must(nnfv1alpha1.AddToScheme(scheme)) - utilruntime.Must(dmv1alpha1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } @@ -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 { @@ -180,7 +178,7 @@ 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} } @@ -188,7 +186,7 @@ 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) @@ -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} } diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml deleted file mode 100644 index d1b3ddfd..00000000 --- a/config/crd/kustomization.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# This kustomization.yaml is not intended to be run by itself, -# since it depends on service name and namespace that are out of this kustomize package. -# It should be run by config/default -resources: -- bases/dm.cray.hpe.com_datamovementmanagers.yaml -#+kubebuilder:scaffold:crdkustomizeresource - -patchesStrategicMerge: -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. -# patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_datamovements.yaml -#- patches/webhook_in_datamovementmanagers.yaml -#+kubebuilder:scaffold:crdkustomizewebhookpatch - -# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. -# patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_datamovements.yaml -#- patches/cainjection_in_datamovementmanagers.yaml -#+kubebuilder:scaffold:crdkustomizecainjectionpatch - -# the following config is for teaching kustomize how to do kustomization for CRDs. -configurations: -- kustomizeconfig.yaml diff --git a/config/crd/kustomizeconfig.yaml b/config/crd/kustomizeconfig.yaml deleted file mode 100644 index ec5c150a..00000000 --- a/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/config/crd/patches/cainjection_in_datamovementmanagers.yaml b/config/crd/patches/cainjection_in_datamovementmanagers.yaml deleted file mode 100644 index 578798de..00000000 --- a/config/crd/patches/cainjection_in_datamovementmanagers.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: datamovementmanagers.dm.cray.hpe.com diff --git a/config/crd/patches/webhook_in_datamovementmanagers.yaml b/config/crd/patches/webhook_in_datamovementmanagers.yaml deleted file mode 100644 index 004e38d2..00000000 --- a/config/crd/patches/webhook_in_datamovementmanagers.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: datamovementmanagers.dm.cray.hpe.com -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index ae2d9fe6..a662aad0 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -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 diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 985c3eee..07138cee 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -23,67 +23,67 @@ spec: control-plane: controller-manager spec: containers: - - command: - - /manager - args: - - --leader-elect - - --controller=manager - image: controller:latest - name: manager - securityContext: - allowPrivilegeEscalation: false - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 + - command: + - /manager + args: + - --leader-elect + - --controller=manager + image: controller:latest + name: manager + securityContext: + allowPrivilegeEscalation: false + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 serviceAccountName: controller-manager terminationGracePeriodSeconds: 10 --- -apiVersion: dm.cray.hpe.com/v1alpha1 -kind: DataMovementManager +apiVersion: nnf.cray.hpe.com/v1alpha1 +kind: NnfDataMovementManager metadata: name: manager-controller-manager namespace: system spec: selector: matchLabels: - cray.nnf.node: "true" - hostPath: "/mnt/nnf" - mountPath: "/mnt/nnf" + cray.nnf.node: 'true' + hostPath: '/mnt/nnf' + mountPath: '/mnt/nnf' template: spec: serviceAccountName: nnf-dm-controller-manager # not sure why 'controller-manager' isn't patched to include the 'nnf-dm-' prefix tolerations: - - key: "cray.nnf.node" - operator: "Equal" - value: "true" - effect: "NoSchedule" + - key: 'cray.nnf.node' + operator: 'Equal' + value: 'true' + effect: 'NoSchedule' shareProcessNamespace: true containers: - name: worker image: nnf-mfu:latest - command: + command: - /usr/sbin/sshd args: - -De securityContext: privileged: true capabilities: - add: ["SETUID", "SETGID", "MKNOD"] + add: ['SETUID', 'SETGID', 'MKNOD'] - name: manager - command: - - /manager + command: + - /manager args: - - --leader-elect=false - - --controller=node + - --leader-elect=false + - --controller=node image: controller:latest env: - name: NNF_NODE_NAME diff --git a/config/manager/manager_imagepullsecret_patch.yaml b/config/manager/manager_imagepullsecret_patch.yaml index e0c7f521..96458f34 100644 --- a/config/manager/manager_imagepullsecret_patch.yaml +++ b/config/manager/manager_imagepullsecret_patch.yaml @@ -7,10 +7,10 @@ spec: template: spec: imagePullSecrets: - - name: name_of_secret + - name: name_of_secret --- -apiVersion: dm.cray.hpe.com/v1alpha1 -kind: DataMovementManager +apiVersion: nnf.cray.hpe.com/v1alpha1 +kind: NnfDataMovementManager metadata: name: manager-controller-manager namespace: system @@ -18,4 +18,4 @@ spec: template: spec: imagePullSecrets: - - name: name_of_secret + - name: name_of_secret diff --git a/config/rbac/datamovementmanager_editor_role.yaml b/config/rbac/datamovementmanager_editor_role.yaml deleted file mode 100644 index a6038057..00000000 --- a/config/rbac/datamovementmanager_editor_role.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# permissions for end users to edit datamovementmanagers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: datamovementmanager-editor-role -rules: -- apiGroups: - - dm.cray.hpe.com - resources: - - datamovementmanagers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - dm.cray.hpe.com - resources: - - datamovementmanagers/status - verbs: - - get diff --git a/config/rbac/datamovementmanager_viewer_role.yaml b/config/rbac/datamovementmanager_viewer_role.yaml deleted file mode 100644 index bc480999..00000000 --- a/config/rbac/datamovementmanager_viewer_role.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# permissions for end users to view datamovementmanagers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: datamovementmanager-viewer-role -rules: -- apiGroups: - - dm.cray.hpe.com - resources: - - datamovementmanagers - verbs: - - get - - list - - watch -- apiGroups: - - dm.cray.hpe.com - resources: - - datamovementmanagers/status - verbs: - - get diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 59f1bab4..dd128efc 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -101,41 +101,41 @@ rules: - list - watch - apiGroups: - - dm.cray.hpe.com + - lus.cray.hpe.com resources: - - datamovementmanagers + - lustrefilesystems verbs: - - create - - delete - get - list - patch - update - watch - apiGroups: - - dm.cray.hpe.com + - nnf.cray.hpe.com resources: - - datamovementmanagers/finalizers + - nnfdatamovementmanagers verbs: + - create + - delete + - get + - list + - patch - update + - watch - apiGroups: - - dm.cray.hpe.com + - nnf.cray.hpe.com resources: - - datamovementmanagers/status + - nnfdatamovementmanagers/finalizers verbs: - - get - - patch - update - apiGroups: - - lus.cray.hpe.com + - nnf.cray.hpe.com resources: - - lustrefilesystems + - nnfdatamovementmanagers/status verbs: - get - - list - patch - update - - watch - apiGroups: - nnf.cray.hpe.com resources: diff --git a/config/samples/dm_v1alpha1_datamovementmanager.yaml b/config/samples/dm_v1alpha1_datamovementmanager.yaml deleted file mode 100644 index 1367edcc..00000000 --- a/config/samples/dm_v1alpha1_datamovementmanager.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: dm.cray.hpe.com/v1alpha1 -kind: DataMovementManager -metadata: - name: datamovementmanager-sample -spec: - # Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml deleted file mode 100644 index d451cdb6..00000000 --- a/config/samples/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -## Append samples you want in your CSV to this file as resources ## -resources: -- dm_v1alpha1_datamovement.yaml -- dm_v1alpha1_datamovementmanager.yaml -#+kubebuilder:scaffold:manifestskustomizesamples diff --git a/daemons/compute/server/servers/server_default.go b/daemons/compute/server/servers/server_default.go index b4ce5ed8..6c5a1f38 100644 --- a/daemons/compute/server/servers/server_default.go +++ b/daemons/compute/server/servers/server_default.go @@ -54,7 +54,6 @@ import ( dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2" lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1" - dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" dmctrl "github.com/NearNodeFlash/nnf-dm/internal/controller" @@ -76,7 +75,6 @@ var ( func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(dwsv1alpha2.AddToScheme(scheme)) - utilruntime.Must(dmv1alpha1.AddToScheme(scheme)) utilruntime.Must(nnfv1alpha1.AddToScheme(scheme)) utilruntime.Must(lusv1beta1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme @@ -420,7 +418,7 @@ func (s *defaultServer) createNnfDataMovement(ctx context.Context, req *pb.DataM // prefix for its own names. GenerateName: nameBase, // Use the data movement namespace. - Namespace: dmv1alpha1.DataMovementNamespace, + Namespace: nnfv1alpha1.DataMovementNamespace, Labels: map[string]string{ dmctrl.InitiatorLabel: s.name, nnfv1alpha1.DirectiveIndexLabel: dwIndex, @@ -844,5 +842,5 @@ func (s *defaultServer) getNamespace(uid string) string { return s.namespace } - return dmv1alpha1.DataMovementNamespace + return nnfv1alpha1.DataMovementNamespace } diff --git a/deploy.sh b/deploy.sh index f626da0a..e0ce4f3a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -38,12 +38,12 @@ case $CMD in deploy) $KUSTOMIZE build $OVERLAY_DIR | kubectl apply -f - || true - # Sometimes the deployment of the DataMovementManager occurs too quickly for k8s to digest the CRD + # Sometimes the deployment of the NnfDataMovementManager occurs too quickly for k8s to digest the CRD # Retry the deployment if this is the case. It seems to be fast enough where we can just # turn around and re-deploy; but this may need to move to a polling loop if that goes away. - echo "Waiting for DataMovementManager resource to become ready" + echo "Waiting for NnfDataMovementManager resource to become ready" while :; do - [[ $(kubectl get datamovementmanager -n nnf-dm-system 2>&1) == "No resources found" ]] && sleep 1 && continue + [[ $(kubectl get nnfdatamovementmanager -n nnf-dm-system 2>&1) == "No resources found" ]] && sleep 1 && continue $KUSTOMIZE build $OVERLAY_DIR | kubectl apply -f - break done @@ -56,7 +56,7 @@ deploy) ;; undeploy) $KUSTOMIZE build config/prometheus | kubectl delete --ignore-not-found -f- - # When the DataMovementManager CRD gets deleted all related resource are also + # When the NnfDataMovementManager CRD gets deleted all related resource are also # removed, so the delete will always fail. We ignore all errors at our # own risk. $KUSTOMIZE build $OVERLAY_DIR | kubectl delete --ignore-not-found -f - diff --git a/go.mod b/go.mod index e9d3275c..f2af705d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231031201943-531116c1194e - github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231031205956-621786eb596f + github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231108192651-ab8d87963df0 github.com/onsi/ginkgo/v2 v2.11.0 github.com/onsi/gomega v1.27.10 github.com/prometheus/client_golang v1.16.0 diff --git a/go.sum b/go.sum index c2a0b829..76e5f008 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231031201943-531116c1194e github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231031201943-531116c1194e/go.mod h1:qBcz9p8sXm1qhDf8WUmhxTlD1NCMEjoAD7NoHbQvMiI= github.com/NearNodeFlash/nnf-ec v0.0.0-20231010162453-a8168bb6a52f h1:aWtSSQLLk9mUZj94mowirQeVw9saf80gVe10X0rZe8o= github.com/NearNodeFlash/nnf-ec v0.0.0-20231010162453-a8168bb6a52f/go.mod h1:oxdwMqfttOF9dabJhqrWlirCnMk8/8eyLMwl+hducjk= -github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231031205956-621786eb596f h1:Z8GBYEaUojh0aa33R6SlCwII3to/3XGNBj1Uu7ADYT4= -github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231031205956-621786eb596f/go.mod h1:YX9Q91wqtUmfZjU4KxSwZMDJGBzppiGEW4BpAVTIMAs= +github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231108192651-ab8d87963df0 h1:p6AuBbayRXU8WeBLBXXIihmJaB8IDJe9GjcEMFzJn6o= +github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231108192651-ab8d87963df0/go.mod h1:YX9Q91wqtUmfZjU4KxSwZMDJGBzppiGEW4BpAVTIMAs= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/internal/controller/datamovement_controller.go b/internal/controller/datamovement_controller.go index 6257e75d..2d631532 100644 --- a/internal/controller/datamovement_controller.go +++ b/internal/controller/datamovement_controller.go @@ -52,7 +52,6 @@ import ( "sigs.k8s.io/yaml" dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2" - dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" "github.com/NearNodeFlash/nnf-dm/internal/controller/metrics" nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" ) @@ -702,9 +701,9 @@ func (r *DataMovementReconciler) getWorkerHostnames(ctx context.Context, nodes [ // Get the Rabbit DM Worker Pods listOptions := []client.ListOption{ - client.InNamespace(dmv1alpha1.DataMovementNamespace), + client.InNamespace(nnfv1alpha1.DataMovementNamespace), client.MatchingLabels(map[string]string{ - dmv1alpha1.DataMovementWorkerLabel: "true", + nnfv1alpha1.DataMovementWorkerLabel: "true", }), } @@ -715,7 +714,7 @@ func (r *DataMovementReconciler) getWorkerHostnames(ctx context.Context, nodes [ nodeNameToHostnameMap := map[string]string{} for _, pod := range pods.Items { - nodeNameToHostnameMap[pod.Spec.NodeName] = strings.ReplaceAll(pod.Status.PodIP, ".", "-") + ".dm." + dmv1alpha1.DataMovementNamespace // TODO: make the subdomain const TODO: use nnf-dm-system const + nodeNameToHostnameMap[pod.Spec.NodeName] = strings.ReplaceAll(pod.Status.PodIP, ".", "-") + ".dm." + nnfv1alpha1.DataMovementNamespace // TODO: make the subdomain const TODO: use nnf-dm-system const } hostnames := make([]string, len(nodes)) diff --git a/internal/controller/datamovement_controller_test.go b/internal/controller/datamovement_controller_test.go index 89e1bd5c..e7c68f78 100644 --- a/internal/controller/datamovement_controller_test.go +++ b/internal/controller/datamovement_controller_test.go @@ -28,7 +28,7 @@ import ( "strings" "time" - "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" + "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" diff --git a/internal/controller/datamovementmanager_controller.go b/internal/controller/datamovementmanager_controller.go index 714ac073..0213b4f0 100644 --- a/internal/controller/datamovementmanager_controller.go +++ b/internal/controller/datamovementmanager_controller.go @@ -46,8 +46,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1" - dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" "github.com/NearNodeFlash/nnf-dm/internal/controller/metrics" + nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" ) const ( @@ -78,15 +78,15 @@ var ( } ) -// DataMovementManagerReconciler reconciles a DataMovementManager object -type DataMovementManagerReconciler struct { +// NnfDataMovementManagerReconciler reconciles a NnfDataMovementManager object +type NnfDataMovementManagerReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=dm.cray.hpe.com,resources=datamovementmanagers,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=dm.cray.hpe.com,resources=datamovementmanagers/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=dm.cray.hpe.com,resources=datamovementmanagers/finalizers,verbs=update +//+kubebuilder:rbac:groups=nnf.cray.hpe.com,resources=nnfdatamovementmanagers,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=nnf.cray.hpe.com,resources=nnfdatamovementmanagers/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=nnf.cray.hpe.com,resources=nnfdatamovementmanagers/finalizers,verbs=update // Data Movement Manager initializes the secrets used in establishing SSH connections between the data movement deployment // and the data movement daemonset describing the worker nodes. @@ -106,12 +106,12 @@ type DataMovementManagerReconciler struct { // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. -func (r *DataMovementManagerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *NnfDataMovementManagerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { log := log.FromContext(ctx) metrics.NnfDmDataMovementManagerReconcilesTotal.Inc() - manager := &dmv1alpha1.DataMovementManager{} + manager := &nnfv1alpha1.NnfDataMovementManager{} if err := r.Get(ctx, req.NamespacedName, manager); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -156,7 +156,7 @@ func (r *DataMovementManagerReconciler) Reconcile(ctx context.Context, req ctrl. return ctrl.Result{}, nil } -func (r *DataMovementManagerReconciler) createSecretIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) (err error) { +func (r *NnfDataMovementManagerReconciler) createSecretIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) (err error) { log := log.FromContext(ctx) newSecret := func() (*corev1.Secret, error) { @@ -221,7 +221,7 @@ func (r *DataMovementManagerReconciler) createSecretIfNecessary(ctx context.Cont return err } -func (r *DataMovementManagerReconciler) createOrUpdateDeploymentIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) (err error) { +func (r *NnfDataMovementManagerReconciler) createOrUpdateDeploymentIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) (err error) { log := log.FromContext(ctx) base := &appsv1.Deployment{} @@ -284,7 +284,7 @@ func (r *DataMovementManagerReconciler) createOrUpdateDeploymentIfNecessary(ctx return nil } -func (r *DataMovementManagerReconciler) createOrUpdateServiceIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) error { +func (r *NnfDataMovementManagerReconciler) createOrUpdateServiceIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) error { log := log.FromContext(ctx) service := &corev1.Service{ @@ -296,7 +296,7 @@ func (r *DataMovementManagerReconciler) createOrUpdateServiceIfNecessary(ctx con mutateFn := func() error { service.Spec.Selector = map[string]string{ - dmv1alpha1.DataMovementWorkerLabel: "true", + nnfv1alpha1.DataMovementWorkerLabel: "true", } service.Spec.ClusterIP = corev1.ClusterIPNone @@ -322,7 +322,7 @@ func (r *DataMovementManagerReconciler) createOrUpdateServiceIfNecessary(ctx con return nil } -func (r *DataMovementManagerReconciler) updateLustreFileSystemsIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) error { +func (r *NnfDataMovementManagerReconciler) updateLustreFileSystemsIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) error { log := log.FromContext(ctx) filesystems := &lusv1beta1.LustreFileSystemList{} @@ -356,7 +356,7 @@ func (r *DataMovementManagerReconciler) updateLustreFileSystemsIfNecessary(ctx c return nil } -func (r *DataMovementManagerReconciler) removeLustreFileSystemsFinalizersIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) error { +func (r *NnfDataMovementManagerReconciler) removeLustreFileSystemsFinalizersIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) error { log := log.FromContext(ctx) filesystems := &lusv1beta1.LustreFileSystemList{} @@ -419,7 +419,7 @@ func (r *DataMovementManagerReconciler) removeLustreFileSystemsFinalizersIfNeces return nil } -func (r *DataMovementManagerReconciler) createOrUpdateDaemonSetIfNecessary(ctx context.Context, manager *dmv1alpha1.DataMovementManager) error { +func (r *NnfDataMovementManagerReconciler) createOrUpdateDaemonSetIfNecessary(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) error { log := log.FromContext(ctx) filesystems := &lusv1beta1.LustreFileSystemList{} @@ -443,7 +443,7 @@ func (r *DataMovementManagerReconciler) createOrUpdateDaemonSetIfNecessary(ctx c if podTemplateSpec.Labels == nil { podTemplateSpec.Labels = make(map[string]string) } - podTemplateSpec.Labels[dmv1alpha1.DataMovementWorkerLabel] = "true" + podTemplateSpec.Labels[nnfv1alpha1.DataMovementWorkerLabel] = "true" podSpec := &podTemplateSpec.Spec podSpec.NodeSelector = manager.Spec.Selector.MatchLabels @@ -479,7 +479,7 @@ func (r *DataMovementManagerReconciler) createOrUpdateDaemonSetIfNecessary(ctx c return nil } -func setupSSHAuthVolumes(manager *dmv1alpha1.DataMovementManager, podSpec *corev1.PodSpec) { +func setupSSHAuthVolumes(manager *nnfv1alpha1.NnfDataMovementManager, podSpec *corev1.PodSpec) { mode := int32(0600) podSpec.Volumes = append(podSpec.Volumes, corev1.Volume{ Name: sshAuthVolume, @@ -502,7 +502,7 @@ func setupSSHAuthVolumes(manager *dmv1alpha1.DataMovementManager, podSpec *corev } } -func setupLustreVolumes(ctx context.Context, manager *dmv1alpha1.DataMovementManager, podSpec *corev1.PodSpec, fileSystems []lusv1beta1.LustreFileSystem) { +func setupLustreVolumes(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager, podSpec *corev1.PodSpec, fileSystems []lusv1beta1.LustreFileSystem) { log := log.FromContext(ctx) // Setup Volumes / Volume Mounts for accessing global Lustre file systems @@ -572,10 +572,10 @@ func findManagerContainer(podSpec *corev1.PodSpec) (*corev1.Container, error) { } // SetupWithManager sets up the controller with the Manager. -func (r *DataMovementManagerReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *NnfDataMovementManagerReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&dmv1alpha1.DataMovementManager{}). + For(&nnfv1alpha1.NnfDataMovementManager{}). Owns(&corev1.Secret{}). Owns(&corev1.Service{}). Owns(&appsv1.Deployment{}). @@ -587,7 +587,7 @@ func (r *DataMovementManagerReconciler) SetupWithManager(mgr ctrl.Manager) error { NamespacedName: types.NamespacedName{ Name: "nnf-dm-manager-controller-manager", - Namespace: dmv1alpha1.DataMovementNamespace, + Namespace: nnfv1alpha1.DataMovementNamespace, }, }, } diff --git a/internal/controller/datamovementmanager_controller_test.go b/internal/controller/datamovementmanager_controller_test.go index 6a1d161f..925e53c4 100644 --- a/internal/controller/datamovementmanager_controller_test.go +++ b/internal/controller/datamovementmanager_controller_test.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" lusv1beta1 "github.com/NearNodeFlash/lustre-fs-operator/api/v1beta1" - dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" + nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" ) var _ = Describe("Data Movement Manager Test" /*Ordered, (Ginkgo v2)*/, func() { @@ -40,14 +40,14 @@ var _ = Describe("Data Movement Manager Test" /*Ordered, (Ginkgo v2)*/, func() { var lustre *lusv1beta1.LustreFileSystem ns := &corev1.Namespace{} deployment := &appsv1.Deployment{} - mgr := &dmv1alpha1.DataMovementManager{} + mgr := &nnfv1alpha1.NnfDataMovementManager{} labels := map[string]string{"control-plane": "controller-manager"} /* BeforeAll (Ginkgo v2)*/ BeforeEach(func() { ns = &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ - Name: dmv1alpha1.DataMovementNamespace, + Name: nnfv1alpha1.DataMovementNamespace, }, } @@ -58,7 +58,7 @@ var _ = Describe("Data Movement Manager Test" /*Ordered, (Ginkgo v2)*/, func() { deployment = &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "nnf-dm-manager-controller-manager", - Namespace: dmv1alpha1.DataMovementNamespace, + Namespace: nnfv1alpha1.DataMovementNamespace, }, Spec: appsv1.DeploymentSpec{ Selector: &metav1.LabelSelector{ @@ -86,12 +86,12 @@ var _ = Describe("Data Movement Manager Test" /*Ordered, (Ginkgo v2)*/, func() { }) BeforeEach(func() { - mgr = &dmv1alpha1.DataMovementManager{ + mgr = &nnfv1alpha1.NnfDataMovementManager{ ObjectMeta: metav1.ObjectMeta{ Name: "nnf-dm-manager-controller-manager", - Namespace: dmv1alpha1.DataMovementNamespace, + Namespace: nnfv1alpha1.DataMovementNamespace, }, - Spec: dmv1alpha1.DataMovementManagerSpec{ + Spec: nnfv1alpha1.NnfDataMovementManagerSpec{ Selector: metav1.LabelSelector{ MatchLabels: labels, }, diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 02b3d6ea..251094e7 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -43,8 +43,6 @@ import ( nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1" _ "github.com/NearNodeFlash/nnf-sos/config/crd/bases" - - dmv1alpha1 "github.com/NearNodeFlash/nnf-dm/api/v1alpha1" //+kubebuilder:scaffold:imports ) @@ -93,7 +91,6 @@ var _ = BeforeSuite(func() { CRDDirectoryPaths: []string{ filepath.Join("..", "..", "vendor", "github.com", "NearNodeFlash", "lustre-fs-operator", "config", "crd", "bases"), filepath.Join("..", "..", "vendor", "github.com", "NearNodeFlash", "nnf-sos", "config", "crd", "bases"), - filepath.Join("..", "..", "config", "crd", "bases"), }, ErrorIfCRDPathMissing: true, } @@ -108,9 +105,6 @@ var _ = BeforeSuite(func() { err = nnfv1alpha1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = dmv1alpha1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - //+kubebuilder:scaffold:scheme k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) @@ -129,7 +123,7 @@ var _ = BeforeSuite(func() { }) Expect(err).NotTo(HaveOccurred()) - err = (&DataMovementManagerReconciler{ + err = (&NnfDataMovementManagerReconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), }).SetupWithManager(k8sManager) diff --git a/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovement_types.go b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovement_types.go index 295662ef..6c39f10c 100644 --- a/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovement_types.go +++ b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovement_types.go @@ -35,7 +35,7 @@ const ( DataMovementNamespace = "nnf-dm-system" ) -// NnfDataMovementSpec defines the desired state of DataMovement +// NnfDataMovementSpec defines the desired state of NnfDataMovement type NnfDataMovementSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file @@ -66,7 +66,7 @@ type NnfDataMovementSpec struct { UserConfig *NnfDataMovementConfig `json:"userConfig,omitempty"` } -// DataMovementSpecSourceDestination defines the desired source or destination of data movement +// NnfDataMovementSpecSourceDestination defines the desired source or destination of data movement type NnfDataMovementSpecSourceDestination struct { // Path describes the location of the user data relative to the storage instance @@ -110,7 +110,7 @@ type NnfDataMovementConfig struct { MaxSlots *int `json:"maxSlots,omitempty"` } -// DataMovementCommandStatus defines the observed status of the underlying data movement +// NnfDataMovementCommandStatus defines the observed status of the underlying data movement // command (MPI File Utils' `dcp` command). type NnfDataMovementCommandStatus struct { // The command that was executed during data movement. @@ -134,7 +134,7 @@ type NnfDataMovementCommandStatus struct { LastMessageTime metav1.MicroTime `json:"lastMessageTime,omitempty"` } -// DataMovementStatus defines the observed state of DataMovement +// NnfDataMovementStatus defines the observed state of NnfDataMovement type NnfDataMovementStatus struct { // Current state of data movement. // +kubebuilder:validation:Enum=Starting;Running;Finished @@ -188,7 +188,7 @@ const ( //+kubebuilder:printcolumn:name="ERROR",type="string",JSONPath=".status.error.severity" //+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// NnfDataMovement is the Schema for the datamovements API +// NnfDataMovement is the Schema for the nnfdatamovements API type NnfDataMovement struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/api/v1alpha1/datamovementmanager_types.go b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovementmanager_types.go similarity index 78% rename from api/v1alpha1/datamovementmanager_types.go rename to vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovementmanager_types.go index 6a8f400c..c9b0941d 100644 --- a/api/v1alpha1/datamovementmanager_types.go +++ b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/nnf_datamovementmanager_types.go @@ -25,16 +25,14 @@ import ( ) const ( - DataMovementNamespace = "nnf-dm-system" - DataMovementWorkerLabel = "dm.cray.hpe.com/worker" ) // 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. -// DataMovementManagerSpec defines the desired state of DataMovementManager -type DataMovementManagerSpec struct { +// NnfDataMovementManagerSpec defines the desired state of NnfDataMovementManager +type NnfDataMovementManagerSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file @@ -53,8 +51,8 @@ type DataMovementManagerSpec struct { MountPath string `json:"mountPath"` } -// DataMovementManagerStatus defines the observed state of DataMovementManager -type DataMovementManagerStatus struct { +// NnfDataMovementManagerStatus defines the observed state of NnfDataMovementManager +type NnfDataMovementManagerStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file @@ -68,24 +66,24 @@ type DataMovementManagerStatus struct { //+kubebuilder:printcolumn:name="READY",type="boolean",JSONPath=".status.ready",description="True if manager readied all resoures" //+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// DataMovementManager is the Schema for the datamovementmanagers API -type DataMovementManager struct { +// NnfDataMovementManager is the Schema for the nnfdatamovementmanagers API +type NnfDataMovementManager struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec DataMovementManagerSpec `json:"spec,omitempty"` - Status DataMovementManagerStatus `json:"status,omitempty"` + Spec NnfDataMovementManagerSpec `json:"spec,omitempty"` + Status NnfDataMovementManagerStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// DataMovementManagerList contains a list of DataMovementManager -type DataMovementManagerList struct { +// NnfDataMovementManagerList contains a list of NnfDataMovementManager +type NnfDataMovementManagerList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []DataMovementManager `json:"items"` + Items []NnfDataMovementManager `json:"items"` } func init() { - SchemeBuilder.Register(&DataMovementManager{}, &DataMovementManagerList{}) + SchemeBuilder.Register(&NnfDataMovementManager{}, &NnfDataMovementManagerList{}) } diff --git a/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/zz_generated.deepcopy.go index 6c75078e..3be51741 100644 --- a/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha1/zz_generated.deepcopy.go @@ -400,6 +400,97 @@ func (in *NnfDataMovementList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NnfDataMovementManager) DeepCopyInto(out *NnfDataMovementManager) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NnfDataMovementManager. +func (in *NnfDataMovementManager) DeepCopy() *NnfDataMovementManager { + if in == nil { + return nil + } + out := new(NnfDataMovementManager) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NnfDataMovementManager) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NnfDataMovementManagerList) DeepCopyInto(out *NnfDataMovementManagerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NnfDataMovementManager, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NnfDataMovementManagerList. +func (in *NnfDataMovementManagerList) DeepCopy() *NnfDataMovementManagerList { + if in == nil { + return nil + } + out := new(NnfDataMovementManagerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NnfDataMovementManagerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NnfDataMovementManagerSpec) DeepCopyInto(out *NnfDataMovementManagerSpec) { + *out = *in + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NnfDataMovementManagerSpec. +func (in *NnfDataMovementManagerSpec) DeepCopy() *NnfDataMovementManagerSpec { + if in == nil { + return nil + } + out := new(NnfDataMovementManagerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NnfDataMovementManagerStatus) DeepCopyInto(out *NnfDataMovementManagerStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NnfDataMovementManagerStatus. +func (in *NnfDataMovementManagerStatus) DeepCopy() *NnfDataMovementManagerStatus { + if in == nil { + return nil + } + out := new(NnfDataMovementManagerStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NnfDataMovementSpec) DeepCopyInto(out *NnfDataMovementSpec) { *out = *in diff --git a/config/crd/bases/dm.cray.hpe.com_datamovementmanagers.yaml b/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml similarity index 99% rename from config/crd/bases/dm.cray.hpe.com_datamovementmanagers.yaml rename to vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml index 97d88807..6c7dab88 100644 --- a/config/crd/bases/dm.cray.hpe.com_datamovementmanagers.yaml +++ b/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml @@ -4,14 +4,14 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.13.0 - name: datamovementmanagers.dm.cray.hpe.com + name: nnfdatamovementmanagers.nnf.cray.hpe.com spec: - group: dm.cray.hpe.com + group: nnf.cray.hpe.com names: - kind: DataMovementManager - listKind: DataMovementManagerList - plural: datamovementmanagers - singular: datamovementmanager + kind: NnfDataMovementManager + listKind: NnfDataMovementManagerList + plural: nnfdatamovementmanagers + singular: nnfdatamovementmanager scope: Namespaced versions: - additionalPrinterColumns: @@ -25,7 +25,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: DataMovementManager is the Schema for the datamovementmanagers + description: NnfDataMovementManager is the Schema for the nnfdatamovementmanagers API properties: apiVersion: @@ -41,7 +41,7 @@ spec: metadata: type: object spec: - description: DataMovementManagerSpec defines the desired state of DataMovementManager + description: NnfDataMovementManagerSpec defines the desired state of NnfDataMovementManager properties: hostPath: description: Host Path defines the directory location of shared mounts @@ -7633,7 +7633,8 @@ spec: - template type: object status: - description: DataMovementManagerStatus defines the observed state of DataMovementManager + description: NnfDataMovementManagerStatus defines the observed state of + NnfDataMovementManager properties: ready: description: Ready indicates that the Data Movement Manager has achieved diff --git a/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml b/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml index 2440aa6a..5c7e5128 100644 --- a/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml +++ b/vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml @@ -32,7 +32,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: NnfDataMovement is the Schema for the datamovements API + description: NnfDataMovement is the Schema for the nnfdatamovements API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -47,7 +47,7 @@ spec: metadata: type: object spec: - description: NnfDataMovementSpec defines the desired state of DataMovement + description: NnfDataMovementSpec defines the desired state of NnfDataMovement properties: cancel: default: false @@ -204,7 +204,7 @@ spec: type: integer type: object status: - description: DataMovementStatus defines the observed state of DataMovement + description: NnfDataMovementStatus defines the observed state of NnfDataMovement properties: commandStatus: description: CommandStatus reflects the current status of the underlying diff --git a/vendor/modules.txt b/vendor/modules.txt index b6923ea7..f29b69d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,7 +10,7 @@ github.com/NearNodeFlash/lustre-fs-operator/config/crd/bases # github.com/NearNodeFlash/nnf-ec v0.0.0-20231010162453-a8168bb6a52f ## explicit; go 1.19 github.com/NearNodeFlash/nnf-ec/pkg/rfsf/pkg/models -# github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231031205956-621786eb596f +# github.com/NearNodeFlash/nnf-sos v0.0.1-0.20231108192651-ab8d87963df0 ## explicit; go 1.19 github.com/NearNodeFlash/nnf-sos/api/v1alpha1 github.com/NearNodeFlash/nnf-sos/config/crd/bases From bbae70e62c1fe5d527ca2d3f5a3ff74783c4c59d Mon Sep 17 00:00:00 2001 From: Blake Devcich Date: Mon, 13 Nov 2023 10:10:02 -0600 Subject: [PATCH 2/2] Removed stale CRD section of readme Signed-off-by: Blake Devcich --- Readme.md | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/Readme.md b/Readme.md index 4bd0f9db..c9c32a8c 100644 --- a/Readme.md +++ b/Readme.md @@ -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 NnfDataMovementManager --resource --controller - -```