You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently while integrating gatekeeper I noticed that a denied admission webook response will look somewhat like this:
Message and Reason kinda have the same info.
errors.StatusError{
ErrStatus:v1.Status{
TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"},
ListMeta:v1.ListMeta{
SelfLink:\"\",
ResourceVersion:\"\",
Continue:\"\",
RemainingItemCount:(*int64)(nil)},
Status:\"Failure\",
Message:\"admission webhook \\\"validation.gatekeeper.sh\\\" denied the request: [enforce-resource-quota] resource exceeded cpu quota\",
Reason:\"[enforce-resource-quota] resource exceeded cpu quota\",
Details:(*v1.StatusDetails)(nil),
Code:403}
}
I guess this is generally ok! However, if one is using "k8s.io/apimachinery/pkg/api/errors" to determine the type of error we are out of luck since it relies on the Reason property.
Given the above example:
errors.IsForbidden(err) // False
I suggest a small change in the StatusError and give Reason the proper description keeping Message as the human-readable description of this operation.
Describe the solution you'd like
Hello 👋
Recently while integrating
gatekeeper
I noticed that a denied admission webook response will look somewhat like this:Message
andReason
kinda have the same info.I guess this is generally ok! However, if one is using
"k8s.io/apimachinery/pkg/api/errors"
to determine the type of error we are out of luck since it relies on theReason
property.Given the above example:
I suggest a small change in the
StatusError
and giveReason
the proper description keepingMessage
as the human-readable description of this operation.Anything else you would like to add:
Here's a PR with the proposed change. #1692
The text was updated successfully, but these errors were encountered: