ignore dryRun k8s request when auditing
Signed-off-by: wanjunlei <wanjunlei@yunify.com>
This commit is contained in:
@@ -18,9 +18,8 @@ package request
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/auditing/v1alpha1"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apiserver/pkg/apis/audit"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
)
|
||||
|
||||
@@ -87,12 +86,12 @@ func UserFrom(ctx context.Context) (user.Info, bool) {
|
||||
}
|
||||
|
||||
// WithAuditEvent returns set audit event struct.
|
||||
func WithAuditEvent(parent context.Context, ev *v1alpha1.Event) context.Context {
|
||||
func WithAuditEvent(parent context.Context, ev *audit.Event) context.Context {
|
||||
return WithValue(parent, auditKey, ev)
|
||||
}
|
||||
|
||||
// AuditEventFrom returns the audit event struct on the ctx
|
||||
func AuditEventFrom(ctx context.Context) *v1alpha1.Event {
|
||||
ev, _ := ctx.Value(auditKey).(*v1alpha1.Event)
|
||||
func AuditEventFrom(ctx context.Context) *audit.Event {
|
||||
ev, _ := ctx.Value(auditKey).(*audit.Event)
|
||||
return ev
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user