@@ -1519,35 +1519,35 @@ func HasOverride(spec *v1alpha1.KProbeSpec) bool {
15191519 return false
15201520}
15211521
1522- func HasSigkillAction ( kspec * v1alpha1. KProbeSpec ) bool {
1523- for i := range kspec . Selectors {
1524- s := & kspec . Selectors [ i ]
1525- for j := range s . MatchActions {
1526- act := strings . ToLower ( s .MatchActions [ j ]. Action )
1527- if act == "sigkill" {
1522+ // HasAction returns true if any selector in the KProbeSpec has the specified action
1523+ func HasAction ( kspec * v1alpha1. KProbeSpec , actionName string ) bool {
1524+ act := strings . ToLower ( actionName )
1525+ for _ , s := range kspec . Selectors {
1526+ for _ , action := range s .MatchActions {
1527+ if strings . ToLower ( action . Action ) == act {
15281528 return true
15291529 }
15301530 }
15311531 }
15321532 return false
15331533}
15341534
1535- func HasFilter (selectors []v1alpha1.KProbeSelector , index uint32 ) bool {
1536- for _ , s := range selectors {
1537- for _ , a := range s .MatchArgs {
1538- if a .Index == index {
1535+ // HasActionType returns true if any selector in the KProbeSpec has the specified action type
1536+ func HasActionType (kspec * v1alpha1.KProbeSpec , actionType int32 ) bool {
1537+ for _ , s := range kspec .Selectors {
1538+ for _ , action := range s .MatchActions {
1539+ if ActionTypeFromString (action .Action ) == actionType {
15391540 return true
15401541 }
15411542 }
15421543 }
15431544 return false
15441545}
15451546
1546- // HasNotifyEnforcerAction returns true if any selector in the KProbeSpec has a NotifyEnforcer action
1547- func HasNotifyEnforcerAction (kspec * v1alpha1.KProbeSpec ) bool {
1548- for _ , s := range kspec .Selectors {
1549- for _ , action := range s .MatchActions {
1550- if action .Action == "NotifyEnforcer" {
1547+ func HasFilter (selectors []v1alpha1.KProbeSelector , index uint32 ) bool {
1548+ for _ , s := range selectors {
1549+ for _ , a := range s .MatchArgs {
1550+ if a .Index == index {
15511551 return true
15521552 }
15531553 }
0 commit comments