Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 162841f

Browse files
committed
Unbreak object validator on 1.14
See #688 and #889 - validators need to be able to handle that OldObject might not be populated in K8s 1.14 Tested: can delete an empty (!) subnamespace in 1.14 with this change, while it hangs forever and prints out error messages from the object validators without this change. See #889 for more information.
1 parent 78ecff5 commit 162841f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

incubator/hnc/internal/validators/object.go

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ func (o *Object) Handle(ctx context.Context, req admission.Request) admission.Re
7070
}
7171
}
7272
if req.Operation != admissionv1beta1.Create {
73+
// See issue #688 and #889
74+
if req.Operation == admissionv1beta1.Delete && req.OldObject.Raw == nil {
75+
return allow("cannot validate deletions in K8s 1.14")
76+
}
7377
if err := o.decoder.DecodeRaw(req.OldObject, oldInst); err != nil {
7478
log.Error(err, "Couldn't decode req.OldObject", "raw", req.OldObject)
7579
return deny(metav1.StatusReasonBadRequest, err.Error())

0 commit comments

Comments
 (0)