diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4f0b0346e4..0f96e8790b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -113,7 +113,6 @@ jobs: - 'api/**' - 'cmd/**' - 'config/**' - - 'controllers/**' - 'internal/**' - 'licenses/**' - 'pkg/**' diff --git a/Makefile b/Makefile index a82e02334e..a69b4758d4 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ test: generate fmt vet manifests envtest ## Run tests. source <(${ENVTEST} use -p env --bin-dir ${ENVTEST_ASSETS_DIR} ${ENVTEST_K8S_VERSION}) ;\ export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT=60s ;\ export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT=60s ;\ - go test -coverpkg=./... --count=1 -coverprofile=cover.out ./api/... ./cmd/... ./controllers/... ./internal/... ./pkg/... ./tests/utils ; + go test -coverpkg=./... --count=1 -coverprofile=cover.out ./api/... ./cmd/... ./internal/... ./pkg/... ./tests/utils ; e2e-test-kind: ## Run e2e tests locally using kind. hack/e2e/run-e2e-kind.sh diff --git a/PROJECT b/PROJECT index 1023de12c0..85432d920c 100644 --- a/PROJECT +++ b/PROJECT @@ -1,7 +1,7 @@ domain: cnpg.io layout: -- go.kubebuilder.io/v3 -projectName: cloudnative-pg-kubebuilderv3 +- go.kubebuilder.io/v4 +projectName: cloudnative-pg-kubebuilderv4 repo: github.com/cloudnative-pg/cloudnative-pg resources: - api: diff --git a/cmd/main.go b/cmd/main.go new file mode 120000 index 0000000000..9dc22243d8 --- /dev/null +++ b/cmd/main.go @@ -0,0 +1 @@ +../internal/cmd/manager/controller/controller.go \ No newline at end of file diff --git a/internal/cmd/manager/controller/controller.go b/internal/cmd/manager/controller/controller.go index 045268011f..683666dad0 100644 --- a/internal/cmd/manager/controller/controller.go +++ b/internal/cmd/manager/controller/controller.go @@ -35,8 +35,8 @@ import ( // +kubebuilder:scaffold:imports apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" - "github.com/cloudnative-pg/cloudnative-pg/controllers" "github.com/cloudnative-pg/cloudnative-pg/internal/configuration" + "github.com/cloudnative-pg/cloudnative-pg/internal/controller" schemeBuilder "github.com/cloudnative-pg/cloudnative-pg/internal/scheme" "github.com/cloudnative-pg/cloudnative-pg/pkg/certs" "github.com/cloudnative-pg/cloudnative-pg/pkg/management/log" @@ -230,17 +230,17 @@ func RunController( return err } - if err = controllers.NewClusterReconciler(mgr, discoveryClient).SetupWithManager(ctx, mgr); err != nil { + if err = controller.NewClusterReconciler(mgr, discoveryClient).SetupWithManager(ctx, mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Cluster") return err } - if err = controllers.NewBackupReconciler(mgr, discoveryClient).SetupWithManager(ctx, mgr); err != nil { + if err = controller.NewBackupReconciler(mgr, discoveryClient).SetupWithManager(ctx, mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Backup") return err } - if err = (&controllers.ScheduledBackupReconciler{ + if err = (&controller.ScheduledBackupReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Recorder: mgr.GetEventRecorderFor("cloudnative-pg-scheduledbackup"), @@ -249,7 +249,7 @@ func RunController( return err } - if err = (&controllers.PoolerReconciler{ + if err = (&controller.PoolerReconciler{ Client: mgr.GetClient(), DiscoveryClient: discoveryClient, Scheme: mgr.GetScheme(), diff --git a/internal/cmd/plugin/destroy/destroy.go b/internal/cmd/plugin/destroy/destroy.go index a6e4b57863..8c6e3a29be 100644 --- a/internal/cmd/plugin/destroy/destroy.go +++ b/internal/cmd/plugin/destroy/destroy.go @@ -26,8 +26,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/cloudnative-pg/cloudnative-pg/controllers" "github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin" + "github.com/cloudnative-pg/cloudnative-pg/internal/controller" "github.com/cloudnative-pg/cloudnative-pg/pkg/reconciler/persistentvolumeclaim" "github.com/cloudnative-pg/cloudnative-pg/pkg/utils" ) @@ -46,7 +46,7 @@ func Destroy(ctx context.Context, clusterName, instanceName string, keepPVC bool if keepPVC { // we remove the ownership from the pvcs if present for i := range pvcs { - if _, isOwned := controllers.IsOwnedByCluster(&pvcs[i]); !isOwned { + if _, isOwned := controller.IsOwnedByCluster(&pvcs[i]); !isOwned { continue } @@ -71,7 +71,7 @@ func Destroy(ctx context.Context, clusterName, instanceName string, keepPVC bool pvcs[i].Labels = map[string]string{} } - _, isOwned := controllers.IsOwnedByCluster(&pvcs[i]) + _, isOwned := controller.IsOwnedByCluster(&pvcs[i]) // if it is requested for deletion and it is owned by the cluster, we delete it. If it is not owned by the cluster // but it does have the instance label and the detached annotation then we can still delete it // We will only skip the iteration and not delete the pvc if it is not owned by the cluster, and it does not have @@ -104,7 +104,7 @@ func ensurePodIsDeleted(ctx context.Context, instanceName, clusterName string) e return err } - if _, isOwned := controllers.IsOwnedByCluster(&pod); !isOwned { + if _, isOwned := controller.IsOwnedByCluster(&pod); !isOwned { return fmt.Errorf("instance %s is not owned by cluster %s", pod.Name, clusterName) } diff --git a/controllers/backup_controller.go b/internal/controller/backup_controller.go similarity index 99% rename from controllers/backup_controller.go rename to internal/controller/backup_controller.go index b793367d0c..fc91d80aa9 100644 --- a/controllers/backup_controller.go +++ b/internal/controller/backup_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/backup_controller_test.go b/internal/controller/backup_controller_test.go similarity index 99% rename from controllers/backup_controller_test.go rename to internal/controller/backup_controller_test.go index 21d4623dfd..0e29ab6db0 100644 --- a/controllers/backup_controller_test.go +++ b/internal/controller/backup_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/controllers/backup_predicates.go b/internal/controller/backup_predicates.go similarity index 99% rename from controllers/backup_predicates.go rename to internal/controller/backup_predicates.go index 18c6e110fb..6e8f3d4775 100644 --- a/controllers/backup_predicates.go +++ b/internal/controller/backup_predicates.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/backup_predicates_test.go b/internal/controller/backup_predicates_test.go similarity index 99% rename from controllers/backup_predicates_test.go rename to internal/controller/backup_predicates_test.go index eb7ac3292a..0ca8304baa 100644 --- a/controllers/backup_predicates_test.go +++ b/internal/controller/backup_predicates_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 ( storagesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1" diff --git a/controllers/cluster_cleanup.go b/internal/controller/cluster_cleanup.go similarity index 98% rename from controllers/cluster_cleanup.go rename to internal/controller/cluster_cleanup.go index 822e8a16f1..76582fc6ab 100644 --- a/controllers/cluster_cleanup.go +++ b/internal/controller/cluster_cleanup.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/cluster_cleanup_test.go b/internal/controller/cluster_cleanup_test.go similarity index 99% rename from controllers/cluster_cleanup_test.go rename to internal/controller/cluster_cleanup_test.go index f81f8ad8d9..23e05d836a 100644 --- a/controllers/cluster_cleanup_test.go +++ b/internal/controller/cluster_cleanup_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 ( batchv1 "k8s.io/api/batch/v1" diff --git a/controllers/cluster_controller.go b/internal/controller/cluster_controller.go similarity index 99% rename from controllers/cluster_controller.go rename to internal/controller/cluster_controller.go index 0b83fe74d0..3014929e23 100644 --- a/controllers/cluster_controller.go +++ b/internal/controller/cluster_controller.go @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package controllers contains the controller of the CRD -package controllers +// Package controller contains the controller of the CRD +package controller import ( "context" diff --git a/controllers/cluster_controller_test.go b/internal/controller/cluster_controller_test.go similarity index 99% rename from controllers/cluster_controller_test.go rename to internal/controller/cluster_controller_test.go index d9643a7f7d..d047ed61e2 100644 --- a/controllers/cluster_controller_test.go +++ b/internal/controller/cluster_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/controllers/cluster_create.go b/internal/controller/cluster_create.go similarity index 99% rename from controllers/cluster_create.go rename to internal/controller/cluster_create.go index 697b581519..222dbbf542 100644 --- a/controllers/cluster_create.go +++ b/internal/controller/cluster_create.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/cluster_create_test.go b/internal/controller/cluster_create_test.go similarity index 99% rename from controllers/cluster_create_test.go rename to internal/controller/cluster_create_test.go index e9fd505447..9659e50ac3 100644 --- a/controllers/cluster_create_test.go +++ b/internal/controller/cluster_create_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/controllers/cluster_delete.go b/internal/controller/cluster_delete.go similarity index 99% rename from controllers/cluster_delete.go rename to internal/controller/cluster_delete.go index 6b0f779d30..cd775442e7 100644 --- a/controllers/cluster_delete.go +++ b/internal/controller/cluster_delete.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/cluster_delete_test.go b/internal/controller/cluster_delete_test.go similarity index 99% rename from controllers/cluster_delete_test.go rename to internal/controller/cluster_delete_test.go index 54ca1a2f2d..0ee740080a 100644 --- a/controllers/cluster_delete_test.go +++ b/internal/controller/cluster_delete_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/controllers/cluster_image.go b/internal/controller/cluster_image.go similarity index 99% rename from controllers/cluster_image.go rename to internal/controller/cluster_image.go index 7249bba734..d5c7414964 100644 --- a/controllers/cluster_image.go +++ b/internal/controller/cluster_image.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/cluster_pki.go b/internal/controller/cluster_pki.go similarity index 99% rename from controllers/cluster_pki.go rename to internal/controller/cluster_pki.go index a9b8d3a9f9..158de35786 100644 --- a/controllers/cluster_pki.go +++ b/internal/controller/cluster_pki.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/cluster_plugins.go b/internal/controller/cluster_plugins.go similarity index 96% rename from controllers/cluster_plugins.go rename to internal/controller/cluster_plugins.go index 9a3940ce32..637ac59686 100644 --- a/controllers/cluster_plugins.go +++ b/internal/controller/cluster_plugins.go @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package controllers contains the controller of the CRD -package controllers +// Package controller contains the controller of the CRD +package controller import ( "context" diff --git a/controllers/cluster_predicates.go b/internal/controller/cluster_predicates.go similarity index 99% rename from controllers/cluster_predicates.go rename to internal/controller/cluster_predicates.go index 8f5735d203..a8e96dfde4 100644 --- a/controllers/cluster_predicates.go +++ b/internal/controller/cluster_predicates.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( corev1 "k8s.io/api/core/v1" diff --git a/controllers/cluster_restore.go b/internal/controller/cluster_restore.go similarity index 99% rename from controllers/cluster_restore.go rename to internal/controller/cluster_restore.go index d841fcb8c1..20eb9b3eff 100644 --- a/controllers/cluster_restore.go +++ b/internal/controller/cluster_restore.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/cluster_restore_test.go b/internal/controller/cluster_restore_test.go similarity index 99% rename from controllers/cluster_restore_test.go rename to internal/controller/cluster_restore_test.go index 907c83c1a7..72b41cbaf7 100644 --- a/controllers/cluster_restore_test.go +++ b/internal/controller/cluster_restore_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/controllers/cluster_scale.go b/internal/controller/cluster_scale.go similarity index 99% rename from controllers/cluster_scale.go rename to internal/controller/cluster_scale.go index 155020fffc..2e35fbd2d6 100644 --- a/controllers/cluster_scale.go +++ b/internal/controller/cluster_scale.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/cluster_scale_test.go b/internal/controller/cluster_scale_test.go similarity index 99% rename from controllers/cluster_scale_test.go rename to internal/controller/cluster_scale_test.go index 5c02fd2202..6b01ab1854 100644 --- a/controllers/cluster_scale_test.go +++ b/internal/controller/cluster_scale_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/controllers/cluster_status.go b/internal/controller/cluster_status.go similarity index 99% rename from controllers/cluster_status.go rename to internal/controller/cluster_status.go index 9c6126a85b..4d71749a59 100644 --- a/controllers/cluster_status.go +++ b/internal/controller/cluster_status.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/cluster_status_test.go b/internal/controller/cluster_status_test.go similarity index 99% rename from controllers/cluster_status_test.go rename to internal/controller/cluster_status_test.go index 5a339d618e..b940ad2e27 100644 --- a/controllers/cluster_status_test.go +++ b/internal/controller/cluster_status_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/controllers/cluster_upgrade.go b/internal/controller/cluster_upgrade.go similarity index 99% rename from controllers/cluster_upgrade.go rename to internal/controller/cluster_upgrade.go index b4f1317269..fc0f5bae02 100644 --- a/controllers/cluster_upgrade.go +++ b/internal/controller/cluster_upgrade.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/cluster_upgrade_test.go b/internal/controller/cluster_upgrade_test.go similarity index 99% rename from controllers/cluster_upgrade_test.go rename to internal/controller/cluster_upgrade_test.go index 5f25e13dd1..b1dbe95961 100644 --- a/controllers/cluster_upgrade_test.go +++ b/internal/controller/cluster_upgrade_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 ( "encoding/json" diff --git a/controllers/plugins.go b/internal/controller/plugins.go similarity index 99% rename from controllers/plugins.go rename to internal/controller/plugins.go index 6b02e991df..2b702421cc 100644 --- a/controllers/plugins.go +++ b/internal/controller/plugins.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/pooler_controller.go b/internal/controller/pooler_controller.go similarity index 99% rename from controllers/pooler_controller.go rename to internal/controller/pooler_controller.go index 94e8c5af71..064bbc6efb 100644 --- a/controllers/pooler_controller.go +++ b/internal/controller/pooler_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/pooler_controller_test.go b/internal/controller/pooler_controller_test.go similarity index 99% rename from controllers/pooler_controller_test.go rename to internal/controller/pooler_controller_test.go index c9abbbf6b3..a75c02bf70 100644 --- a/controllers/pooler_controller_test.go +++ b/internal/controller/pooler_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/controllers/pooler_predicates.go b/internal/controller/pooler_predicates.go similarity index 98% rename from controllers/pooler_predicates.go rename to internal/controller/pooler_predicates.go index aa5159e41e..a76255bc9d 100644 --- a/controllers/pooler_predicates.go +++ b/internal/controller/pooler_predicates.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( corev1 "k8s.io/api/core/v1" diff --git a/controllers/pooler_predicates_test.go b/internal/controller/pooler_predicates_test.go similarity index 99% rename from controllers/pooler_predicates_test.go rename to internal/controller/pooler_predicates_test.go index 3834f85ff4..5a324fb27d 100644 --- a/controllers/pooler_predicates_test.go +++ b/internal/controller/pooler_predicates_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 ( corev1 "k8s.io/api/core/v1" diff --git a/controllers/pooler_resources.go b/internal/controller/pooler_resources.go similarity index 99% rename from controllers/pooler_resources.go rename to internal/controller/pooler_resources.go index a760e99f31..40997786ed 100644 --- a/controllers/pooler_resources.go +++ b/internal/controller/pooler_resources.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/pooler_resources_test.go b/internal/controller/pooler_resources_test.go similarity index 99% rename from controllers/pooler_resources_test.go rename to internal/controller/pooler_resources_test.go index 4cb18a18e4..14468170e7 100644 --- a/controllers/pooler_resources_test.go +++ b/internal/controller/pooler_resources_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/controllers/pooler_status.go b/internal/controller/pooler_status.go similarity index 99% rename from controllers/pooler_status.go rename to internal/controller/pooler_status.go index 829eb01060..af9f9062fa 100644 --- a/controllers/pooler_status.go +++ b/internal/controller/pooler_status.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/pooler_status_test.go b/internal/controller/pooler_status_test.go similarity index 99% rename from controllers/pooler_status_test.go rename to internal/controller/pooler_status_test.go index 15f4534d03..18891442b2 100644 --- a/controllers/pooler_status_test.go +++ b/internal/controller/pooler_status_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/controllers/pooler_update.go b/internal/controller/pooler_update.go similarity index 99% rename from controllers/pooler_update.go rename to internal/controller/pooler_update.go index a83491c6c0..183507edb9 100644 --- a/controllers/pooler_update.go +++ b/internal/controller/pooler_update.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/pooler_update_test.go b/internal/controller/pooler_update_test.go similarity index 99% rename from controllers/pooler_update_test.go rename to internal/controller/pooler_update_test.go index 172e7c1241..d265cb7757 100644 --- a/controllers/pooler_update_test.go +++ b/internal/controller/pooler_update_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/controllers/replicas.go b/internal/controller/replicas.go similarity index 99% rename from controllers/replicas.go rename to internal/controller/replicas.go index ff9ffcbaf8..8f14430793 100644 --- a/controllers/replicas.go +++ b/internal/controller/replicas.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/replicas_test.go b/internal/controller/replicas_test.go similarity index 99% rename from controllers/replicas_test.go rename to internal/controller/replicas_test.go index 7c02686e76..fcba496d90 100644 --- a/controllers/replicas_test.go +++ b/internal/controller/replicas_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 ( corev1 "k8s.io/api/core/v1" diff --git a/controllers/scheduledbackup_controller.go b/internal/controller/scheduledbackup_controller.go similarity index 99% rename from controllers/scheduledbackup_controller.go rename to internal/controller/scheduledbackup_controller.go index ce6c0dba95..1fdf514ef0 100644 --- a/controllers/scheduledbackup_controller.go +++ b/internal/controller/scheduledbackup_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/suite_test.go b/internal/controller/suite_test.go similarity index 99% rename from controllers/suite_test.go rename to internal/controller/suite_test.go index dcebe5bea8..c4daac7659 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" diff --git a/internal/management/controller/instance_controller.go b/internal/management/controller/instance_controller.go index c29cbb2ae0..81100f7322 100644 --- a/internal/management/controller/instance_controller.go +++ b/internal/management/controller/instance_controller.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" - "github.com/cloudnative-pg/cloudnative-pg/controllers" + "github.com/cloudnative-pg/cloudnative-pg/internal/controller" "github.com/cloudnative-pg/cloudnative-pg/internal/management/controller/roles" "github.com/cloudnative-pg/cloudnative-pg/internal/management/controller/slots/infrastructure" "github.com/cloudnative-pg/cloudnative-pg/internal/management/controller/slots/reconciler" @@ -341,7 +341,7 @@ func (r *InstanceReconciler) reconcileFencing(ctx context.Context, cluster *apiv } func handleErrNextLoop(err error) (reconcile.Result, error) { - if errors.Is(err, controllers.ErrNextLoop) { + if errors.Is(err, controller.ErrNextLoop) { return reconcile.Result{RequeueAfter: time.Second}, nil } return reconcile.Result{}, err diff --git a/internal/management/controller/instance_startup.go b/internal/management/controller/instance_startup.go index aa57269d0f..45ae366872 100644 --- a/internal/management/controller/instance_startup.go +++ b/internal/management/controller/instance_startup.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" - "github.com/cloudnative-pg/cloudnative-pg/controllers" + "github.com/cloudnative-pg/cloudnative-pg/internal/controller" "github.com/cloudnative-pg/cloudnative-pg/pkg/fileutils" "github.com/cloudnative-pg/cloudnative-pg/pkg/management/log" postgresSpec "github.com/cloudnative-pg/cloudnative-pg/pkg/postgres" @@ -213,7 +213,7 @@ func (r *InstanceReconciler) verifyPgDataCoherenceForPrimary(ctx context.Context contextLogger.Info("Switchover in progress", "targetPrimary", cluster.Status.TargetPrimary, "currentPrimary", cluster.Status.CurrentPrimary) - return controllers.ErrNextLoop + return controller.ErrNextLoop } contextLogger.Info("Switchover completed", diff --git a/main.go b/main.go deleted file mode 120000 index 6593fcc361..0000000000 --- a/main.go +++ /dev/null @@ -1 +0,0 @@ -internal/cmd/manager/controller/controller.go \ No newline at end of file