mirror of https://github.com/k3s-io/k3s
update events' ResponseStatus at Metadata level
ResponseStatus is populated in MetadataLevel, so we also update it in MetadataLevel.pull/6/head
parent
0641386318
commit
b6abcacb38
|
@ -100,8 +100,8 @@ type Event struct {
|
||||||
// +optional
|
// +optional
|
||||||
ObjectRef *ObjectReference
|
ObjectRef *ObjectReference
|
||||||
// The response status, populated even when the ResponseObject is not a Status type.
|
// The response status, populated even when the ResponseObject is not a Status type.
|
||||||
// For successful responses, this will only include the Code and StatusSuccess.
|
// For successful responses, this will only include the Code. For non-status type
|
||||||
// For non-status type error responses, this will be auto-populated with the error Message.
|
// error responses, this will be auto-populated with the error Message.
|
||||||
// +optional
|
// +optional
|
||||||
ResponseStatus *metav1.Status
|
ResponseStatus *metav1.Status
|
||||||
|
|
||||||
|
|
|
@ -170,14 +170,16 @@ func LogRequestPatch(ae *audit.Event, patch []byte) {
|
||||||
// LogResponseObject fills in the response object into an audit event. The passed runtime.Object
|
// LogResponseObject fills in the response object into an audit event. The passed runtime.Object
|
||||||
// will be converted to the given gv.
|
// will be converted to the given gv.
|
||||||
func LogResponseObject(ae *audit.Event, obj runtime.Object, gv schema.GroupVersion, s runtime.NegotiatedSerializer) {
|
func LogResponseObject(ae *audit.Event, obj runtime.Object, gv schema.GroupVersion, s runtime.NegotiatedSerializer) {
|
||||||
if ae == nil || ae.Level.Less(audit.LevelRequestResponse) {
|
if ae == nil || ae.Level.Less(audit.LevelMetadata) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if status, ok := obj.(*metav1.Status); ok {
|
if status, ok := obj.(*metav1.Status); ok {
|
||||||
ae.ResponseStatus = status
|
ae.ResponseStatus = status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ae.Level.Less(audit.LevelRequestResponse) {
|
||||||
|
return
|
||||||
|
}
|
||||||
// TODO(audit): hook into the serializer to avoid double conversion
|
// TODO(audit): hook into the serializer to avoid double conversion
|
||||||
var err error
|
var err error
|
||||||
ae.ResponseObject, err = encodeObject(obj, gv, s)
|
ae.ResponseObject, err = encodeObject(obj, gv, s)
|
||||||
|
|
Loading…
Reference in New Issue