diff --git a/Dockerfile b/Dockerfile index 980c71c..b576bf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,15 +12,15 @@ COPY vendor/ vendor/ COPY config/ config/ # Copy the go source -COPY main.go main.go -COPY controllers/ controllers/ +COPY cmd/ cmd/ +COPY internal/ internal/ # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go FROM builder as testing WORKDIR /workspace diff --git a/Makefile b/Makefile index e39d891..2abaaee 100644 --- a/Makefile +++ b/Makefile @@ -90,11 +90,11 @@ test: manifests generate fmt vet envtest ## Run tests. .PHONY: build build: generate fmt vet ## Build manager binary. - go build -o bin/manager main.go + go build -o bin/manager cmd/main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. - go run ./main.go + go run cmd/main.go .PHONY: container-unit-test container-unit-test: VERSION ?= $(shell cat .version) @@ -184,7 +184,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions KUSTOMIZE_VERSION ?= v5.1.1 -CONTROLLER_TOOLS_VERSION ?= v0.12.0 +CONTROLLER_TOOLS_VERSION ?= v0.13.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize diff --git a/PROJECT b/PROJECT index 1372496..7948c96 100644 --- a/PROJECT +++ b/PROJECT @@ -1,12 +1,12 @@ domain: cray.hpe.com layout: -- go.kubebuilder.io/v3 +- go.kubebuilder.io/v4 projectName: dws-test-driver repo: github.com/DataWorkflowServices/dws-test-driver resources: - controller: true - domain: cray.hpe.com - group: dws + domain: github.io + group: dataworkflowservices kind: Workflow - version: v1alpha1 + version: v1alpha2 version: "3" diff --git a/main.go b/cmd/main.go similarity index 98% rename from main.go rename to cmd/main.go index a7d7f3e..9065d27 100644 --- a/main.go +++ b/cmd/main.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/healthz" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "github.com/DataWorkflowServices/dws-test-driver/controllers" + controllers "github.com/DataWorkflowServices/dws-test-driver/internal/controller" //+kubebuilder:scaffold:imports "go.uber.org/zap" "go.uber.org/zap/zapcore" diff --git a/go.mod b/go.mod index 495c25d..4678f94 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/DataWorkflowServices/dws-test-driver go 1.19 require ( - github.com/DataWorkflowServices/dws v0.0.1-0.20231010162938-b6d65b00cad6 + github.com/DataWorkflowServices/dws v0.0.1-0.20231031201121-13a5a69a969e github.com/ghodss/yaml v1.0.0 github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 diff --git a/go.sum b/go.sum index eb4bd64..fe69ba3 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -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/DataWorkflowServices/dws v0.0.1-0.20231031201121-13a5a69a969e h1:QhDrVNQ6zyJcnP0+I147Ei19QAoOL5sDvkjNTkRbELA= +github.com/DataWorkflowServices/dws v0.0.1-0.20231031201121-13a5a69a969e/go.mod h1:grHFCu0CoUK8exzS57r6cdf4qHpG1Pv5nl0n7evpaUM= 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/controllers/suite_test.go b/internal/controller/suite_test.go similarity index 94% rename from controllers/suite_test.go rename to internal/controller/suite_test.go index f7c11e3..ed2378d 100644 --- a/controllers/suite_test.go +++ b/internal/controller/suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" @@ -81,7 +81,7 @@ var _ = BeforeSuite(func() { ctx, cancel = context.WithCancel(context.TODO()) webhookPaths := []string{ - filepath.Join("..", "vendor", "github.com", "DataWorkflowServices", "dws", "config", "webhook"), + filepath.Join("..", "..", "vendor", "github.com", "DataWorkflowServices", "dws", "config", "webhook"), } By("bootstrapping test environment") @@ -90,7 +90,7 @@ var _ = BeforeSuite(func() { ErrorIfCRDPathMissing: true, CRDDirectoryPaths: []string{ // filepath.Join("..", "config", "crd", "bases"), - filepath.Join("..", "vendor", "github.com", "DataWorkflowServices", "dws", "config", "crd", "bases"), + filepath.Join("..", "..", "vendor", "github.com", "DataWorkflowServices", "dws", "config", "crd", "bases"), }, } @@ -146,7 +146,7 @@ var _ = BeforeSuite(func() { }() // Load the NNF ruleset to enable the webhook to parse #DW directives - ruleset, err := loadTestDWDirectiveRuleset(filepath.Join("..", "config", "dws", "test-ruleset.yaml")) + ruleset, err := loadTestDWDirectiveRuleset(filepath.Join("..", "..", "config", "dws", "test-ruleset.yaml")) Expect(err).ToNot(HaveOccurred()) ruleset.Namespace = "default" diff --git a/controllers/workflow_controller.go b/internal/controller/workflow_controller.go similarity index 99% rename from controllers/workflow_controller.go rename to internal/controller/workflow_controller.go index 2cb5759..7cb8e8b 100644 --- a/controllers/workflow_controller.go +++ b/internal/controller/workflow_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/workflow_controller_test.go b/internal/controller/workflow_controller_test.go similarity index 99% rename from controllers/workflow_controller_test.go rename to internal/controller/workflow_controller_test.go index 5536a40..7a6b58f 100644 --- a/controllers/workflow_controller_test.go +++ b/internal/controller/workflow_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/vendor/github.com/DataWorkflowServices/dws/api/v1alpha2/zz_generated.deepcopy.go b/vendor/github.com/DataWorkflowServices/dws/api/v1alpha2/zz_generated.deepcopy.go index 311f646..6cd8777 100644 --- a/vendor/github.com/DataWorkflowServices/dws/api/v1alpha2/zz_generated.deepcopy.go +++ b/vendor/github.com/DataWorkflowServices/dws/api/v1alpha2/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* * Copyright 2023 Hewlett Packard Enterprise Development LP diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_clientmounts.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_clientmounts.yaml index 7bb9232..bdbf1f0 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_clientmounts.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_clientmounts.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: clientmounts.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_computes.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_computes.yaml index 87bfe94..71098f3 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_computes.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_computes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: computes.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_directivebreakdowns.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_directivebreakdowns.yaml index 18015f2..b437d16 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_directivebreakdowns.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_directivebreakdowns.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: directivebreakdowns.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_dwdirectiverules.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_dwdirectiverules.yaml index c178107..7dc97f7 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_dwdirectiverules.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_dwdirectiverules.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: dwdirectiverules.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_persistentstorageinstances.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_persistentstorageinstances.yaml index c0d1475..12d6312 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_persistentstorageinstances.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_persistentstorageinstances.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: persistentstorageinstances.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_servers.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_servers.yaml index 134bd56..2e4a2c2 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_servers.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_servers.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: servers.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_storages.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_storages.yaml index 2f89e87..cdf2bda 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_storages.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_storages.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: storages.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_systemconfigurations.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_systemconfigurations.yaml index 61da5a2..4b2e1f1 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_systemconfigurations.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_systemconfigurations.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: systemconfigurations.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_workflows.yaml b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_workflows.yaml index 5b90590..084b281 100644 --- a/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_workflows.yaml +++ b/vendor/github.com/DataWorkflowServices/dws/config/crd/bases/dataworkflowservices.github.io_workflows.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.13.0 name: workflows.dataworkflowservices.github.io spec: group: dataworkflowservices.github.io diff --git a/vendor/github.com/DataWorkflowServices/dws/controllers/workflow_controller.go b/vendor/github.com/DataWorkflowServices/dws/controllers/workflow_controller.go index 81ae02d..ba08ea1 100644 --- a/vendor/github.com/DataWorkflowServices/dws/controllers/workflow_controller.go +++ b/vendor/github.com/DataWorkflowServices/dws/controllers/workflow_controller.go @@ -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" ) diff --git a/vendor/github.com/DataWorkflowServices/dws/controllers/metrics/metrics.go b/vendor/github.com/DataWorkflowServices/dws/internal/controller/metrics/metrics.go similarity index 100% rename from vendor/github.com/DataWorkflowServices/dws/controllers/metrics/metrics.go rename to vendor/github.com/DataWorkflowServices/dws/internal/controller/metrics/metrics.go diff --git a/vendor/github.com/DataWorkflowServices/dws/utils/dwdparse/zz_generated.deepcopy.go b/vendor/github.com/DataWorkflowServices/dws/utils/dwdparse/zz_generated.deepcopy.go index d27486b..f0fb451 100644 --- a/vendor/github.com/DataWorkflowServices/dws/utils/dwdparse/zz_generated.deepcopy.go +++ b/vendor/github.com/DataWorkflowServices/dws/utils/dwdparse/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* * Copyright 2023 Hewlett Packard Enterprise Development LP diff --git a/vendor/modules.txt b/vendor/modules.txt index e4387ab..d5356fc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,10 +1,10 @@ -# github.com/DataWorkflowServices/dws v0.0.1-0.20231010162938-b6d65b00cad6 +# github.com/DataWorkflowServices/dws v0.0.1-0.20231031201121-13a5a69a969e ## explicit; go 1.19 github.com/DataWorkflowServices/dws/api/v1alpha2 github.com/DataWorkflowServices/dws/config/crd/bases github.com/DataWorkflowServices/dws/config/webhook github.com/DataWorkflowServices/dws/controllers -github.com/DataWorkflowServices/dws/controllers/metrics +github.com/DataWorkflowServices/dws/internal/controller/metrics github.com/DataWorkflowServices/dws/utils/dwdparse github.com/DataWorkflowServices/dws/utils/updater # github.com/beorn7/perks v1.0.1