ValidationRequest: the object each validate() function receives as payload
KubernetesAdmissionRequest: this is the object that describes the AdmissionReview
All the objects referenced by KubernetesAdmissionRequest
Some of the objects would need to rely on interface{} (see for example the KubernetesAdmissionRequest.Object). However this is not doable with TinyGo, because it would cause a runtime error when trying to unmarshal the object.
Because of that, some attributes are defined as easyjson.RawMessage. This is a type that acts as a kind of []byte. This makes possible to unmarshal the contents of the variable using a proper Go type that implements the easyjson interfaces.
For example, assuming the policy is interested in Ingress-releated events. The ingress object can be loaded in this way:
Provide Go types describing:
validate()
function receives as payloadSome of the objects would need to rely on
interface{}
(see for example theKubernetesAdmissionRequest.Object
). However this is not doable with TinyGo, because it would cause a runtime error when trying to unmarshal the object.Because of that, some attributes are defined as
easyjson.RawMessage
. This is a type that acts as a kind of[]byte
. This makes possible to unmarshal the contents of the variable using a proper Go type that implements the easyjson interfaces.For example, assuming the policy is interested in
Ingress
-releated events. The ingress object can be loaded in this way:This commit makes possible to write policies that are NOT using
gjson