Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
pred := predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.MetaNew) {
if !utils.ShouldManage(e.MetaNew) {
return false
}
log.WithValues("namespace", e.MetaNew.GetNamespace(), "name", e.MetaNew.GetName()).V(5).Info("Call UpdateFunc")
Expand All @@ -117,7 +117,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
},
DeleteFunc: func(e event.DeleteEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
return false
}
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).Info("Call DeleteFunc")
Expand All @@ -126,7 +126,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
},
CreateFunc: func(e event.CreateEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
return false
}
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).Info("Call CreateFunc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
pred := predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.MetaNew) {
if !utils.ShouldManage(e.MetaNew) {
return false
}
log.WithValues("namespace", e.MetaNew.GetNamespace(), "name", e.MetaNew.GetName()).V(5).Info("Call UpdateFunc")
Expand All @@ -89,7 +89,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
},
DeleteFunc: func(e event.DeleteEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
return false
}
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).Info("Call DeleteFunc")
Expand All @@ -98,7 +98,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
},
CreateFunc: func(e event.CreateEvent) bool {
// returns false if DistributedRedisCluster is ignored (not managed) by this operator.
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
return false
}
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).Info("Call CreateFunc")
Expand All @@ -115,7 +115,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
jobPred := predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
log.WithValues("namespace", e.MetaNew.GetNamespace(), "name", e.MetaNew.GetName()).V(4).Info("Call Job UpdateFunc")
if !utils.ShoudManage(e.MetaNew) {
if !utils.ShouldManage(e.MetaNew) {
log.WithValues("namespace", e.MetaNew.GetNamespace(), "name", e.MetaNew.GetName()).V(4).Info("Job UpdateFunc Not Manage")
return false
}
Expand All @@ -126,7 +126,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
return false
},
DeleteFunc: func(e event.DeleteEvent) bool {
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
return false
}
job, ok := e.Object.(*batch.Job)
Expand All @@ -141,7 +141,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
},
CreateFunc: func(e event.CreateEvent) bool {
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).V(4).Info("Call Job CreateFunc")
if !utils.ShoudManage(e.Meta) {
if !utils.ShouldManage(e.Meta) {
log.WithValues("namespace", e.Meta.GetNamespace(), "name", e.Meta.GetName()).V(4).Info("Job CreateFunc Not Manage")
return false
}
Expand Down
13 changes: 5 additions & 8 deletions pkg/utils/scoped.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ func SetClusterScoped(namespace string) {
}
}

func ShoudManage(meta metav1.Object) bool {
func ShouldManage(meta metav1.Object) bool {
if IsClusterScoped() {
return true
}
if v, ok := meta.GetAnnotations()[AnnotationScope]; ok {
if IsClusterScoped() {
return v == AnnotationClusterScoped
}
} else {
if !IsClusterScoped() {
return true
}
return v == AnnotationClusterScoped
}
return false
}