diff --git a/api/v1alpha1/linodeobjectstoragebucket_types.go b/api/v1alpha1/linodeobjectstoragebucket_types.go index 96f9dc2c9..371e03555 100644 --- a/api/v1alpha1/linodeobjectstoragebucket_types.go +++ b/api/v1alpha1/linodeobjectstoragebucket_types.go @@ -94,6 +94,7 @@ type LinodeObjectStorageBucketStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=linodeobjectstoragebuckets,scope=Namespaced,shortName=lobj // +kubebuilder:subresource:status +// +kubebuilder:metadata:labels="clusterctl.cluster.x-k8s.io/move-hierarchy=true" // +kubebuilder:printcolumn:name="Label",type="string",JSONPath=".spec.label",description="The name of the bucket" // +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.cluster",description="The ID of the Object Storage cluster for the bucket" // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Bucket and keys have been provisioned" diff --git a/api/v1alpha1/linodevpc_types.go b/api/v1alpha1/linodevpc_types.go index 624eb62b8..353befb53 100644 --- a/api/v1alpha1/linodevpc_types.go +++ b/api/v1alpha1/linodevpc_types.go @@ -105,6 +105,7 @@ type LinodeVPCStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status +// +kubebuilder:metadata:labels="clusterctl.cluster.x-k8s.io/move-hierarchy=true" // LinodeVPC is the Schema for the linodemachines API type LinodeVPC struct { diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeobjectstoragebuckets.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeobjectstoragebuckets.yaml index 94e04b9fe..b5daaaed1 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeobjectstoragebuckets.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeobjectstoragebuckets.yaml @@ -4,6 +4,8 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + labels: + clusterctl.cluster.x-k8s.io/move-hierarchy: "true" name: linodeobjectstoragebuckets.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml index c7fedf061..4d73a774b 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml @@ -4,6 +4,8 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + labels: + clusterctl.cluster.x-k8s.io/move-hierarchy: "true" name: linodevpcs.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io diff --git a/controller/linodecluster_controller.go b/controller/linodecluster_controller.go index aa636ce6b..b32f0f101 100644 --- a/controller/linodecluster_controller.go +++ b/controller/linodecluster_controller.go @@ -30,7 +30,6 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" cerrs "sigs.k8s.io/cluster-api/errors" kutil "sigs.k8s.io/cluster-api/util" - "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/predicates" ctrl "sigs.k8s.io/controller-runtime" @@ -84,11 +83,7 @@ func (r *LinodeClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{}, nil } - if annotations.IsPaused(cluster, linodeCluster) { - logger.Info("LinodeCluster of linked Cluster is marked as paused. Won't reconcile") - return ctrl.Result{}, nil - } // Create the cluster scope. clusterScope, err := scope.NewClusterScope( ctx, @@ -136,6 +131,7 @@ func (r *LinodeClusterReconciler) reconcile( if err := clusterScope.AddFinalizer(ctx); err != nil { return res, err } + // Create if clusterScope.LinodeCluster.Spec.ControlPlaneEndpoint.Host == "" { if err := r.reconcileCreate(ctx, logger, clusterScope); err != nil { diff --git a/controller/linodemachine_controller.go b/controller/linodemachine_controller.go index adf8495f3..9c3fea0b5 100644 --- a/controller/linodemachine_controller.go +++ b/controller/linodemachine_controller.go @@ -487,9 +487,14 @@ func (r *LinodeMachineReconciler) SetupWithManager(mgr ctrl.Manager) error { return fmt.Errorf("failed to build controller: %w", err) } - return controller.Watch( + err = controller.Watch( source.Kind(mgr.GetCache(), &clusterv1.Cluster{}), handler.EnqueueRequestsFromMapFunc(r.requeueLinodeMachinesForUnpausedCluster(mgr.GetLogger())), predicates.ClusterUnpausedAndInfrastructureReady(mgr.GetLogger()), ) + if err != nil { + return fmt.Errorf("failed adding a watch for ready clusters: %w", err) + } + + return nil }