Also removes the errors.Wrap() in this section as some errors wouldn't be reported back to the admission review, such as:
Error from server: error when creating "def.yaml": admission webhook "net-attach-def-admission-controller-validating-config.k8s.io" denied the request without explanation
With that removed, we can get an error such as:
Error from server: error when creating "def.yaml": admission webhook "net-attach-def-admission-controller-validating-config.k8s.io" denied the request: configuration string is not in JSON format
Detects if spec.config is in JSON format before trying to elements are added to struct
as reported in: https://bugzilla.redhat.com/show_bug.cgi?id=1782301
can be replicated (prior to this fix) with a net-attach-def such as:
Demonstration of the error in go playground here @ https://play.golang.org/p/aA7IIO-SBmk Demonstration of the fix @ https://play.golang.org/p/vuiJI7YCv9g
Also removes the
errors.Wrap()
in this section as some errors wouldn't be reported back to the admission review, such as:With that removed, we can get an error such as: