Skip to content

Commit

Permalink
fix: clustervalidatemanager not effective bug
Browse files Browse the repository at this point in the history
Signed-off-by: kaku <[email protected]>
  • Loading branch information
likakuli committed May 7, 2022
1 parent ec69e63 commit 53b0be3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion util/validatemanager/validatemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ func (m *validateManagerImpl) ApplyValidatePolicies(rawObj *unstructured.Unstruc
result, err := executeCue(rawObj, oldObj, rule.Cue)
if err != nil {
klog.ErrorS(err, "Failed to apply validate policy.", "validatepolicy", cvp.Name, "resource", klog.KObj(rawObj))
return result, err
return nil, err
}
klog.V(2).InfoS("Applied validate policy.", "validatepolicy", cvp.Name, "resource", klog.KObj(rawObj))
if !result.Valid {
return result, nil
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion util/validatemanager/validatemanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ validate: {
oldObject: nil,
wantedErr: nil,
wantedResult: &ValidateResult{
Valid: true,
Valid: false,
},
},
{
Expand Down

0 comments on commit 53b0be3

Please sign in to comment.