From e448a40d8c4eb959571d6a507e311a4a2090313f Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Wed, 24 Oct 2018 23:38:29 -0400 Subject: [PATCH] Add support for audit v1 events --- cmd/audit2rbac/audit2rbac.go | 2 +- pkg/util.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/audit2rbac/audit2rbac.go b/cmd/audit2rbac/audit2rbac.go index aab23ea..58a3467 100644 --- a/cmd/audit2rbac/audit2rbac.go +++ b/cmd/audit2rbac/audit2rbac.go @@ -104,7 +104,7 @@ func NewAudit2RBACCommand(stdout, stderr io.Writer) *cobra.Command { type Audit2RBACOptions struct { // AuditSources is a list of files, URLs or - for STDIN. - // Format must be JSON event.v1alpha1.audit.k8s.io or event.v1beta1.audit.k8s.io objects, one per line + // Format must be JSON event.v1alpha1.audit.k8s.io, event.v1beta1.audit.k8s.io, event.v1.audit.k8s.io objects, one per line AuditSources []string // ExistingObjectFiles is a list of files or URLs. diff --git a/pkg/util.go b/pkg/util.go index 9eeb9f2..151780a 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -13,6 +13,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/json" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/apis/audit" + auditv1 "k8s.io/apiserver/pkg/apis/audit/v1" auditv1alpha1 "k8s.io/apiserver/pkg/apis/audit/v1alpha1" auditv1beta1 "k8s.io/apiserver/pkg/apis/audit/v1beta1" "k8s.io/apiserver/pkg/authentication/serviceaccount" @@ -187,6 +188,9 @@ func init() { panic(err) } + if err := auditv1.AddToScheme(Scheme); err != nil { + panic(err) + } if err := auditv1beta1.AddToScheme(Scheme); err != nil { panic(err) }