Skip to content

Commit

Permalink
Update the project for kubebuilder go/v4 layout
Browse files Browse the repository at this point in the history
Change the layout to follow the Standard Go Project Layout, as described
in https://book.kubebuilder.io/migration/v3vsv4.  This allows newer releases
of kubebuilder to be used with this repo.

Signed-off-by: Dean Roehrich <[email protected]>
  • Loading branch information
roehrich-hpe committed Oct 20, 2023
1 parent 0bc5534 commit fe36c6d
Show file tree
Hide file tree
Showing 52 changed files with 163 additions and 107 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP
# Copyright 2020-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,
Expand All @@ -24,14 +24,14 @@ COPY go.mod go.mod
COPY go.sum go.sum

# Copy the go source
COPY main.go main.go
COPY cmd/ cmd/
COPY api/ api/
COPY controllers/ controllers/
COPY internal/ internal/
COPY vendor/ vendor/
COPY config/ config/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/main.go

ENTRYPOINT ["/bin/sh"]

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ vet: ## Run go vet against code.
##@ Test

# Explicitly specifying directories to test here to avoid running tests in .dws-operator for the time being.
# ./controllers/...
# ./internal/...
# ./api/...
# Below is a list of ginkgo test flags that may be used to generate different test patterns.
# Specifying 'count=1' is the idiomatic way to disable test caching
Expand Down Expand Up @@ -214,10 +214,10 @@ ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
# https://onsi.github.io/gomega/ says: "By default, Eventually will poll every 10 milliseconds for up to 1 second"
EVENTUALLY_TIMEOUT ?= "20s"
EVENTUALLY_INTERVAL ?= "100ms"
TESTDIRS ?= controllers api
TESTDIRS ?= internal api
FAILFAST ?= no
test: manifests generate fmt vet envtest ## Run tests.
find controllers -name "*.db" -type d -exec rm -rf {} +
find internal -name "*.db" -type d -exec rm -rf {} +
source test-tools.sh; prefix_webhook_names config/webhook ${ENVTEST_ASSETS_DIR}/webhook
if [[ "${FAILFAST}" == yes ]]; then \
failfast="-ginkgo.fail-fast"; \
Expand All @@ -233,10 +233,10 @@ test: manifests generate fmt vet envtest ## Run tests.
##@ Build

build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go
go build -o bin/manager cmd/main.go

run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
go run cmd/main.go

docker-build: VERSION ?= $(shell cat .version)
docker-build: .version ## Build docker image with the manager.
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
domain: cray.hpe.com
layout:
- go.kubebuilder.io/v3
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
Expand Down
54 changes: 27 additions & 27 deletions main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (

nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"

"github.com/NearNodeFlash/nnf-sos/controllers"
"github.com/NearNodeFlash/nnf-sos/internal/controller"

//+kubebuilder:scaffold:imports

Expand Down Expand Up @@ -179,36 +179,36 @@ func (*nodeLocalController) SetNamespaces(options *ctrl.Options) {
}

func (c *nodeLocalController) SetupReconcilers(mgr manager.Manager, opts *nnf.Options) error {
if err := (&controllers.NnfNodeReconciler{
if err := (&controller.NnfNodeReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfNode"),
Log: ctrl.Log.WithName("controller").WithName("NnfNode"),
Scheme: mgr.GetScheme(),
NamespacedName: types.NamespacedName{Name: controllers.NnfNlcResourceName, Namespace: os.Getenv("NNF_NODE_NAME")},
NamespacedName: types.NamespacedName{Name: controller.NnfNlcResourceName, Namespace: os.Getenv("NNF_NODE_NAME")},
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfNodeECDataReconciler{
if err := (&controller.NnfNodeECDataReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
NamespacedName: types.NamespacedName{Name: controllers.NnfNodeECDataResourceName, Namespace: os.Getenv("NNF_NODE_NAME")},
NamespacedName: types.NamespacedName{Name: controller.NnfNodeECDataResourceName, Namespace: os.Getenv("NNF_NODE_NAME")},
Options: opts,
RawLog: ctrl.Log,
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfClientMountReconciler{
if err := (&controller.NnfClientMountReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfClientMount"),
Log: ctrl.Log.WithName("controller").WithName("NnfClientMount"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

return (&controllers.NnfNodeStorageReconciler{
return (&controller.NnfNodeStorageReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfNodeStorage"),
Log: ctrl.Log.WithName("controller").WithName("NnfNodeStorage"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr)
}
Expand All @@ -220,73 +220,73 @@ func (*storageController) GetType() string { return StorageControlle
func (*storageController) SetNamespaces(*ctrl.Options) { /* nop */ }

func (c *storageController) SetupReconcilers(mgr manager.Manager, opts *nnf.Options) error {
if err := (&controllers.NnfSystemConfigurationReconciler{
if err := (&controller.NnfSystemConfigurationReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfSystemConfiguration"),
Log: ctrl.Log.WithName("controller").WithName("NnfSystemConfiguration"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfPortManagerReconciler{
if err := (&controller.NnfPortManagerReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
// Note: Log is built into controller-runtime
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfWorkflowReconciler{
if err := (&controller.NnfWorkflowReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfWorkflow"),
Log: ctrl.Log.WithName("controller").WithName("NnfWorkflow"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.DirectiveBreakdownReconciler{
if err := (&controller.DirectiveBreakdownReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("DirectiveBreakdown"),
Log: ctrl.Log.WithName("controller").WithName("DirectiveBreakdown"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.PersistentStorageReconciler{
if err := (&controller.PersistentStorageReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("PersistentStorage"),
Log: ctrl.Log.WithName("controller").WithName("PersistentStorage"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.DWSStorageReconciler{
if err := (&controller.DWSStorageReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Storage"),
Log: ctrl.Log.WithName("controller").WithName("Storage"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.DWSServersReconciler{
if err := (&controller.DWSServersReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Servers"),
Log: ctrl.Log.WithName("controller").WithName("Servers"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfAccessReconciler{
if err := (&controller.NnfAccessReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfAccess"),
Log: ctrl.Log.WithName("controller").WithName("NnfAccess"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
}

if err := (&controllers.NnfStorageReconciler{
if err := (&controller.NnfStorageReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NnfStorage"),
Log: ctrl.Log.WithName("controller").WithName("NnfStorage"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ module github.com/NearNodeFlash/nnf-sos

go 1.19

replace github.com/NearNodeFlash/lustre-fs-operator => ../lustre-fs-oper-2.git

replace github.com/DataWorkflowServices/dws => ../dws-a.git

require (
github.com/DataWorkflowServices/dws v0.0.1-0.20231010162938-b6d65b00cad6
github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231010163846-1ecbc574e6af
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataWorkflowServices/dws v0.0.1-0.20231010162938-b6d65b00cad6 h1:+j1ex3+PaJApQzCR7reMIJULPL+a7uOHYRJdSQVRWhA=
github.com/DataWorkflowServices/dws v0.0.1-0.20231010162938-b6d65b00cad6/go.mod h1:grHFCu0CoUK8exzS57r6cdf4qHpG1Pv5nl0n7evpaUM=
github.com/HewlettPackard/structex v1.0.4 h1:RVTdN5FWhDWr1IkjllU8wxuLjISo4gr6u5ryZpzyHcA=
github.com/HewlettPackard/structex v1.0.4/go.mod h1:3frC4RY/cPsP/4+N8rkxsNAGlQwHV+zDC7qvrN+N+rE=
github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231010163846-1ecbc574e6af h1:ZBNdD/ax/v7QWHCDazyYpYCVxz8E1hKmqU7nezmYGs0=
github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20231010163846-1ecbc574e6af/go.mod h1:stbNYHHfXr9Ep6wp6fJL4gAW1TKGuouFo682nhU8Eec=
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/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021, 2022 Hewlett Packard Enterprise Development LP
* Copyright 2021-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,
Expand All @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"math"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand All @@ -43,7 +43,7 @@ import (
"github.com/DataWorkflowServices/dws/utils/dwdparse"
"github.com/DataWorkflowServices/dws/utils/updater"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
"github.com/NearNodeFlash/nnf-sos/controllers/metrics"
"github.com/NearNodeFlash/nnf-sos/internal/controller/metrics"
)

// Define condition values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
package controllers
/*
* Copyright 2022-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.
*/

package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand All @@ -43,7 +43,7 @@ import (
dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
"github.com/DataWorkflowServices/dws/utils/updater"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
"github.com/NearNodeFlash/nnf-sos/controllers/metrics"
"github.com/NearNodeFlash/nnf-sos/internal/controller/metrics"
)

// DWSServersReconciler reconciles a DWS Servers object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down Expand Up @@ -46,7 +46,7 @@ import (
dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
"github.com/DataWorkflowServices/dws/utils/updater"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
"github.com/NearNodeFlash/nnf-sos/controllers/metrics"
"github.com/NearNodeFlash/nnf-sos/internal/controller/metrics"
)

// NnfAccessReconciler reconciles a NnfAccess object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand All @@ -43,7 +43,7 @@ import (
"github.com/DataWorkflowServices/dws/utils/updater"
sf "github.com/NearNodeFlash/nnf-ec/pkg/rfsf/pkg/models"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
"github.com/NearNodeFlash/nnf-sos/controllers/metrics"
"github.com/NearNodeFlash/nnf-sos/internal/controller/metrics"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down Expand Up @@ -50,7 +50,7 @@ import (
dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
"github.com/DataWorkflowServices/dws/utils/updater"
nnfv1alpha1 "github.com/NearNodeFlash/nnf-sos/api/v1alpha1"
"github.com/NearNodeFlash/nnf-sos/controllers/metrics"
"github.com/NearNodeFlash/nnf-sos/internal/controller/metrics"
)

const (
Expand Down
Loading

0 comments on commit fe36c6d

Please sign in to comment.