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 18, 2023
1 parent cbe7fd0 commit c754dba
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 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,16 +24,16 @@ 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 mount-daemon/ mount-daemon/
COPY utils/ utils/
COPY vendor/ vendor/
COPY github/cluster-api/util/conversion/ github/cluster-api/util/conversion/

# 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

FROM builder as testing
WORKDIR /workspace
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ build-daemon: manifests generate fmt vet ## Build standalone clientMount daemon
GOOS=linux GOARCH=amd64 go build -ldflags="-X '$(PACKAGE).version=$(RPM_VERSION)'" -o bin/clientmountd mount-daemon/main.go

build: manifests 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 manifests generate fmt vet ## 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
Expand Up @@ -4,7 +4,7 @@
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: github.io
layout:
- go.kubebuilder.io/v3
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
Expand Down
6 changes: 3 additions & 3 deletions main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

dwsv1alpha1 "github.com/DataWorkflowServices/dws/api/v1alpha1"
dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
"github.com/DataWorkflowServices/dws/controllers"
"github.com/DataWorkflowServices/dws/internal/controller"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -87,7 +87,7 @@ func main() {

switch mode {
case "controller":
if err = (&controllers.WorkflowReconciler{
if err = (&controller.WorkflowReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Workflow"),
Scheme: mgr.GetScheme(),
Expand All @@ -97,7 +97,7 @@ func main() {
}

if os.Getenv("ENVIRONMENT") == "kind" {
if err = (&controllers.ClientMountReconciler{
if err = (&controller.ClientMountReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("ClientMount"),
Scheme: mgr.GetScheme(),
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 @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controllers
package controller

import (
"context"
Expand Down Expand Up @@ -82,9 +82,9 @@ var _ = BeforeSuite(func() {

testEnv = &envtest.Environment{
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "config", "webhook")},
Paths: []string{filepath.Join("..", "..", "config", "webhook")},
},
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},

CRDInstallOptions: envtest.CRDInstallOptions{
// This adds the conversion webhook configuration to
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 @@ -38,7 +38,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
"github.com/DataWorkflowServices/dws/controllers/metrics"
"github.com/DataWorkflowServices/dws/internal/controller/metrics"
"github.com/DataWorkflowServices/dws/utils/updater"
)

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

0 comments on commit c754dba

Please sign in to comment.