Skip to content

Commit

Permalink
Removing pause annotations as controller is readonly
Browse files Browse the repository at this point in the history
Signed-off-by: Aravind Ramalingam <ramaliar@amazon.com>
  • Loading branch information
pokearu committed Jun 5, 2022
1 parent 74ece40 commit d08c61e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
37 changes: 0 additions & 37 deletions api/v1alpha1/baseboardmanagement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ const (
ConditionFalse ConditionStatus = "False"
)

// PausedAnnotation is an annotation that can be applied to BaseboardManagement
// object to prevent a controller from processing a resource.
const PausedAnnotation = "bmc.tinkerbell.org/paused"

// BaseboardManagementSpec defines the desired state of BaseboardManagement
type BaseboardManagementSpec struct {

Expand Down Expand Up @@ -153,39 +149,6 @@ func WithBaseboardManagementConditionMessage(m string) BaseboardManagementSetCon
}
}

// PauseReconcile adds the pausedAnnotation to the BaseboardManagement object.
func (bm *BaseboardManagement) PauseReconcile() {
if bm.Annotations == nil {
bm.initAnnotations()
}
bm.Annotations[PausedAnnotation] = "true"
}

// ClearPauseAnnotation deletes the pausedAnnotation from the BaseboardManagement object.
func (bm *BaseboardManagement) ClearPauseAnnotation() {
if bm.Annotations != nil {
delete(bm.Annotations, PausedAnnotation)
}
}

// IsReconcilePaused checks if the pausedAnnotation is present on the BaseboardManagement object.
func (bm *BaseboardManagement) IsReconcilePaused() bool {
if bm.Annotations == nil {
return false
}

if s, ok := bm.Annotations[PausedAnnotation]; ok {
return s == "true"
}

return false
}

// initAnnotations initalizes the BaseboardManagement metadata annotations.
func (bm *BaseboardManagement) initAnnotations() {
bm.Annotations = map[string]string{}
}

// BaseboardManagementRef defines the reference information to a BaseboardManagement resource.
type BaseboardManagementRef struct {
// Name is unique within a namespace to reference a BaseboardManagement resource.
Expand Down
6 changes: 0 additions & 6 deletions controllers/baseboardmanagement_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ func (r *BaseboardManagementReconciler) Reconcile(ctx context.Context, req ctrl.
return ctrl.Result{}, err
}

// If BaseboardManagement is paused, noop.
if baseboardManagement.IsReconcilePaused() {
logger.Info("BaseboardManagement reconciliation is paused")
return ctrl.Result{}, nil
}

// Deletion is a noop.
if !baseboardManagement.DeletionTimestamp.IsZero() {
return ctrl.Result{}, nil
Expand Down

0 comments on commit d08c61e

Please sign in to comment.