Admission warning (#9975)
* Add warning feature in admission code * Apply suggestions from code review Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * Add deprecation and validation path notice --------- Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
897783557a
commit
1282345be2
4 changed files with 177 additions and 0 deletions
|
|
@ -38,6 +38,11 @@ func (ftc failTestChecker) CheckIngress(ing *networking.Ingress) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (ftc failTestChecker) CheckWarning(ing *networking.Ingress) ([]string, error) {
|
||||
ftc.t.Error("checker should not be called")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type testChecker struct {
|
||||
t *testing.T
|
||||
err error
|
||||
|
|
@ -50,6 +55,13 @@ func (tc testChecker) CheckIngress(ing *networking.Ingress) error {
|
|||
return tc.err
|
||||
}
|
||||
|
||||
func (tc testChecker) CheckWarning(ing *networking.Ingress) ([]string, error) {
|
||||
if ing.ObjectMeta.Name != testIngressName {
|
||||
tc.t.Errorf("CheckWarning should be called with %v ingress, but got %v", testIngressName, ing.ObjectMeta.Name)
|
||||
}
|
||||
return nil, tc.err
|
||||
}
|
||||
|
||||
func TestHandleAdmission(t *testing.T) {
|
||||
adm := &IngressAdmission{
|
||||
Checker: failTestChecker{t: t},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue