Skip to content

Commit

Permalink
Merge pull request #74 from Jont828/helmreleaseproxy-pause
Browse files Browse the repository at this point in the history
✨ Add event filter for HelmReleaseProxy when it is paused
  • Loading branch information
k8s-ci-robot authored May 16, 2023
2 parents 52ed204 + 1d02461 commit 1de7a24
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controllers/helmreleaseproxy/helmreleaseproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/cluster-api/util/predicates"
)

// HelmReleaseProxyReconciler reconciles a HelmReleaseProxy object
type HelmReleaseProxyReconciler struct {
client.Client
Scheme *runtime.Scheme

// WatchFilterValue is the label value used to filter events prior to reconciliation.
WatchFilterValue string
}

// SetupWithManager sets up the controller with the Manager.
func (r *HelmReleaseProxyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
_ = ctrl.LoggerFrom(ctx)
log := ctrl.LoggerFrom(ctx)

return ctrl.NewControllerManagedBy(mgr).
WithOptions(options).
For(&addonsv1alpha1.HelmReleaseProxy{}).
WithEventFilter(predicate.GenerationChangedPredicate{}).
// Watches(
// &source.Kind{Type: &v1alpha1.HelmReleaseProxy{}},
// handler.EnqueueRequestsFromMapFunc(r.findProxyForSecret),
// builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
// ).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
Complete(r)
}

Expand Down

0 comments on commit 1de7a24

Please sign in to comment.