diff --git a/Dockerfile b/Dockerfile index 5a355c21..7be3cae2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN go mod download # Copy the go source COPY main.go main.go -COPY api/ api/ +COPY apis/ apis/ COPY controllers/ controllers/ # Build diff --git a/PROJECT b/PROJECT index 59148e38..67c78109 100644 --- a/PROJECT +++ b/PROJECT @@ -1,6 +1,7 @@ domain: zachfi layout: - go.kubebuilder.io/v3 +multigroup: true projectName: nodemanager repo: github.com/zachfi/nodemanager resources: @@ -11,7 +12,7 @@ resources: domain: zachfi group: common kind: ConfigSet - path: github.com/zachfi/nodemanager/api/v1 + path: github.com/zachfi/nodemanager/apis/common/v1 version: v1 - api: crdVersion: v1 @@ -20,6 +21,6 @@ resources: domain: zachfi group: common kind: ManagedNode - path: github.com/zachfi/nodemanager/api/v1 + path: github.com/zachfi/nodemanager/apis/common/v1 version: v1 version: "3" diff --git a/api/v1/configset_types.go b/apis/common/v1/configset_types.go similarity index 100% rename from api/v1/configset_types.go rename to apis/common/v1/configset_types.go diff --git a/api/v1/groupversion_info.go b/apis/common/v1/groupversion_info.go similarity index 100% rename from api/v1/groupversion_info.go rename to apis/common/v1/groupversion_info.go diff --git a/api/v1/managednode_types.go b/apis/common/v1/managednode_types.go similarity index 100% rename from api/v1/managednode_types.go rename to apis/common/v1/managednode_types.go diff --git a/api/v1/zz_generated.deepcopy.go b/apis/common/v1/zz_generated.deepcopy.go similarity index 100% rename from api/v1/zz_generated.deepcopy.go rename to apis/common/v1/zz_generated.deepcopy.go diff --git a/controllers/common.go b/controllers/common/common.go similarity index 97% rename from controllers/common.go rename to controllers/common/common.go index 3813dab2..0588f3d3 100644 --- a/controllers/common.go +++ b/controllers/common/common.go @@ -1,11 +1,11 @@ -package controllers +package common import ( "context" "fmt" "os" - commonv1 "github.com/zachfi/nodemanager/api/v1" + commonv1 "github.com/zachfi/nodemanager/apis/common/v1" "github.com/go-logr/logr" "github.com/pkg/errors" diff --git a/controllers/configset_controller.go b/controllers/common/configset_controller.go similarity index 99% rename from controllers/configset_controller.go rename to controllers/common/configset_controller.go index 0f902496..a1c35fe6 100644 --- a/controllers/configset_controller.go +++ b/controllers/common/configset_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package common import ( "bytes" @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - commonv1 "github.com/zachfi/nodemanager/api/v1" + commonv1 "github.com/zachfi/nodemanager/apis/common/v1" "github.com/zachfi/nodemanager/pkg/common" ) diff --git a/controllers/errors.go b/controllers/common/errors.go similarity index 78% rename from controllers/errors.go rename to controllers/common/errors.go index 229c21d7..b45fc87d 100644 --- a/controllers/errors.go +++ b/controllers/common/errors.go @@ -1,4 +1,4 @@ -package controllers +package common import "fmt" diff --git a/controllers/managednode_controller.go b/controllers/common/managednode_controller.go similarity index 98% rename from controllers/managednode_controller.go rename to controllers/common/managednode_controller.go index bc328e6b..f617575f 100644 --- a/controllers/managednode_controller.go +++ b/controllers/common/managednode_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package common import ( "context" @@ -29,7 +29,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - commonv1 "github.com/zachfi/nodemanager/api/v1" + commonv1 "github.com/zachfi/nodemanager/apis/common/v1" "github.com/zachfi/nodemanager/pkg/common" ) diff --git a/controllers/suite_test.go b/controllers/common/suite_test.go similarity index 92% rename from controllers/suite_test.go rename to controllers/common/suite_test.go index 0ea8e072..819a51e9 100644 --- a/controllers/suite_test.go +++ b/controllers/common/suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package common import ( "path/filepath" @@ -31,7 +31,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - commonv1 "github.com/zachfi/nodemanager/api/v1" + commonv1 "github.com/zachfi/nodemanager/apis/common/v1" //+kubebuilder:scaffold:imports ) @@ -55,7 +55,7 @@ var _ = BeforeSuite(func() { By("bootstrapping test environment") testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: true, } diff --git a/main.go b/main.go index 167bcf83..74d00676 100644 --- a/main.go +++ b/main.go @@ -35,8 +35,8 @@ import ( "go.opentelemetry.io/otel" - commonv1 "github.com/zachfi/nodemanager/api/v1" - "github.com/zachfi/nodemanager/controllers" + commonv1 "github.com/zachfi/nodemanager/apis/common/v1" + commoncontrollers "github.com/zachfi/nodemanager/controllers/common" //+kubebuilder:scaffold:imports @@ -132,7 +132,7 @@ func main() { os.Exit(1) } - if err = (&controllers.ConfigSetReconciler{ + if err = (&commoncontrollers.ConfigSetReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Tracer: otel.Tracer("ConfigSet"), @@ -140,7 +140,7 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", "ConfigSet") os.Exit(1) } - if err = (&controllers.ManagedNodeReconciler{ + if err = (&commoncontrollers.ManagedNodeReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Tracer: otel.Tracer("ManagedNode"),