Skip validation checks if an ingress is marked as deleted (#7216)
Signed-off-by: Aditya Sharma <git@adi.run>
This commit is contained in:
parent
16402050dc
commit
475bcde64c
2 changed files with 15 additions and 0 deletions
|
@ -214,6 +214,11 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Skip checks if the ingress is marked as deleted
|
||||
if !ing.DeletionTimestamp.IsZero() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !class.IsValid(ing) {
|
||||
klog.Warningf("ignoring ingress %v in %v based on annotation %v", ing.Name, ing.ObjectMeta.Namespace, class.IngressKey)
|
||||
return nil
|
||||
|
|
|
@ -294,6 +294,16 @@ func TestCheckIngress(t *testing.T) {
|
|||
}
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("When the ingress is marked as deleted", func(t *testing.T) {
|
||||
ing.DeletionTimestamp = &metav1.Time{
|
||||
Time: time.Now(),
|
||||
}
|
||||
|
||||
if nginx.CheckIngress(ing) != nil {
|
||||
t.Errorf("when the ingress is marked as deleted, no error should be returned")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestMergeAlternativeBackends(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue