mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update kubernetes dep to 1.24.0
As kubernetes 1.24.0 is released, updating kubernetes dependencies to 1.24.0 updates: #3086 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
fc1529f268
commit
c4f79d455f
32
vendor/k8s.io/apiserver/pkg/admission/audit.go
generated
vendored
32
vendor/k8s.io/apiserver/pkg/admission/audit.go
generated
vendored
@ -19,19 +19,13 @@ package admission
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
auditinternal "k8s.io/apiserver/pkg/apis/audit"
|
||||
"k8s.io/apiserver/pkg/audit"
|
||||
)
|
||||
|
||||
// auditHandler logs annotations set by other admission handlers
|
||||
type auditHandler struct {
|
||||
Interface
|
||||
// TODO: move the lock near the Annotations field of the audit event so it is always protected from concurrent access.
|
||||
// to protect the 'Annotations' map of the audit event from concurrent writes
|
||||
mutex sync.Mutex
|
||||
ae *auditinternal.Event
|
||||
}
|
||||
|
||||
var _ Interface = &auditHandler{}
|
||||
@ -42,11 +36,11 @@ var _ ValidationInterface = &auditHandler{}
|
||||
// of attribute into the audit event. Attributes passed to the Admit and
|
||||
// Validate function must be instance of privateAnnotationsGetter or
|
||||
// AnnotationsGetter, otherwise an error is returned.
|
||||
func WithAudit(i Interface, ae *auditinternal.Event) Interface {
|
||||
func WithAudit(i Interface) Interface {
|
||||
if i == nil {
|
||||
return i
|
||||
}
|
||||
return &auditHandler{Interface: i, ae: ae}
|
||||
return &auditHandler{Interface: i}
|
||||
}
|
||||
|
||||
func (handler *auditHandler) Admit(ctx context.Context, a Attributes, o ObjectInterfaces) error {
|
||||
@ -59,7 +53,7 @@ func (handler *auditHandler) Admit(ctx context.Context, a Attributes, o ObjectIn
|
||||
var err error
|
||||
if mutator, ok := handler.Interface.(MutationInterface); ok {
|
||||
err = mutator.Admit(ctx, a, o)
|
||||
handler.logAnnotations(a)
|
||||
handler.logAnnotations(ctx, a)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@ -74,7 +68,7 @@ func (handler *auditHandler) Validate(ctx context.Context, a Attributes, o Objec
|
||||
var err error
|
||||
if validator, ok := handler.Interface.(ValidationInterface); ok {
|
||||
err = validator.Validate(ctx, a, o)
|
||||
handler.logAnnotations(a)
|
||||
handler.logAnnotations(ctx, a)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@ -88,23 +82,21 @@ func ensureAnnotationGetter(a Attributes) error {
|
||||
return fmt.Errorf("attributes must be an instance of privateAnnotationsGetter or AnnotationsGetter")
|
||||
}
|
||||
|
||||
func (handler *auditHandler) logAnnotations(a Attributes) {
|
||||
if handler.ae == nil {
|
||||
func (handler *auditHandler) logAnnotations(ctx context.Context, a Attributes) {
|
||||
ae := audit.AuditEventFrom(ctx)
|
||||
if ae == nil {
|
||||
return
|
||||
}
|
||||
handler.mutex.Lock()
|
||||
defer handler.mutex.Unlock()
|
||||
|
||||
var annotations map[string]string
|
||||
switch a := a.(type) {
|
||||
case privateAnnotationsGetter:
|
||||
for key, value := range a.getAnnotations(handler.ae.Level) {
|
||||
audit.LogAnnotation(handler.ae, key, value)
|
||||
}
|
||||
annotations = a.getAnnotations(ae.Level)
|
||||
case AnnotationsGetter:
|
||||
for key, value := range a.GetAnnotations(handler.ae.Level) {
|
||||
audit.LogAnnotation(handler.ae, key, value)
|
||||
}
|
||||
annotations = a.GetAnnotations(ae.Level)
|
||||
default:
|
||||
// this will never happen, because we have already checked it in ensureAnnotationGetter
|
||||
}
|
||||
|
||||
audit.AddAuditAnnotationsMap(ctx, annotations)
|
||||
}
|
||||
|
2
vendor/k8s.io/apiserver/pkg/admission/interfaces.go
generated
vendored
2
vendor/k8s.io/apiserver/pkg/admission/interfaces.go
generated
vendored
@ -52,7 +52,7 @@ type Attributes interface {
|
||||
IsDryRun() bool
|
||||
// GetObject is the object from the incoming request prior to default values being applied
|
||||
GetObject() runtime.Object
|
||||
// GetOldObject is the existing object. Only populated for UPDATE requests.
|
||||
// GetOldObject is the existing object. Only populated for UPDATE and DELETE requests.
|
||||
GetOldObject() runtime.Object
|
||||
// GetKind is the type of object being manipulated. For example: Pod
|
||||
GetKind() schema.GroupVersionKind
|
||||
|
19
vendor/k8s.io/apiserver/pkg/admission/metrics/metrics.go
generated
vendored
19
vendor/k8s.io/apiserver/pkg/admission/metrics/metrics.go
generated
vendored
@ -116,6 +116,7 @@ type AdmissionMetrics struct {
|
||||
controller *metricSet
|
||||
webhook *metricSet
|
||||
webhookRejection *metrics.CounterVec
|
||||
webhookFailOpen *metrics.CounterVec
|
||||
webhookRequest *metrics.CounterVec
|
||||
}
|
||||
|
||||
@ -196,6 +197,16 @@ func newAdmissionMetrics() *AdmissionMetrics {
|
||||
},
|
||||
[]string{"name", "type", "operation", "error_type", "rejection_code"})
|
||||
|
||||
webhookFailOpen := metrics.NewCounterVec(
|
||||
&metrics.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: "webhook_fail_open_count",
|
||||
Help: "Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
[]string{"name", "type"})
|
||||
|
||||
webhookRequest := metrics.NewCounterVec(
|
||||
&metrics.CounterOpts{
|
||||
Namespace: namespace,
|
||||
@ -210,8 +221,9 @@ func newAdmissionMetrics() *AdmissionMetrics {
|
||||
controller.mustRegister()
|
||||
webhook.mustRegister()
|
||||
legacyregistry.MustRegister(webhookRejection)
|
||||
legacyregistry.MustRegister(webhookFailOpen)
|
||||
legacyregistry.MustRegister(webhookRequest)
|
||||
return &AdmissionMetrics{step: step, controller: controller, webhook: webhook, webhookRejection: webhookRejection, webhookRequest: webhookRequest}
|
||||
return &AdmissionMetrics{step: step, controller: controller, webhook: webhook, webhookRejection: webhookRejection, webhookFailOpen: webhookFailOpen, webhookRequest: webhookRequest}
|
||||
}
|
||||
|
||||
func (m *AdmissionMetrics) reset() {
|
||||
@ -250,6 +262,11 @@ func (m *AdmissionMetrics) ObserveWebhookRejection(ctx context.Context, name, st
|
||||
m.webhookRejection.WithContext(ctx).WithLabelValues(name, stepType, operation, string(errorType), strconv.Itoa(rejectionCode)).Inc()
|
||||
}
|
||||
|
||||
// ObserveWebhookFailOpen records validating or mutating webhook that fail open.
|
||||
func (m *AdmissionMetrics) ObserveWebhookFailOpen(ctx context.Context, name, stepType string) {
|
||||
m.webhookFailOpen.WithContext(ctx).WithLabelValues(name, stepType).Inc()
|
||||
}
|
||||
|
||||
type metricSet struct {
|
||||
latencies *metrics.HistogramVec
|
||||
latenciesSummary *metrics.SummaryVec
|
||||
|
6
vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go
generated
vendored
6
vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go
generated
vendored
@ -178,7 +178,7 @@ func (a *mutatingDispatcher) Dispatch(ctx context.Context, attr admission.Attrib
|
||||
if callErr, ok := err.(*webhookutil.ErrCallingWebhook); ok {
|
||||
if ignoreClientCallFailures {
|
||||
klog.Warningf("Failed calling webhook, failing open %v: %v", hook.Name, callErr)
|
||||
|
||||
admissionmetrics.Metrics.ObserveWebhookFailOpen(ctx, hook.Name, "admit")
|
||||
annotator.addFailedOpenAnnotation()
|
||||
|
||||
utilruntime.HandleError(callErr)
|
||||
@ -265,9 +265,9 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss
|
||||
}
|
||||
|
||||
do := func() { err = r.Do(ctx).Into(response) }
|
||||
if wd, ok := endpointsrequest.WebhookDurationFrom(ctx); ok {
|
||||
if wd, ok := endpointsrequest.LatencyTrackersFrom(ctx); ok {
|
||||
tmp := do
|
||||
do = func() { wd.AdmitTracker.Track(tmp) }
|
||||
do = func() { wd.MutatingWebhookTracker.Track(tmp) }
|
||||
}
|
||||
do()
|
||||
if err != nil {
|
||||
|
7
vendor/k8s.io/apiserver/pkg/apis/audit/OWNERS
generated
vendored
7
vendor/k8s.io/apiserver/pkg/apis/audit/OWNERS
generated
vendored
@ -2,8 +2,7 @@
|
||||
|
||||
# approval on api packages bubbles to api-approvers
|
||||
reviewers:
|
||||
- sig-auth-audit-approvers
|
||||
- sig-auth-audit-reviewers
|
||||
- sig-auth-audit-approvers
|
||||
- sig-auth-audit-reviewers
|
||||
labels:
|
||||
- sig/auth
|
||||
|
||||
- sig/auth
|
||||
|
6
vendor/k8s.io/apiserver/pkg/apis/audit/types.go
generated
vendored
6
vendor/k8s.io/apiserver/pkg/apis/audit/types.go
generated
vendored
@ -98,6 +98,12 @@ type Event struct {
|
||||
// +optional
|
||||
ImpersonatedUser *authnv1.UserInfo
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// The source IPs are listed from (in order):
|
||||
// 1. X-Forwarded-For request header IPs
|
||||
// 2. X-Real-Ip header, if not present in the X-Forwarded-For list
|
||||
// 3. The remote address for the connection, if it doesn't match the last
|
||||
// IP in the list up to here (X-Forwarded-For or X-Real-Ip).
|
||||
// Note: All but the last IP can be arbitrarily set by the client.
|
||||
// +optional
|
||||
SourceIPs []string
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
|
164
vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.pb.go
generated
vendored
164
vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.pb.go
generated
vendored
@ -261,88 +261,88 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_4982ac40a460d730 = []byte{
|
||||
// 1287 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0xc5,
|
||||
0x17, 0xcf, 0xc6, 0x71, 0x63, 0x8f, 0x1b, 0xc7, 0x99, 0xf6, 0xfb, 0xed, 0x92, 0x83, 0x6d, 0x8c,
|
||||
0x84, 0x0c, 0x84, 0xdd, 0x26, 0x14, 0x5a, 0x55, 0x02, 0xc9, 0xa6, 0xa5, 0x58, 0xb4, 0x49, 0x34,
|
||||
0xc6, 0x3d, 0x20, 0x0e, 0x5d, 0xaf, 0x5f, 0xec, 0xc5, 0xf6, 0xec, 0x76, 0x67, 0xd6, 0x28, 0x37,
|
||||
0xfe, 0x01, 0x24, 0xee, 0xfc, 0x17, 0xdc, 0x10, 0x27, 0x6e, 0x39, 0xf6, 0xd8, 0x93, 0x45, 0x0c,
|
||||
0x7f, 0x45, 0x0e, 0x08, 0xcd, 0xec, 0xec, 0x0f, 0x3b, 0xb1, 0xea, 0x70, 0xe0, 0xb6, 0xf3, 0xde,
|
||||
0xe7, 0xf3, 0x79, 0x6f, 0xdf, 0xbe, 0xf7, 0x66, 0xd1, 0x57, 0xc3, 0x07, 0xcc, 0x70, 0x5c, 0x73,
|
||||
0x18, 0x74, 0xc1, 0xa7, 0xc0, 0x81, 0x99, 0x13, 0xa0, 0x3d, 0xd7, 0x37, 0x95, 0xc3, 0xf2, 0x1c,
|
||||
0x06, 0xfe, 0x04, 0x7c, 0xd3, 0x1b, 0xf6, 0xe5, 0xc9, 0xb4, 0x82, 0x9e, 0xc3, 0xcd, 0xc9, 0xbe,
|
||||
0xd9, 0x07, 0x0a, 0xbe, 0xc5, 0xa1, 0x67, 0x78, 0xbe, 0xcb, 0x5d, 0x5c, 0x0b, 0x39, 0x46, 0xcc,
|
||||
0x31, 0xbc, 0x61, 0x5f, 0x9e, 0x0c, 0xc9, 0x31, 0x26, 0xfb, 0xbb, 0x1f, 0xf6, 0x1d, 0x3e, 0x08,
|
||||
0xba, 0x86, 0xed, 0x8e, 0xcd, 0xbe, 0xdb, 0x77, 0x4d, 0x49, 0xed, 0x06, 0x27, 0xf2, 0x24, 0x0f,
|
||||
0xf2, 0x29, 0x94, 0xdc, 0xdd, 0x4b, 0xd2, 0x30, 0xad, 0x80, 0x0f, 0x80, 0x72, 0xc7, 0xb6, 0xb8,
|
||||
0xe3, 0xd2, 0x2b, 0x12, 0xd8, 0xbd, 0x97, 0xa0, 0xc7, 0x96, 0x3d, 0x70, 0x28, 0xf8, 0xa7, 0x49,
|
||||
0xde, 0x63, 0xe0, 0xd6, 0x55, 0x2c, 0x73, 0x19, 0xcb, 0x0f, 0x28, 0x77, 0xc6, 0x70, 0x89, 0xf0,
|
||||
0xc9, 0x9b, 0x08, 0xcc, 0x1e, 0xc0, 0xd8, 0x5a, 0xe4, 0xd5, 0xfe, 0x42, 0x28, 0xfb, 0x78, 0x02,
|
||||
0x94, 0xe3, 0x3d, 0x94, 0x1d, 0xc1, 0x04, 0x46, 0xba, 0x56, 0xd5, 0xea, 0xf9, 0xe6, 0xff, 0xcf,
|
||||
0xa6, 0x95, 0xb5, 0xd9, 0xb4, 0x92, 0x7d, 0x2a, 0x8c, 0x17, 0xd1, 0x03, 0x09, 0x41, 0xf8, 0x10,
|
||||
0x6d, 0xca, 0xfa, 0xb5, 0x1e, 0xe9, 0xeb, 0x12, 0x7f, 0x4f, 0xe1, 0x37, 0x1b, 0xa1, 0xf9, 0x62,
|
||||
0x5a, 0x79, 0x7b, 0x59, 0x4e, 0xfc, 0xd4, 0x03, 0x66, 0x74, 0x5a, 0x8f, 0x48, 0x24, 0x22, 0xa2,
|
||||
0x33, 0x6e, 0xf5, 0x41, 0xcf, 0xcc, 0x47, 0x6f, 0x0b, 0xe3, 0x45, 0xf4, 0x40, 0x42, 0x10, 0x3e,
|
||||
0x40, 0xc8, 0x87, 0x97, 0x01, 0x30, 0xde, 0x21, 0x2d, 0x7d, 0x43, 0x52, 0xb0, 0xa2, 0x20, 0x12,
|
||||
0x7b, 0x48, 0x0a, 0x85, 0xab, 0x68, 0x63, 0x02, 0x7e, 0x57, 0xcf, 0x4a, 0xf4, 0x4d, 0x85, 0xde,
|
||||
0x78, 0x0e, 0x7e, 0x97, 0x48, 0x0f, 0xfe, 0x12, 0x6d, 0x04, 0x0c, 0x7c, 0xfd, 0x46, 0x55, 0xab,
|
||||
0x17, 0x0e, 0xde, 0x35, 0x92, 0xd6, 0x31, 0xe6, 0xbf, 0xb3, 0x31, 0xd9, 0x37, 0x3a, 0x0c, 0xfc,
|
||||
0x16, 0x3d, 0x71, 0x13, 0x25, 0x61, 0x21, 0x52, 0x01, 0x0f, 0x50, 0xc9, 0x19, 0x7b, 0xe0, 0x33,
|
||||
0x97, 0x8a, 0x5a, 0x0b, 0x8f, 0xbe, 0x79, 0x2d, 0xd5, 0xdb, 0xb3, 0x69, 0xa5, 0xd4, 0x5a, 0xd0,
|
||||
0x20, 0x97, 0x54, 0xf1, 0x07, 0x28, 0xcf, 0xdc, 0xc0, 0xb7, 0xa1, 0x75, 0xcc, 0xf4, 0x5c, 0x35,
|
||||
0x53, 0xcf, 0x37, 0xb7, 0x66, 0xd3, 0x4a, 0xbe, 0x1d, 0x19, 0x49, 0xe2, 0xc7, 0x26, 0xca, 0x8b,
|
||||
0xf4, 0x1a, 0x7d, 0xa0, 0x5c, 0x2f, 0xc9, 0x3a, 0xec, 0xa8, 0xec, 0xf3, 0x9d, 0xc8, 0x41, 0x12,
|
||||
0x0c, 0x7e, 0x81, 0xf2, 0x6e, 0xf7, 0x3b, 0xb0, 0x39, 0x81, 0x13, 0x3d, 0x2f, 0x5f, 0xe0, 0x23,
|
||||
0xe3, 0xcd, 0x13, 0x65, 0x1c, 0x45, 0x24, 0xf0, 0x81, 0xda, 0x10, 0xa6, 0x14, 0x1b, 0x49, 0x22,
|
||||
0x8a, 0x07, 0xa8, 0xe8, 0x03, 0xf3, 0x5c, 0xca, 0xa0, 0xcd, 0x2d, 0x1e, 0x30, 0x1d, 0xc9, 0x30,
|
||||
0x7b, 0xa9, 0x30, 0x71, 0xf3, 0x24, 0x91, 0xc4, 0xdc, 0x88, 0x40, 0x21, 0xa7, 0x89, 0x67, 0xd3,
|
||||
0x4a, 0x91, 0xcc, 0xe9, 0x90, 0x05, 0x5d, 0x6c, 0xa1, 0x2d, 0xd5, 0x0d, 0x61, 0x22, 0x7a, 0x41,
|
||||
0x06, 0xaa, 0x2f, 0x0d, 0xa4, 0x26, 0xc7, 0xe8, 0xd0, 0x21, 0x75, 0xbf, 0xa7, 0xcd, 0x9d, 0xd9,
|
||||
0xb4, 0xb2, 0x45, 0xd2, 0x12, 0x64, 0x5e, 0x11, 0xf7, 0x92, 0x97, 0x51, 0x31, 0x6e, 0x5e, 0x33,
|
||||
0xc6, 0xdc, 0x8b, 0xa8, 0x20, 0x0b, 0x9a, 0xf8, 0x47, 0x0d, 0xe9, 0x2a, 0x2e, 0x01, 0x1b, 0x9c,
|
||||
0x09, 0xf4, 0xbe, 0x76, 0xc6, 0xc0, 0xb8, 0x35, 0xf6, 0xf4, 0x2d, 0x19, 0xd0, 0x5c, 0xad, 0x7a,
|
||||
0xcf, 0x1c, 0xdb, 0x77, 0x05, 0xb7, 0x59, 0x55, 0x6d, 0xa0, 0x93, 0x25, 0xc2, 0x64, 0x69, 0x48,
|
||||
0xec, 0xa2, 0xa2, 0x9c, 0xca, 0x24, 0x89, 0xe2, 0xbf, 0x4b, 0x22, 0x1a, 0xfa, 0x62, 0x7b, 0x4e,
|
||||
0x8e, 0x2c, 0xc8, 0xe3, 0x97, 0xa8, 0x60, 0x51, 0xea, 0x72, 0x39, 0x35, 0x4c, 0xdf, 0xae, 0x66,
|
||||
0xea, 0x85, 0x83, 0x87, 0xab, 0xf4, 0xa5, 0xdc, 0x74, 0x46, 0x23, 0x21, 0x3f, 0xa6, 0xdc, 0x3f,
|
||||
0x6d, 0xde, 0x52, 0x81, 0x0b, 0x29, 0x0f, 0x49, 0xc7, 0xd8, 0xfd, 0x0c, 0x95, 0x16, 0x59, 0xb8,
|
||||
0x84, 0x32, 0x43, 0x38, 0x0d, 0xd7, 0x25, 0x11, 0x8f, 0xf8, 0x36, 0xca, 0x4e, 0xac, 0x51, 0x00,
|
||||
0xe1, 0x4a, 0x24, 0xe1, 0xe1, 0xe1, 0xfa, 0x03, 0xad, 0xf6, 0xab, 0x86, 0xf2, 0x32, 0xf8, 0x53,
|
||||
0x87, 0x71, 0xfc, 0x2d, 0xca, 0x89, 0xb7, 0xef, 0x59, 0xdc, 0x92, 0xf4, 0xc2, 0x81, 0xb1, 0x5a,
|
||||
0xad, 0x04, 0xfb, 0x19, 0x70, 0xab, 0x59, 0x52, 0x19, 0xe7, 0x22, 0x0b, 0x89, 0x15, 0xf1, 0x21,
|
||||
0xca, 0x3a, 0x1c, 0xc6, 0x4c, 0x5f, 0x97, 0x85, 0x79, 0x6f, 0xe5, 0xc2, 0x34, 0xb7, 0xa2, 0xad,
|
||||
0xdb, 0x12, 0x7c, 0x12, 0xca, 0xd4, 0x7e, 0xd6, 0x50, 0xf1, 0x89, 0xef, 0x06, 0x1e, 0x81, 0x70,
|
||||
0x95, 0x30, 0xfc, 0x0e, 0xca, 0xf6, 0x85, 0x45, 0xdd, 0x15, 0x31, 0x2f, 0x84, 0x85, 0x3e, 0xb1,
|
||||
0x9a, 0xfc, 0x88, 0x21, 0x73, 0x51, 0xab, 0x29, 0x96, 0x21, 0x89, 0x1f, 0xdf, 0x17, 0xd3, 0x19,
|
||||
0x1e, 0x0e, 0xad, 0x31, 0x30, 0x3d, 0x23, 0x09, 0x6a, 0xe6, 0x52, 0x0e, 0x32, 0x8f, 0xab, 0xfd,
|
||||
0x92, 0x41, 0xdb, 0x0b, 0xeb, 0x06, 0xef, 0xa1, 0x5c, 0x04, 0x52, 0x19, 0xc6, 0xf5, 0x8a, 0xb4,
|
||||
0x48, 0x8c, 0x10, 0x5b, 0x91, 0x0a, 0x29, 0xcf, 0xb2, 0xd5, 0x97, 0x4b, 0xb6, 0xe2, 0x61, 0xe4,
|
||||
0x20, 0x09, 0x46, 0xdc, 0x24, 0xe2, 0xa0, 0xae, 0xaa, 0x78, 0xff, 0x0b, 0x2c, 0x91, 0x1e, 0xdc,
|
||||
0x44, 0x99, 0xc0, 0xe9, 0xa9, 0x8b, 0xe9, 0xae, 0x02, 0x64, 0x3a, 0xab, 0xde, 0x8a, 0x82, 0x2c,
|
||||
0x5e, 0xc2, 0xf2, 0x1c, 0x59, 0x51, 0x75, 0x67, 0xc5, 0x2f, 0xd1, 0x38, 0x6e, 0x85, 0x95, 0x8e,
|
||||
0x11, 0xe2, 0x46, 0xb4, 0x3c, 0xe7, 0x39, 0xf8, 0xcc, 0x71, 0xa9, 0xbc, 0xc1, 0x52, 0x37, 0x62,
|
||||
0xe3, 0xb8, 0xa5, 0x3c, 0x24, 0x85, 0xc2, 0x0d, 0xb4, 0x1d, 0x15, 0x21, 0x22, 0x6e, 0x4a, 0xe2,
|
||||
0x1d, 0x45, 0xdc, 0x26, 0xf3, 0x6e, 0xb2, 0x88, 0xc7, 0x1f, 0xa3, 0x02, 0x0b, 0xba, 0x71, 0xb1,
|
||||
0x73, 0x92, 0x1e, 0x8f, 0x53, 0x3b, 0x71, 0x91, 0x34, 0xae, 0xf6, 0xfb, 0x3a, 0xba, 0x71, 0xec,
|
||||
0x8e, 0x1c, 0xfb, 0x14, 0xbf, 0xb8, 0x34, 0x0b, 0x77, 0x57, 0x9b, 0x85, 0xf0, 0xa3, 0xcb, 0x69,
|
||||
0x88, 0x5f, 0x34, 0xb1, 0xa5, 0xe6, 0xa1, 0x8d, 0xb2, 0x7e, 0x30, 0x82, 0x68, 0x1e, 0x8c, 0x55,
|
||||
0xe6, 0x21, 0x4c, 0x8e, 0x04, 0x23, 0x48, 0x9a, 0x5b, 0x9c, 0x18, 0x09, 0xb5, 0xf0, 0x7d, 0x84,
|
||||
0xdc, 0xb1, 0xc3, 0xe5, 0xa6, 0x8a, 0x9a, 0xf5, 0x8e, 0x4c, 0x21, 0xb6, 0x26, 0x7f, 0x2d, 0x29,
|
||||
0x28, 0x7e, 0x82, 0x76, 0xc4, 0xe9, 0x99, 0x45, 0xad, 0x3e, 0xf4, 0xbe, 0x70, 0x60, 0xd4, 0x63,
|
||||
0xb2, 0x51, 0x72, 0xcd, 0xb7, 0x54, 0xa4, 0x9d, 0xa3, 0x45, 0x00, 0xb9, 0xcc, 0xa9, 0xfd, 0xa6,
|
||||
0x21, 0x14, 0xa6, 0xf9, 0x1f, 0xec, 0x94, 0xa3, 0xf9, 0x9d, 0xf2, 0xfe, 0xea, 0x35, 0x5c, 0xb2,
|
||||
0x54, 0xfe, 0xce, 0x44, 0xd9, 0x8b, 0xb2, 0x5e, 0xf3, 0xe7, 0xb3, 0x82, 0xb2, 0xe2, 0x1f, 0x25,
|
||||
0xda, 0x2a, 0x79, 0x81, 0x14, 0xff, 0x2f, 0x8c, 0x84, 0x76, 0x6c, 0x20, 0x24, 0x1e, 0xe4, 0x68,
|
||||
0x44, 0x5f, 0xa7, 0x28, 0xbe, 0x4e, 0x27, 0xb6, 0x92, 0x14, 0x42, 0x08, 0x8a, 0x3f, 0x40, 0xf1,
|
||||
0x21, 0x62, 0x41, 0xf1, 0x63, 0xc8, 0x48, 0x68, 0xc7, 0x76, 0x7a, 0x97, 0x65, 0x65, 0x0d, 0x0e,
|
||||
0x56, 0xa9, 0xc1, 0xfc, 0xde, 0x4c, 0xf6, 0xca, 0x95, 0x3b, 0xd0, 0x40, 0x28, 0x5e, 0x32, 0x4c,
|
||||
0xbf, 0x91, 0x64, 0x1d, 0x6f, 0x21, 0x46, 0x52, 0x08, 0xfc, 0x29, 0xda, 0xa6, 0x2e, 0x8d, 0xa4,
|
||||
0x3a, 0xe4, 0x29, 0xd3, 0x37, 0x25, 0xe9, 0x96, 0x98, 0xdd, 0xc3, 0x79, 0x17, 0x59, 0xc4, 0x2e,
|
||||
0xb4, 0x70, 0x6e, 0xf5, 0x16, 0xfe, 0xfc, 0xaa, 0x16, 0xce, 0xcb, 0x16, 0xfe, 0xdf, 0xaa, 0xed,
|
||||
0xdb, 0xac, 0x9f, 0x9d, 0x97, 0xd7, 0x5e, 0x9d, 0x97, 0xd7, 0x5e, 0x9f, 0x97, 0xd7, 0x7e, 0x98,
|
||||
0x95, 0xb5, 0xb3, 0x59, 0x59, 0x7b, 0x35, 0x2b, 0x6b, 0xaf, 0x67, 0x65, 0xed, 0x8f, 0x59, 0x59,
|
||||
0xfb, 0xe9, 0xcf, 0xf2, 0xda, 0x37, 0xeb, 0x93, 0xfd, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6a,
|
||||
0x8e, 0x8a, 0xae, 0x10, 0x0e, 0x00, 0x00,
|
||||
// 1288 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xcf, 0xc6, 0x71, 0x63, 0x8f, 0x1b, 0xc7, 0x99, 0x16, 0xba, 0xe4, 0x60, 0x1b, 0x23, 0xa1,
|
||||
0x00, 0x61, 0xb7, 0x0d, 0x85, 0x56, 0x95, 0x40, 0xb2, 0x69, 0x69, 0x2d, 0x9a, 0x3f, 0x1a, 0xe3,
|
||||
0x1e, 0x10, 0x87, 0xae, 0xd7, 0x2f, 0xf6, 0x62, 0x7b, 0x76, 0xbb, 0x33, 0x6b, 0x94, 0x1b, 0x5f,
|
||||
0x00, 0x89, 0x3b, 0xdf, 0x82, 0x1b, 0xe2, 0xc4, 0x2d, 0xc7, 0x1e, 0x7b, 0xb2, 0x88, 0xe1, 0x53,
|
||||
0xe4, 0x80, 0xd0, 0xcc, 0xce, 0xfe, 0xb1, 0x13, 0x2b, 0x0e, 0x07, 0x6e, 0x9e, 0xf7, 0x7e, 0xbf,
|
||||
0xdf, 0x7b, 0xfb, 0xf6, 0xbd, 0x37, 0x6b, 0xf4, 0xf5, 0xe0, 0x21, 0x33, 0x1c, 0xd7, 0x1c, 0x04,
|
||||
0x1d, 0xf0, 0x29, 0x70, 0x60, 0xe6, 0x18, 0x68, 0xd7, 0xf5, 0x4d, 0xe5, 0xb0, 0x3c, 0x87, 0x81,
|
||||
0x3f, 0x06, 0xdf, 0xf4, 0x06, 0x3d, 0x79, 0x32, 0xad, 0xa0, 0xeb, 0x70, 0x73, 0x7c, 0xcf, 0xec,
|
||||
0x01, 0x05, 0xdf, 0xe2, 0xd0, 0x35, 0x3c, 0xdf, 0xe5, 0x2e, 0xae, 0x85, 0x1c, 0x23, 0xe6, 0x18,
|
||||
0xde, 0xa0, 0x27, 0x4f, 0x86, 0xe4, 0x18, 0xe3, 0x7b, 0xdb, 0x1f, 0xf7, 0x1c, 0xde, 0x0f, 0x3a,
|
||||
0x86, 0xed, 0x8e, 0xcc, 0x9e, 0xdb, 0x73, 0x4d, 0x49, 0xed, 0x04, 0xc7, 0xf2, 0x24, 0x0f, 0xf2,
|
||||
0x57, 0x28, 0xb9, 0xbd, 0x9b, 0xa4, 0x61, 0x5a, 0x01, 0xef, 0x03, 0xe5, 0x8e, 0x6d, 0x71, 0xc7,
|
||||
0xa5, 0x97, 0x24, 0xb0, 0x7d, 0x3f, 0x41, 0x8f, 0x2c, 0xbb, 0xef, 0x50, 0xf0, 0x4f, 0x92, 0xbc,
|
||||
0x47, 0xc0, 0xad, 0xcb, 0x58, 0xe6, 0x22, 0x96, 0x1f, 0x50, 0xee, 0x8c, 0xe0, 0x02, 0xe1, 0xb3,
|
||||
0xab, 0x08, 0xcc, 0xee, 0xc3, 0xc8, 0x9a, 0xe7, 0xd5, 0xfe, 0x46, 0x28, 0xfb, 0x64, 0x0c, 0x94,
|
||||
0xe3, 0x5d, 0x94, 0x1d, 0xc2, 0x18, 0x86, 0xba, 0x56, 0xd5, 0x76, 0xf2, 0x8d, 0xb7, 0x4f, 0x27,
|
||||
0x95, 0x95, 0xe9, 0xa4, 0x92, 0x7d, 0x2e, 0x8c, 0xe7, 0xd1, 0x0f, 0x12, 0x82, 0xf0, 0x01, 0x5a,
|
||||
0x97, 0xf5, 0x6b, 0x3e, 0xd6, 0x57, 0x25, 0xfe, 0xbe, 0xc2, 0xaf, 0xd7, 0x43, 0xf3, 0xf9, 0xa4,
|
||||
0xf2, 0xee, 0xa2, 0x9c, 0xf8, 0x89, 0x07, 0xcc, 0x68, 0x37, 0x1f, 0x93, 0x48, 0x44, 0x44, 0x67,
|
||||
0xdc, 0xea, 0x81, 0x9e, 0x99, 0x8d, 0xde, 0x12, 0xc6, 0xf3, 0xe8, 0x07, 0x09, 0x41, 0x78, 0x0f,
|
||||
0x21, 0x1f, 0x5e, 0x05, 0xc0, 0x78, 0x9b, 0x34, 0xf5, 0x35, 0x49, 0xc1, 0x8a, 0x82, 0x48, 0xec,
|
||||
0x21, 0x29, 0x14, 0xae, 0xa2, 0xb5, 0x31, 0xf8, 0x1d, 0x3d, 0x2b, 0xd1, 0x37, 0x15, 0x7a, 0xed,
|
||||
0x05, 0xf8, 0x1d, 0x22, 0x3d, 0xf8, 0x19, 0x5a, 0x0b, 0x18, 0xf8, 0xfa, 0x8d, 0xaa, 0xb6, 0x53,
|
||||
0xd8, 0x7b, 0xdf, 0x48, 0x5a, 0xc7, 0x98, 0x7d, 0xcf, 0xc6, 0xf8, 0x9e, 0xd1, 0x66, 0xe0, 0x37,
|
||||
0xe9, 0xb1, 0x9b, 0x28, 0x09, 0x0b, 0x91, 0x0a, 0xb8, 0x8f, 0x4a, 0xce, 0xc8, 0x03, 0x9f, 0xb9,
|
||||
0x54, 0xd4, 0x5a, 0x78, 0xf4, 0xf5, 0x6b, 0xa9, 0xde, 0x9e, 0x4e, 0x2a, 0xa5, 0xe6, 0x9c, 0x06,
|
||||
0xb9, 0xa0, 0x8a, 0x3f, 0x42, 0x79, 0xe6, 0x06, 0xbe, 0x0d, 0xcd, 0x23, 0xa6, 0xe7, 0xaa, 0x99,
|
||||
0x9d, 0x7c, 0x63, 0x63, 0x3a, 0xa9, 0xe4, 0x5b, 0x91, 0x91, 0x24, 0x7e, 0x6c, 0xa2, 0xbc, 0x48,
|
||||
0xaf, 0xde, 0x03, 0xca, 0xf5, 0x92, 0xac, 0xc3, 0x96, 0xca, 0x3e, 0xdf, 0x8e, 0x1c, 0x24, 0xc1,
|
||||
0xe0, 0x97, 0x28, 0xef, 0x76, 0xbe, 0x07, 0x9b, 0x13, 0x38, 0xd6, 0xf3, 0xf2, 0x01, 0x3e, 0x31,
|
||||
0xae, 0x9e, 0x28, 0xe3, 0x30, 0x22, 0x81, 0x0f, 0xd4, 0x86, 0x30, 0xa5, 0xd8, 0x48, 0x12, 0x51,
|
||||
0xdc, 0x47, 0x45, 0x1f, 0x98, 0xe7, 0x52, 0x06, 0x2d, 0x6e, 0xf1, 0x80, 0xe9, 0x48, 0x86, 0xd9,
|
||||
0x4d, 0x85, 0x89, 0x9b, 0x27, 0x89, 0x24, 0xe6, 0x46, 0x04, 0x0a, 0x39, 0x0d, 0x3c, 0x9d, 0x54,
|
||||
0x8a, 0x64, 0x46, 0x87, 0xcc, 0xe9, 0x62, 0x0b, 0x6d, 0xa8, 0x6e, 0x08, 0x13, 0xd1, 0x0b, 0x32,
|
||||
0xd0, 0xce, 0xc2, 0x40, 0x6a, 0x72, 0x8c, 0x36, 0x1d, 0x50, 0xf7, 0x07, 0xda, 0xd8, 0x9a, 0x4e,
|
||||
0x2a, 0x1b, 0x24, 0x2d, 0x41, 0x66, 0x15, 0x71, 0x37, 0x79, 0x18, 0x15, 0xe3, 0xe6, 0x35, 0x63,
|
||||
0xcc, 0x3c, 0x88, 0x0a, 0x32, 0xa7, 0x89, 0x7f, 0xd2, 0x90, 0xae, 0xe2, 0x12, 0xb0, 0xc1, 0x19,
|
||||
0x43, 0xf7, 0x1b, 0x67, 0x04, 0x8c, 0x5b, 0x23, 0x4f, 0xdf, 0x90, 0x01, 0xcd, 0xe5, 0xaa, 0xb7,
|
||||
0xef, 0xd8, 0xbe, 0x2b, 0xb8, 0x8d, 0xaa, 0x6a, 0x03, 0x9d, 0x2c, 0x10, 0x26, 0x0b, 0x43, 0x62,
|
||||
0x17, 0x15, 0xe5, 0x54, 0x26, 0x49, 0x14, 0xff, 0x5b, 0x12, 0xd1, 0xd0, 0x17, 0x5b, 0x33, 0x72,
|
||||
0x64, 0x4e, 0x1e, 0xbf, 0x42, 0x05, 0x8b, 0x52, 0x97, 0xcb, 0xa9, 0x61, 0xfa, 0x66, 0x35, 0xb3,
|
||||
0x53, 0xd8, 0x7b, 0xb4, 0x4c, 0x5f, 0xca, 0x4d, 0x67, 0xd4, 0x13, 0xf2, 0x13, 0xca, 0xfd, 0x93,
|
||||
0xc6, 0x2d, 0x15, 0xb8, 0x90, 0xf2, 0x90, 0x74, 0x8c, 0xed, 0x2f, 0x50, 0x69, 0x9e, 0x85, 0x4b,
|
||||
0x28, 0x33, 0x80, 0x93, 0x70, 0x5d, 0x12, 0xf1, 0x13, 0xdf, 0x46, 0xd9, 0xb1, 0x35, 0x0c, 0x20,
|
||||
0x5c, 0x89, 0x24, 0x3c, 0x3c, 0x5a, 0x7d, 0xa8, 0xd5, 0x7e, 0xd3, 0x50, 0x5e, 0x06, 0x7f, 0xee,
|
||||
0x30, 0x8e, 0xbf, 0x43, 0x39, 0xf1, 0xf4, 0x5d, 0x8b, 0x5b, 0x92, 0x5e, 0xd8, 0x33, 0x96, 0xab,
|
||||
0x95, 0x60, 0xef, 0x03, 0xb7, 0x1a, 0x25, 0x95, 0x71, 0x2e, 0xb2, 0x90, 0x58, 0x11, 0x1f, 0xa0,
|
||||
0xac, 0xc3, 0x61, 0xc4, 0xf4, 0x55, 0x59, 0x98, 0x0f, 0x96, 0x2e, 0x4c, 0x63, 0x23, 0xda, 0xba,
|
||||
0x4d, 0xc1, 0x27, 0xa1, 0x4c, 0xed, 0x17, 0x0d, 0x15, 0x9f, 0xfa, 0x6e, 0xe0, 0x11, 0x08, 0x57,
|
||||
0x09, 0xc3, 0xef, 0xa1, 0x6c, 0x4f, 0x58, 0xd4, 0x5d, 0x11, 0xf3, 0x42, 0x58, 0xe8, 0x13, 0xab,
|
||||
0xc9, 0x8f, 0x18, 0x32, 0x17, 0xb5, 0x9a, 0x62, 0x19, 0x92, 0xf8, 0xf1, 0x03, 0x31, 0x9d, 0xe1,
|
||||
0xe1, 0xc0, 0x1a, 0x01, 0xd3, 0x33, 0x92, 0xa0, 0x66, 0x2e, 0xe5, 0x20, 0xb3, 0xb8, 0xda, 0xaf,
|
||||
0x19, 0xb4, 0x39, 0xb7, 0x6e, 0xf0, 0x2e, 0xca, 0x45, 0x20, 0x95, 0x61, 0x5c, 0xaf, 0x48, 0x8b,
|
||||
0xc4, 0x08, 0xb1, 0x15, 0xa9, 0x90, 0xf2, 0x2c, 0x5b, 0xbd, 0xb9, 0x64, 0x2b, 0x1e, 0x44, 0x0e,
|
||||
0x92, 0x60, 0xc4, 0x4d, 0x22, 0x0e, 0xea, 0xaa, 0x8a, 0xf7, 0xbf, 0xc0, 0x12, 0xe9, 0xc1, 0x0d,
|
||||
0x94, 0x09, 0x9c, 0xae, 0xba, 0x98, 0xee, 0x2a, 0x40, 0xa6, 0xbd, 0xec, 0xad, 0x28, 0xc8, 0xe2,
|
||||
0x21, 0x2c, 0xcf, 0x91, 0x15, 0x55, 0x77, 0x56, 0xfc, 0x10, 0xf5, 0xa3, 0x66, 0x58, 0xe9, 0x18,
|
||||
0x21, 0x6e, 0x44, 0xcb, 0x73, 0x5e, 0x80, 0xcf, 0x1c, 0x97, 0xca, 0x1b, 0x2c, 0x75, 0x23, 0xd6,
|
||||
0x8f, 0x9a, 0xca, 0x43, 0x52, 0x28, 0x5c, 0x47, 0x9b, 0x51, 0x11, 0x22, 0xe2, 0xba, 0x24, 0xde,
|
||||
0x51, 0xc4, 0x4d, 0x32, 0xeb, 0x26, 0xf3, 0x78, 0xfc, 0x29, 0x2a, 0xb0, 0xa0, 0x13, 0x17, 0x3b,
|
||||
0x27, 0xe9, 0xf1, 0x38, 0xb5, 0x12, 0x17, 0x49, 0xe3, 0x6a, 0x7f, 0xac, 0xa2, 0x1b, 0x47, 0xee,
|
||||
0xd0, 0xb1, 0x4f, 0xf0, 0xcb, 0x0b, 0xb3, 0x70, 0x77, 0xb9, 0x59, 0x08, 0x5f, 0xba, 0x9c, 0x86,
|
||||
0xf8, 0x41, 0x13, 0x5b, 0x6a, 0x1e, 0x5a, 0x28, 0xeb, 0x07, 0x43, 0x88, 0xe6, 0xc1, 0x58, 0x66,
|
||||
0x1e, 0xc2, 0xe4, 0x48, 0x30, 0x84, 0xa4, 0xb9, 0xc5, 0x89, 0x91, 0x50, 0x0b, 0x3f, 0x40, 0xc8,
|
||||
0x1d, 0x39, 0x5c, 0x6e, 0xaa, 0xa8, 0x59, 0xef, 0xc8, 0x14, 0x62, 0x6b, 0xf2, 0xd5, 0x92, 0x82,
|
||||
0xe2, 0xa7, 0x68, 0x4b, 0x9c, 0xf6, 0x2d, 0x6a, 0xf5, 0xa0, 0xfb, 0x95, 0x03, 0xc3, 0x2e, 0x93,
|
||||
0x8d, 0x92, 0x6b, 0xbc, 0xa3, 0x22, 0x6d, 0x1d, 0xce, 0x03, 0xc8, 0x45, 0x4e, 0xed, 0x77, 0x0d,
|
||||
0xa1, 0x30, 0xcd, 0xff, 0x61, 0xa7, 0x1c, 0xce, 0xee, 0x94, 0x0f, 0x97, 0xaf, 0xe1, 0x82, 0xa5,
|
||||
0xf2, 0x4f, 0x26, 0xca, 0x5e, 0x94, 0xf5, 0x9a, 0x1f, 0x9f, 0x15, 0x94, 0x15, 0xdf, 0x28, 0xd1,
|
||||
0x56, 0xc9, 0x0b, 0xa4, 0xf8, 0x7e, 0x61, 0x24, 0xb4, 0x63, 0x03, 0x21, 0xf1, 0x43, 0x8e, 0x46,
|
||||
0xf4, 0x76, 0x8a, 0xe2, 0xed, 0xb4, 0x63, 0x2b, 0x49, 0x21, 0x84, 0xa0, 0xf8, 0x02, 0x14, 0x2f,
|
||||
0x22, 0x16, 0x14, 0x1f, 0x86, 0x8c, 0x84, 0x76, 0x6c, 0xa7, 0x77, 0x59, 0x56, 0xd6, 0x60, 0x6f,
|
||||
0x99, 0x1a, 0xcc, 0xee, 0xcd, 0x64, 0xaf, 0x5c, 0xba, 0x03, 0x0d, 0x84, 0xe2, 0x25, 0xc3, 0xf4,
|
||||
0x1b, 0x49, 0xd6, 0xf1, 0x16, 0x62, 0x24, 0x85, 0xc0, 0x9f, 0xa3, 0x4d, 0xea, 0xd2, 0x48, 0xaa,
|
||||
0x4d, 0x9e, 0x33, 0x7d, 0x5d, 0x92, 0x6e, 0x89, 0xd9, 0x3d, 0x98, 0x75, 0x91, 0x79, 0xec, 0x5c,
|
||||
0x0b, 0xe7, 0x96, 0x6f, 0xe1, 0x2f, 0x2f, 0x6b, 0xe1, 0xbc, 0x6c, 0xe1, 0xb7, 0x96, 0x6d, 0xdf,
|
||||
0xc6, 0xb3, 0xd3, 0xb3, 0xf2, 0xca, 0xeb, 0xb3, 0xf2, 0xca, 0x9b, 0xb3, 0xf2, 0xca, 0x8f, 0xd3,
|
||||
0xb2, 0x76, 0x3a, 0x2d, 0x6b, 0xaf, 0xa7, 0x65, 0xed, 0xcd, 0xb4, 0xac, 0xfd, 0x39, 0x2d, 0x6b,
|
||||
0x3f, 0xff, 0x55, 0x5e, 0xf9, 0xb6, 0x76, 0xf5, 0x5f, 0xbe, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff,
|
||||
0xef, 0x9b, 0x7d, 0x75, 0x30, 0x0e, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Event) Marshal() (dAtA []byte, err error) {
|
||||
|
8
vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto
generated
vendored
8
vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto
generated
vendored
@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1";
|
||||
option go_package = "k8s.io/apiserver/pkg/apis/audit/v1";
|
||||
|
||||
// Event captures all the information that can be included in an API audit log.
|
||||
message Event {
|
||||
@ -55,6 +55,12 @@ message Event {
|
||||
optional k8s.io.api.authentication.v1.UserInfo impersonatedUser = 7;
|
||||
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// The source IPs are listed from (in order):
|
||||
// 1. X-Forwarded-For request header IPs
|
||||
// 2. X-Real-Ip header, if not present in the X-Forwarded-For list
|
||||
// 3. The remote address for the connection, if it doesn't match the last
|
||||
// IP in the list up to here (X-Forwarded-For or X-Real-Ip).
|
||||
// Note: All but the last IP can be arbitrarily set by the client.
|
||||
// +optional
|
||||
repeated string sourceIPs = 8;
|
||||
|
||||
|
6
vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go
generated
vendored
6
vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go
generated
vendored
@ -91,6 +91,12 @@ type Event struct {
|
||||
// +optional
|
||||
ImpersonatedUser *authnv1.UserInfo `json:"impersonatedUser,omitempty" protobuf:"bytes,7,opt,name=impersonatedUser"`
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// The source IPs are listed from (in order):
|
||||
// 1. X-Forwarded-For request header IPs
|
||||
// 2. X-Real-Ip header, if not present in the X-Forwarded-For list
|
||||
// 3. The remote address for the connection, if it doesn't match the last
|
||||
// IP in the list up to here (X-Forwarded-For or X-Real-Ip).
|
||||
// Note: All but the last IP can be arbitrarily set by the client.
|
||||
// +optional
|
||||
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,8,rep,name=sourceIPs"`
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
|
78
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/conversion.go
generated
vendored
78
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/conversion.go
generated
vendored
@ -1,78 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apiserver/pkg/apis/audit"
|
||||
)
|
||||
|
||||
func Convert_audit_ObjectReference_To_v1alpha1_ObjectReference(in *audit.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||
// Begin by copying all fields
|
||||
if err := autoConvert_audit_ObjectReference_To_v1alpha1_ObjectReference(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
// empty string means the core api group
|
||||
if in.APIGroup == "" {
|
||||
out.APIVersion = in.APIVersion
|
||||
} else {
|
||||
out.APIVersion = in.APIGroup + "/" + in.APIVersion
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, out *audit.ObjectReference, s conversion.Scope) error {
|
||||
// Begin by copying all fields
|
||||
if err := autoConvert_v1alpha1_ObjectReference_To_audit_ObjectReference(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
i := strings.LastIndex(in.APIVersion, "/")
|
||||
if i == -1 {
|
||||
// In fact it should always contain a "/"
|
||||
out.APIVersion = in.APIVersion
|
||||
} else {
|
||||
out.APIGroup = in.APIVersion[:i]
|
||||
out.APIVersion = in.APIVersion[i+1:]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1alpha1_Event_To_audit_Event(in *Event, out *audit.Event, s conversion.Scope) error {
|
||||
if err := autoConvert_v1alpha1_Event_To_audit_Event(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if out.StageTimestamp.IsZero() {
|
||||
out.StageTimestamp = metav1.NewMicroTime(in.CreationTimestamp.Time)
|
||||
}
|
||||
if out.RequestReceivedTimestamp.IsZero() {
|
||||
out.RequestReceivedTimestamp = metav1.NewMicroTime(in.Timestamp.Time)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_audit_Event_To_v1alpha1_Event(in *audit.Event, out *Event, s conversion.Scope) error {
|
||||
if err := autoConvert_audit_Event_To_v1alpha1_Event(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.CreationTimestamp = metav1.NewTime(in.StageTimestamp.Time)
|
||||
out.Timestamp = metav1.NewTime(in.RequestReceivedTimestamp.Time)
|
||||
return nil
|
||||
|
||||
}
|
26
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/doc.go
generated
vendored
26
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/doc.go
generated
vendored
@ -1,26 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:protobuf-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/apiserver/pkg/apis/audit
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:prerelease-lifecycle-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// +groupName=audit.k8s.io
|
||||
|
||||
package v1alpha1 // import "k8s.io/apiserver/pkg/apis/audit/v1alpha1"
|
3288
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/generated.pb.go
generated
vendored
3288
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/generated.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
274
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/generated.proto
generated
vendored
274
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/generated.proto
generated
vendored
@ -1,274 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package k8s.io.apiserver.pkg.apis.audit.v1alpha1;
|
||||
|
||||
import "k8s.io/api/authentication/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
|
||||
// DEPRECATED - This group version of Event is deprecated by audit.k8s.io/v1/Event. See the release notes for
|
||||
// more information.
|
||||
// Event captures all the information that can be included in an API audit log.
|
||||
message Event {
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// AuditLevel at which event was generated
|
||||
optional string level = 2;
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 3;
|
||||
|
||||
// Unique audit ID, generated for each request.
|
||||
optional string auditID = 4;
|
||||
|
||||
// Stage of the request handling when this event instance was generated.
|
||||
optional string stage = 5;
|
||||
|
||||
// RequestURI is the request URI as sent by the client to a server.
|
||||
optional string requestURI = 6;
|
||||
|
||||
// Verb is the kubernetes verb associated with the request.
|
||||
// For non-resource requests, this is the lower-cased HTTP method.
|
||||
optional string verb = 7;
|
||||
|
||||
// Authenticated user information.
|
||||
optional k8s.io.api.authentication.v1.UserInfo user = 8;
|
||||
|
||||
// Impersonated user information.
|
||||
// +optional
|
||||
optional k8s.io.api.authentication.v1.UserInfo impersonatedUser = 9;
|
||||
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// +optional
|
||||
repeated string sourceIPs = 10;
|
||||
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||
// +optional
|
||||
optional string userAgent = 18;
|
||||
|
||||
// Object reference this request is targeted at.
|
||||
// Does not apply for List-type requests, or non-resource requests.
|
||||
// +optional
|
||||
optional ObjectReference objectRef = 11;
|
||||
|
||||
// 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 non-status type error responses, this will be auto-populated with the error Message.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Status responseStatus = 12;
|
||||
|
||||
// API object from the request, in JSON format. The RequestObject is recorded as-is in the request
|
||||
// (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or
|
||||
// merging. It is an external versioned object type, and may not be a valid object on its own.
|
||||
// Omitted for non-resource requests. Only logged at Request Level and higher.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.runtime.Unknown requestObject = 13;
|
||||
|
||||
// API object returned in the response, in JSON. The ResponseObject is recorded after conversion
|
||||
// to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged
|
||||
// at Response Level.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.runtime.Unknown responseObject = 14;
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime requestReceivedTimestamp = 15;
|
||||
|
||||
// Time the request reached current audit stage.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime stageTimestamp = 16;
|
||||
|
||||
// Annotations is an unstructured key value map stored with an audit event that may be set by
|
||||
// plugins invoked in the request serving chain, including authentication, authorization and
|
||||
// admission plugins. Note that these annotations are for the audit event, and do not correspond
|
||||
// to the metadata.annotations of the submitted object. Keys should uniquely identify the informing
|
||||
// component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values
|
||||
// should be short. Annotations are included in the Metadata level.
|
||||
// +optional
|
||||
map<string, string> annotations = 17;
|
||||
}
|
||||
|
||||
// EventList is a list of audit Events.
|
||||
message EventList {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
repeated Event items = 2;
|
||||
}
|
||||
|
||||
// GroupResources represents resource kinds in an API group.
|
||||
message GroupResources {
|
||||
// Group is the name of the API group that contains the resources.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
optional string group = 1;
|
||||
|
||||
// Resources is a list of resources this rule applies to.
|
||||
//
|
||||
// For example:
|
||||
// 'pods' matches pods.
|
||||
// 'pods/log' matches the log subresource of pods.
|
||||
// '*' matches all resources and their subresources.
|
||||
// 'pods/*' matches all subresources of pods.
|
||||
// '*/scale' matches all scale subresources.
|
||||
//
|
||||
// If wildcard is present, the validation rule will ensure resources do not
|
||||
// overlap with each other.
|
||||
//
|
||||
// An empty list implies all resources and subresources in this API groups apply.
|
||||
// +optional
|
||||
repeated string resources = 2;
|
||||
|
||||
// ResourceNames is a list of resource instance names that the policy matches.
|
||||
// Using this field requires Resources to be specified.
|
||||
// An empty list implies that every instance of the resource is matched.
|
||||
// +optional
|
||||
repeated string resourceNames = 3;
|
||||
}
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
message ObjectReference {
|
||||
// +optional
|
||||
optional string resource = 1;
|
||||
|
||||
// +optional
|
||||
optional string namespace = 2;
|
||||
|
||||
// +optional
|
||||
optional string name = 3;
|
||||
|
||||
// +optional
|
||||
optional string uid = 4;
|
||||
|
||||
// +optional
|
||||
optional string apiVersion = 5;
|
||||
|
||||
// +optional
|
||||
optional string resourceVersion = 6;
|
||||
|
||||
// +optional
|
||||
optional string subresource = 7;
|
||||
}
|
||||
|
||||
// DEPRECATED - This group version of Policy is deprecated by audit.k8s.io/v1/Policy. See the release notes for
|
||||
// more information.
|
||||
// Policy defines the configuration of audit logging, and the rules for how different request
|
||||
// categories are logged.
|
||||
message Policy {
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Rules specify the audit Level a request should be recorded at.
|
||||
// A request may match multiple rules, in which case the FIRST matching rule is used.
|
||||
// The default audit level is None, but can be overridden by a catch-all rule at the end of the list.
|
||||
// PolicyRules are strictly ordered.
|
||||
repeated PolicyRule rules = 2;
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified per rule in which case the union of both are omitted.
|
||||
// +optional
|
||||
repeated string omitStages = 3;
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// This is used as a global default - a value of 'true' will omit the managed fileds,
|
||||
// otherwise the managed fields will be included in the API audit log.
|
||||
// Note that this can also be specified per rule in which case the value specified
|
||||
// in a rule will override the global default.
|
||||
// +optional
|
||||
optional bool omitManagedFields = 4;
|
||||
}
|
||||
|
||||
// PolicyList is a list of audit Policies.
|
||||
message PolicyList {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
repeated Policy items = 2;
|
||||
}
|
||||
|
||||
// PolicyRule maps requests based off metadata to an audit Level.
|
||||
// Requests must match the rules of every field (an intersection of rules).
|
||||
message PolicyRule {
|
||||
// The Level that requests matching this rule are recorded at.
|
||||
optional string level = 1;
|
||||
|
||||
// The users (by authenticated user name) this rule applies to.
|
||||
// An empty list implies every user.
|
||||
// +optional
|
||||
repeated string users = 2;
|
||||
|
||||
// The user groups this rule applies to. A user is considered matching
|
||||
// if it is a member of any of the UserGroups.
|
||||
// An empty list implies every user group.
|
||||
// +optional
|
||||
repeated string userGroups = 3;
|
||||
|
||||
// The verbs that match this rule.
|
||||
// An empty list implies every verb.
|
||||
// +optional
|
||||
repeated string verbs = 4;
|
||||
|
||||
// Resources that this rule matches. An empty list implies all kinds in all API groups.
|
||||
// +optional
|
||||
repeated GroupResources resources = 5;
|
||||
|
||||
// Namespaces that this rule matches.
|
||||
// The empty string "" matches non-namespaced resources.
|
||||
// An empty list implies every namespace.
|
||||
// +optional
|
||||
repeated string namespaces = 6;
|
||||
|
||||
// NonResourceURLs is a set of URL paths that should be audited.
|
||||
// *s are allowed, but only as the full, final step in the path.
|
||||
// Examples:
|
||||
// "/metrics" - Log requests for apiserver metrics
|
||||
// "/healthz*" - Log all health checks
|
||||
// +optional
|
||||
repeated string nonResourceURLs = 7;
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified policy wide in which case the union of both are omitted.
|
||||
// An empty list means no restrictions will apply.
|
||||
// +optional
|
||||
repeated string omitStages = 8;
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// - a value of 'true' will drop the managed fields from the API audit log
|
||||
// - a value of 'false' indicates that the managed fileds should be included
|
||||
// in the API audit log
|
||||
// Note that the value, if specified, in this rule will override the global default
|
||||
// If a value is not specified then the global default specified in
|
||||
// Policy.OmitManagedFields will stand.
|
||||
// +optional
|
||||
optional bool omitManagedFields = 9;
|
||||
}
|
||||
|
58
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/register.go
generated
vendored
58
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/register.go
generated
vendored
@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "audit.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Event{},
|
||||
&EventList{},
|
||||
&Policy{},
|
||||
&PolicyList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
323
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/types.go
generated
vendored
323
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/types.go
generated
vendored
@ -1,323 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
authnv1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// Header keys used by the audit system.
|
||||
const (
|
||||
// Header to hold the audit ID as the request is propagated through the serving hierarchy. The
|
||||
// Audit-ID header should be set by the first server to receive the request (e.g. the federation
|
||||
// server or kube-aggregator).
|
||||
//
|
||||
// Audit ID is also returned to client by http response header.
|
||||
// It's not guaranteed Audit-Id http header is sent for all requests. When kube-apiserver didn't
|
||||
// audit the events according to the audit policy, no Audit-ID is returned. Also, for request to
|
||||
// pods/exec, pods/attach, pods/proxy, kube-apiserver works like a proxy and redirect the request
|
||||
// to kubelet node, users will only get http headers sent from kubelet node, so no Audit-ID is
|
||||
// sent when users run command like "kubectl exec" or "kubectl attach".
|
||||
HeaderAuditID = "Audit-ID"
|
||||
)
|
||||
|
||||
// Level defines the amount of information logged during auditing
|
||||
type Level string
|
||||
|
||||
// Valid audit levels
|
||||
const (
|
||||
// LevelNone disables auditing
|
||||
LevelNone Level = "None"
|
||||
// LevelMetadata provides the basic level of auditing.
|
||||
LevelMetadata Level = "Metadata"
|
||||
// LevelRequest provides Metadata level of auditing, and additionally
|
||||
// logs the request object (does not apply for non-resource requests).
|
||||
LevelRequest Level = "Request"
|
||||
// LevelRequestResponse provides Request level of auditing, and additionally
|
||||
// logs the response object (does not apply for non-resource requests).
|
||||
LevelRequestResponse Level = "RequestResponse"
|
||||
)
|
||||
|
||||
// Stage defines the stages in request handling that audit events may be generated.
|
||||
type Stage string
|
||||
|
||||
// Valid audit stages.
|
||||
const (
|
||||
// The stage for events generated as soon as the audit handler receives the request, and before it
|
||||
// is delegated down the handler chain.
|
||||
StageRequestReceived Stage = "RequestReceived"
|
||||
// The stage for events generated once the response headers are sent, but before the response body
|
||||
// is sent. This stage is only generated for long-running requests (e.g. watch).
|
||||
StageResponseStarted Stage = "ResponseStarted"
|
||||
// The stage for events generated once the response body has been completed, and no more bytes
|
||||
// will be sent.
|
||||
StageResponseComplete Stage = "ResponseComplete"
|
||||
// The stage for events generated when a panic occurred.
|
||||
StagePanic Stage = "Panic"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.7
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,Event
|
||||
|
||||
// DEPRECATED - This group version of Event is deprecated by audit.k8s.io/v1/Event. See the release notes for
|
||||
// more information.
|
||||
// Event captures all the information that can be included in an API audit log.
|
||||
type Event struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// AuditLevel at which event was generated
|
||||
Level Level `json:"level" protobuf:"bytes,2,opt,name=level,casttype=Level"`
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,opt,name=timestamp"`
|
||||
// Unique audit ID, generated for each request.
|
||||
AuditID types.UID `json:"auditID" protobuf:"bytes,4,opt,name=auditID,casttype=k8s.io/apimachinery/pkg/types.UID"`
|
||||
// Stage of the request handling when this event instance was generated.
|
||||
Stage Stage `json:"stage" protobuf:"bytes,5,opt,name=stage,casttype=Stage"`
|
||||
|
||||
// RequestURI is the request URI as sent by the client to a server.
|
||||
RequestURI string `json:"requestURI" protobuf:"bytes,6,opt,name=requestURI"`
|
||||
// Verb is the kubernetes verb associated with the request.
|
||||
// For non-resource requests, this is the lower-cased HTTP method.
|
||||
Verb string `json:"verb" protobuf:"bytes,7,opt,name=verb"`
|
||||
// Authenticated user information.
|
||||
User authnv1.UserInfo `json:"user" protobuf:"bytes,8,opt,name=user"`
|
||||
// Impersonated user information.
|
||||
// +optional
|
||||
ImpersonatedUser *authnv1.UserInfo `json:"impersonatedUser,omitempty" protobuf:"bytes,9,opt,name=impersonatedUser"`
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// +optional
|
||||
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||
// +optional
|
||||
UserAgent string `json:"userAgent,omitempty" protobuf:"bytes,18,opt,name=userAgent"`
|
||||
// Object reference this request is targeted at.
|
||||
// Does not apply for List-type requests, or non-resource requests.
|
||||
// +optional
|
||||
ObjectRef *ObjectReference `json:"objectRef,omitempty" protobuf:"bytes,11,opt,name=objectRef"`
|
||||
// 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 non-status type error responses, this will be auto-populated with the error Message.
|
||||
// +optional
|
||||
ResponseStatus *metav1.Status `json:"responseStatus,omitempty" protobuf:"bytes,12,opt,name=responseStatus"`
|
||||
|
||||
// API object from the request, in JSON format. The RequestObject is recorded as-is in the request
|
||||
// (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or
|
||||
// merging. It is an external versioned object type, and may not be a valid object on its own.
|
||||
// Omitted for non-resource requests. Only logged at Request Level and higher.
|
||||
// +optional
|
||||
RequestObject *runtime.Unknown `json:"requestObject,omitempty" protobuf:"bytes,13,opt,name=requestObject"`
|
||||
// API object returned in the response, in JSON. The ResponseObject is recorded after conversion
|
||||
// to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged
|
||||
// at Response Level.
|
||||
// +optional
|
||||
ResponseObject *runtime.Unknown `json:"responseObject,omitempty" protobuf:"bytes,14,opt,name=responseObject"`
|
||||
// Time the request reached the apiserver.
|
||||
// +optional
|
||||
RequestReceivedTimestamp metav1.MicroTime `json:"requestReceivedTimestamp" protobuf:"bytes,15,opt,name=requestReceivedTimestamp"`
|
||||
// Time the request reached current audit stage.
|
||||
// +optional
|
||||
StageTimestamp metav1.MicroTime `json:"stageTimestamp" protobuf:"bytes,16,opt,name=stageTimestamp"`
|
||||
|
||||
// Annotations is an unstructured key value map stored with an audit event that may be set by
|
||||
// plugins invoked in the request serving chain, including authentication, authorization and
|
||||
// admission plugins. Note that these annotations are for the audit event, and do not correspond
|
||||
// to the metadata.annotations of the submitted object. Keys should uniquely identify the informing
|
||||
// component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values
|
||||
// should be short. Annotations are included in the Metadata level.
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,17,rep,name=annotations"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.7
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,EventList
|
||||
|
||||
// EventList is a list of audit Events.
|
||||
type EventList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
Items []Event `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.7
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,Policy
|
||||
|
||||
// DEPRECATED - This group version of Policy is deprecated by audit.k8s.io/v1/Policy. See the release notes for
|
||||
// more information.
|
||||
// Policy defines the configuration of audit logging, and the rules for how different request
|
||||
// categories are logged.
|
||||
type Policy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Rules specify the audit Level a request should be recorded at.
|
||||
// A request may match multiple rules, in which case the FIRST matching rule is used.
|
||||
// The default audit level is None, but can be overridden by a catch-all rule at the end of the list.
|
||||
// PolicyRules are strictly ordered.
|
||||
Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified per rule in which case the union of both are omitted.
|
||||
// +optional
|
||||
OmitStages []Stage `json:"omitStages,omitempty" protobuf:"bytes,3,rep,name=omitStages"`
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// This is used as a global default - a value of 'true' will omit the managed fileds,
|
||||
// otherwise the managed fields will be included in the API audit log.
|
||||
// Note that this can also be specified per rule in which case the value specified
|
||||
// in a rule will override the global default.
|
||||
// +optional
|
||||
OmitManagedFields bool `json:"omitManagedFields,omitempty" protobuf:"varint,4,opt,name=omitManagedFields"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.7
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,PolicyList
|
||||
|
||||
// PolicyList is a list of audit Policies.
|
||||
type PolicyList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
Items []Policy `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// PolicyRule maps requests based off metadata to an audit Level.
|
||||
// Requests must match the rules of every field (an intersection of rules).
|
||||
type PolicyRule struct {
|
||||
// The Level that requests matching this rule are recorded at.
|
||||
Level Level `json:"level" protobuf:"bytes,1,opt,name=level,casttype=Level"`
|
||||
|
||||
// The users (by authenticated user name) this rule applies to.
|
||||
// An empty list implies every user.
|
||||
// +optional
|
||||
Users []string `json:"users,omitempty" protobuf:"bytes,2,rep,name=users"`
|
||||
// The user groups this rule applies to. A user is considered matching
|
||||
// if it is a member of any of the UserGroups.
|
||||
// An empty list implies every user group.
|
||||
// +optional
|
||||
UserGroups []string `json:"userGroups,omitempty" protobuf:"bytes,3,rep,name=userGroups"`
|
||||
|
||||
// The verbs that match this rule.
|
||||
// An empty list implies every verb.
|
||||
// +optional
|
||||
Verbs []string `json:"verbs,omitempty" protobuf:"bytes,4,rep,name=verbs"`
|
||||
|
||||
// Rules can apply to API resources (such as "pods" or "secrets"),
|
||||
// non-resource URL paths (such as "/api"), or neither, but not both.
|
||||
// If neither is specified, the rule is treated as a default for all URLs.
|
||||
|
||||
// Resources that this rule matches. An empty list implies all kinds in all API groups.
|
||||
// +optional
|
||||
Resources []GroupResources `json:"resources,omitempty" protobuf:"bytes,5,rep,name=resources"`
|
||||
// Namespaces that this rule matches.
|
||||
// The empty string "" matches non-namespaced resources.
|
||||
// An empty list implies every namespace.
|
||||
// +optional
|
||||
Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,6,rep,name=namespaces"`
|
||||
|
||||
// NonResourceURLs is a set of URL paths that should be audited.
|
||||
// *s are allowed, but only as the full, final step in the path.
|
||||
// Examples:
|
||||
// "/metrics" - Log requests for apiserver metrics
|
||||
// "/healthz*" - Log all health checks
|
||||
// +optional
|
||||
NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,7,rep,name=nonResourceURLs"`
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified policy wide in which case the union of both are omitted.
|
||||
// An empty list means no restrictions will apply.
|
||||
// +optional
|
||||
OmitStages []Stage `json:"omitStages,omitempty" protobuf:"bytes,8,rep,name=omitStages"`
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// - a value of 'true' will drop the managed fields from the API audit log
|
||||
// - a value of 'false' indicates that the managed fileds should be included
|
||||
// in the API audit log
|
||||
// Note that the value, if specified, in this rule will override the global default
|
||||
// If a value is not specified then the global default specified in
|
||||
// Policy.OmitManagedFields will stand.
|
||||
// +optional
|
||||
OmitManagedFields *bool `json:"omitManagedFields,omitempty" protobuf:"varint,9,opt,name=omitManagedFields"`
|
||||
}
|
||||
|
||||
// GroupResources represents resource kinds in an API group.
|
||||
type GroupResources struct {
|
||||
// Group is the name of the API group that contains the resources.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
|
||||
// Resources is a list of resources this rule applies to.
|
||||
//
|
||||
// For example:
|
||||
// 'pods' matches pods.
|
||||
// 'pods/log' matches the log subresource of pods.
|
||||
// '*' matches all resources and their subresources.
|
||||
// 'pods/*' matches all subresources of pods.
|
||||
// '*/scale' matches all scale subresources.
|
||||
//
|
||||
// If wildcard is present, the validation rule will ensure resources do not
|
||||
// overlap with each other.
|
||||
//
|
||||
// An empty list implies all resources and subresources in this API groups apply.
|
||||
// +optional
|
||||
Resources []string `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"`
|
||||
// ResourceNames is a list of resource instance names that the policy matches.
|
||||
// Using this field requires Resources to be specified.
|
||||
// An empty list implies that every instance of the resource is matched.
|
||||
// +optional
|
||||
ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,3,rep,name=resourceNames"`
|
||||
}
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
type ObjectReference struct {
|
||||
// +optional
|
||||
Resource string `json:"resource,omitempty" protobuf:"bytes,1,opt,name=resource"`
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
|
||||
// +optional
|
||||
Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
|
||||
// +optional
|
||||
UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
|
||||
// +optional
|
||||
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,5,opt,name=apiVersion"`
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"`
|
||||
// +optional
|
||||
Subresource string `json:"subresource,omitempty" protobuf:"bytes,7,opt,name=subresource"`
|
||||
}
|
344
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.conversion.go
generated
vendored
344
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.conversion.go
generated
vendored
@ -1,344 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
v1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
audit "k8s.io/apiserver/pkg/apis/audit"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*EventList)(nil), (*audit.EventList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_EventList_To_audit_EventList(a.(*EventList), b.(*audit.EventList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.EventList)(nil), (*EventList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_EventList_To_v1alpha1_EventList(a.(*audit.EventList), b.(*EventList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*GroupResources)(nil), (*audit.GroupResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_GroupResources_To_audit_GroupResources(a.(*GroupResources), b.(*audit.GroupResources), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.GroupResources)(nil), (*GroupResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_GroupResources_To_v1alpha1_GroupResources(a.(*audit.GroupResources), b.(*GroupResources), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*Policy)(nil), (*audit.Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_Policy_To_audit_Policy(a.(*Policy), b.(*audit.Policy), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.Policy)(nil), (*Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_Policy_To_v1alpha1_Policy(a.(*audit.Policy), b.(*Policy), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*PolicyList)(nil), (*audit.PolicyList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_PolicyList_To_audit_PolicyList(a.(*PolicyList), b.(*audit.PolicyList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.PolicyList)(nil), (*PolicyList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_PolicyList_To_v1alpha1_PolicyList(a.(*audit.PolicyList), b.(*PolicyList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*PolicyRule)(nil), (*audit.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_PolicyRule_To_audit_PolicyRule(a.(*PolicyRule), b.(*audit.PolicyRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.PolicyRule)(nil), (*PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_PolicyRule_To_v1alpha1_PolicyRule(a.(*audit.PolicyRule), b.(*PolicyRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*audit.Event)(nil), (*Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_Event_To_v1alpha1_Event(a.(*audit.Event), b.(*Event), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*audit.ObjectReference)(nil), (*ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_ObjectReference_To_v1alpha1_ObjectReference(a.(*audit.ObjectReference), b.(*ObjectReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*Event)(nil), (*audit.Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_Event_To_audit_Event(a.(*Event), b.(*audit.Event), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*ObjectReference)(nil), (*audit.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_ObjectReference_To_audit_ObjectReference(a.(*ObjectReference), b.(*audit.ObjectReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_Event_To_audit_Event(in *Event, out *audit.Event, s conversion.Scope) error {
|
||||
// WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type
|
||||
out.Level = audit.Level(in.Level)
|
||||
// WARNING: in.Timestamp requires manual conversion: does not exist in peer-type
|
||||
out.AuditID = types.UID(in.AuditID)
|
||||
out.Stage = audit.Stage(in.Stage)
|
||||
out.RequestURI = in.RequestURI
|
||||
out.Verb = in.Verb
|
||||
out.User = in.User
|
||||
out.ImpersonatedUser = (*v1.UserInfo)(unsafe.Pointer(in.ImpersonatedUser))
|
||||
out.SourceIPs = *(*[]string)(unsafe.Pointer(&in.SourceIPs))
|
||||
out.UserAgent = in.UserAgent
|
||||
if in.ObjectRef != nil {
|
||||
in, out := &in.ObjectRef, &out.ObjectRef
|
||||
*out = new(audit.ObjectReference)
|
||||
if err := Convert_v1alpha1_ObjectReference_To_audit_ObjectReference(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ObjectRef = nil
|
||||
}
|
||||
out.ResponseStatus = (*metav1.Status)(unsafe.Pointer(in.ResponseStatus))
|
||||
out.RequestObject = (*runtime.Unknown)(unsafe.Pointer(in.RequestObject))
|
||||
out.ResponseObject = (*runtime.Unknown)(unsafe.Pointer(in.ResponseObject))
|
||||
out.RequestReceivedTimestamp = in.RequestReceivedTimestamp
|
||||
out.StageTimestamp = in.StageTimestamp
|
||||
out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_audit_Event_To_v1alpha1_Event(in *audit.Event, out *Event, s conversion.Scope) error {
|
||||
out.Level = Level(in.Level)
|
||||
out.AuditID = types.UID(in.AuditID)
|
||||
out.Stage = Stage(in.Stage)
|
||||
out.RequestURI = in.RequestURI
|
||||
out.Verb = in.Verb
|
||||
out.User = in.User
|
||||
out.ImpersonatedUser = (*v1.UserInfo)(unsafe.Pointer(in.ImpersonatedUser))
|
||||
out.SourceIPs = *(*[]string)(unsafe.Pointer(&in.SourceIPs))
|
||||
out.UserAgent = in.UserAgent
|
||||
if in.ObjectRef != nil {
|
||||
in, out := &in.ObjectRef, &out.ObjectRef
|
||||
*out = new(ObjectReference)
|
||||
if err := Convert_audit_ObjectReference_To_v1alpha1_ObjectReference(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ObjectRef = nil
|
||||
}
|
||||
out.ResponseStatus = (*metav1.Status)(unsafe.Pointer(in.ResponseStatus))
|
||||
out.RequestObject = (*runtime.Unknown)(unsafe.Pointer(in.RequestObject))
|
||||
out.ResponseObject = (*runtime.Unknown)(unsafe.Pointer(in.ResponseObject))
|
||||
out.RequestReceivedTimestamp = in.RequestReceivedTimestamp
|
||||
out.StageTimestamp = in.StageTimestamp
|
||||
out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_EventList_To_audit_EventList(in *EventList, out *audit.EventList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]audit.Event, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1alpha1_Event_To_audit_Event(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_EventList_To_audit_EventList is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_EventList_To_audit_EventList(in *EventList, out *audit.EventList, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_EventList_To_audit_EventList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_EventList_To_v1alpha1_EventList(in *audit.EventList, out *EventList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Event, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_audit_Event_To_v1alpha1_Event(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_EventList_To_v1alpha1_EventList is an autogenerated conversion function.
|
||||
func Convert_audit_EventList_To_v1alpha1_EventList(in *audit.EventList, out *EventList, s conversion.Scope) error {
|
||||
return autoConvert_audit_EventList_To_v1alpha1_EventList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_GroupResources_To_audit_GroupResources(in *GroupResources, out *audit.GroupResources, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_GroupResources_To_audit_GroupResources is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_GroupResources_To_audit_GroupResources(in *GroupResources, out *audit.GroupResources, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_GroupResources_To_audit_GroupResources(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_GroupResources_To_v1alpha1_GroupResources(in *audit.GroupResources, out *GroupResources, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_GroupResources_To_v1alpha1_GroupResources is an autogenerated conversion function.
|
||||
func Convert_audit_GroupResources_To_v1alpha1_GroupResources(in *audit.GroupResources, out *GroupResources, s conversion.Scope) error {
|
||||
return autoConvert_audit_GroupResources_To_v1alpha1_GroupResources(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, out *audit.ObjectReference, s conversion.Scope) error {
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
out.UID = types.UID(in.UID)
|
||||
out.APIVersion = in.APIVersion
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.Subresource = in.Subresource
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_audit_ObjectReference_To_v1alpha1_ObjectReference(in *audit.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
out.UID = types.UID(in.UID)
|
||||
// WARNING: in.APIGroup requires manual conversion: does not exist in peer-type
|
||||
out.APIVersion = in.APIVersion
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.Subresource = in.Subresource
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_Policy_To_audit_Policy(in *Policy, out *audit.Policy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
out.Rules = *(*[]audit.PolicyRule)(unsafe.Pointer(&in.Rules))
|
||||
out.OmitStages = *(*[]audit.Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = in.OmitManagedFields
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_Policy_To_audit_Policy is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_Policy_To_audit_Policy(in *Policy, out *audit.Policy, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_Policy_To_audit_Policy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_Policy_To_v1alpha1_Policy(in *audit.Policy, out *Policy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules))
|
||||
out.OmitStages = *(*[]Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = in.OmitManagedFields
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_Policy_To_v1alpha1_Policy is an autogenerated conversion function.
|
||||
func Convert_audit_Policy_To_v1alpha1_Policy(in *audit.Policy, out *Policy, s conversion.Scope) error {
|
||||
return autoConvert_audit_Policy_To_v1alpha1_Policy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PolicyList_To_audit_PolicyList(in *PolicyList, out *audit.PolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]audit.Policy)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_PolicyList_To_audit_PolicyList is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_PolicyList_To_audit_PolicyList(in *PolicyList, out *audit.PolicyList, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_PolicyList_To_audit_PolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_PolicyList_To_v1alpha1_PolicyList(in *audit.PolicyList, out *PolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]Policy)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_PolicyList_To_v1alpha1_PolicyList is an autogenerated conversion function.
|
||||
func Convert_audit_PolicyList_To_v1alpha1_PolicyList(in *audit.PolicyList, out *PolicyList, s conversion.Scope) error {
|
||||
return autoConvert_audit_PolicyList_To_v1alpha1_PolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.PolicyRule, s conversion.Scope) error {
|
||||
out.Level = audit.Level(in.Level)
|
||||
out.Users = *(*[]string)(unsafe.Pointer(&in.Users))
|
||||
out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups))
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.Resources = *(*[]audit.GroupResources)(unsafe.Pointer(&in.Resources))
|
||||
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
out.OmitStages = *(*[]audit.Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_PolicyRule_To_audit_PolicyRule is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.PolicyRule, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_PolicyRule_To_audit_PolicyRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_PolicyRule_To_v1alpha1_PolicyRule(in *audit.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
||||
out.Level = Level(in.Level)
|
||||
out.Users = *(*[]string)(unsafe.Pointer(&in.Users))
|
||||
out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups))
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.Resources = *(*[]GroupResources)(unsafe.Pointer(&in.Resources))
|
||||
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
out.OmitStages = *(*[]Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_PolicyRule_To_v1alpha1_PolicyRule is an autogenerated conversion function.
|
||||
func Convert_audit_PolicyRule_To_v1alpha1_PolicyRule(in *audit.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
||||
return autoConvert_audit_PolicyRule_To_v1alpha1_PolicyRule(in, out, s)
|
||||
}
|
299
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.deepcopy.go
generated
vendored
299
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.deepcopy.go
generated
vendored
@ -1,299 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Event) DeepCopyInto(out *Event) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Timestamp.DeepCopyInto(&out.Timestamp)
|
||||
in.User.DeepCopyInto(&out.User)
|
||||
if in.ImpersonatedUser != nil {
|
||||
in, out := &in.ImpersonatedUser, &out.ImpersonatedUser
|
||||
*out = new(v1.UserInfo)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.SourceIPs != nil {
|
||||
in, out := &in.SourceIPs, &out.SourceIPs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ObjectRef != nil {
|
||||
in, out := &in.ObjectRef, &out.ObjectRef
|
||||
*out = new(ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.ResponseStatus != nil {
|
||||
in, out := &in.ResponseStatus, &out.ResponseStatus
|
||||
*out = new(metav1.Status)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.RequestObject != nil {
|
||||
in, out := &in.RequestObject, &out.RequestObject
|
||||
*out = new(runtime.Unknown)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ResponseObject != nil {
|
||||
in, out := &in.ResponseObject, &out.ResponseObject
|
||||
*out = new(runtime.Unknown)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.RequestReceivedTimestamp.DeepCopyInto(&out.RequestReceivedTimestamp)
|
||||
in.StageTimestamp.DeepCopyInto(&out.StageTimestamp)
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Event.
|
||||
func (in *Event) DeepCopy() *Event {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Event)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Event) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EventList) DeepCopyInto(out *EventList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Event, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventList.
|
||||
func (in *EventList) DeepCopy() *EventList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EventList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EventList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupResources) DeepCopyInto(out *GroupResources) {
|
||||
*out = *in
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupResources.
|
||||
func (in *GroupResources) DeepCopy() *GroupResources {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupResources)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
|
||||
func (in *ObjectReference) DeepCopy() *ObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Policy) DeepCopyInto(out *Policy) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.OmitStages != nil {
|
||||
in, out := &in.OmitStages, &out.OmitStages
|
||||
*out = make([]Stage, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
|
||||
func (in *Policy) DeepCopy() *Policy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Policy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Policy) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyList) DeepCopyInto(out *PolicyList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Policy, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyList.
|
||||
func (in *PolicyList) DeepCopy() *PolicyList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PolicyList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyRule) DeepCopyInto(out *PolicyRule) {
|
||||
*out = *in
|
||||
if in.Users != nil {
|
||||
in, out := &in.Users, &out.Users
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.UserGroups != nil {
|
||||
in, out := &in.UserGroups, &out.UserGroups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]GroupResources, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Namespaces != nil {
|
||||
in, out := &in.Namespaces, &out.Namespaces
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NonResourceURLs != nil {
|
||||
in, out := &in.NonResourceURLs, &out.NonResourceURLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.OmitStages != nil {
|
||||
in, out := &in.OmitStages, &out.OmitStages
|
||||
*out = make([]Stage, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.OmitManagedFields != nil {
|
||||
in, out := &in.OmitManagedFields, &out.OmitManagedFields
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRule.
|
||||
func (in *PolicyRule) DeepCopy() *PolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
33
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.defaults.go
generated
vendored
33
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.defaults.go
generated
vendored
@ -1,33 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by defaulter-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
122
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.prerelease-lifecycle.go
generated
vendored
122
vendor/k8s.io/apiserver/pkg/apis/audit/v1alpha1/zz_generated.prerelease-lifecycle.go
generated
vendored
@ -1,122 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by prerelease-lifecycle-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *Event) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 7
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *Event) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *Event) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "Event"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *Event) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *EventList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 7
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *EventList) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *EventList) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "EventList"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *EventList) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *Policy) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 7
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *Policy) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *Policy) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "Policy"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *Policy) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *PolicyList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 7
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *PolicyList) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *PolicyList) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "PolicyList"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *PolicyList) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
45
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/conversion.go
generated
vendored
45
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/conversion.go
generated
vendored
@ -1,45 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apiserver/pkg/apis/audit"
|
||||
)
|
||||
|
||||
func Convert_v1beta1_Event_To_audit_Event(in *Event, out *audit.Event, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_Event_To_audit_Event(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if out.StageTimestamp.IsZero() {
|
||||
out.StageTimestamp = metav1.NewMicroTime(in.CreationTimestamp.Time)
|
||||
}
|
||||
if out.RequestReceivedTimestamp.IsZero() {
|
||||
out.RequestReceivedTimestamp = metav1.NewMicroTime(in.Timestamp.Time)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_audit_Event_To_v1beta1_Event(in *audit.Event, out *Event, s conversion.Scope) error {
|
||||
if err := autoConvert_audit_Event_To_v1beta1_Event(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.CreationTimestamp = metav1.NewTime(in.StageTimestamp.Time)
|
||||
out.Timestamp = metav1.NewTime(in.RequestReceivedTimestamp.Time)
|
||||
return nil
|
||||
}
|
26
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/doc.go
generated
vendored
26
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/doc.go
generated
vendored
@ -1,26 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:protobuf-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/apiserver/pkg/apis/audit
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:prerelease-lifecycle-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// +groupName=audit.k8s.io
|
||||
|
||||
package v1beta1 // import "k8s.io/apiserver/pkg/apis/audit/v1beta1"
|
3329
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/generated.pb.go
generated
vendored
3329
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/generated.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
283
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/generated.proto
generated
vendored
283
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/generated.proto
generated
vendored
@ -1,283 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package k8s.io.apiserver.pkg.apis.audit.v1beta1;
|
||||
|
||||
import "k8s.io/api/authentication/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1beta1";
|
||||
|
||||
// DEPRECATED - This group version of Event is deprecated by audit.k8s.io/v1/Event. See the release notes for
|
||||
// more information.
|
||||
// Event captures all the information that can be included in an API audit log.
|
||||
message Event {
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
// DEPRECATED: Use StageTimestamp which supports micro second instead of ObjectMeta.CreateTimestamp
|
||||
// and the rest of the object is not used
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// AuditLevel at which event was generated
|
||||
optional string level = 2;
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
// DEPRECATED: Use RequestReceivedTimestamp which supports micro second instead.
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timestamp = 3;
|
||||
|
||||
// Unique audit ID, generated for each request.
|
||||
optional string auditID = 4;
|
||||
|
||||
// Stage of the request handling when this event instance was generated.
|
||||
optional string stage = 5;
|
||||
|
||||
// RequestURI is the request URI as sent by the client to a server.
|
||||
optional string requestURI = 6;
|
||||
|
||||
// Verb is the kubernetes verb associated with the request.
|
||||
// For non-resource requests, this is the lower-cased HTTP method.
|
||||
optional string verb = 7;
|
||||
|
||||
// Authenticated user information.
|
||||
optional k8s.io.api.authentication.v1.UserInfo user = 8;
|
||||
|
||||
// Impersonated user information.
|
||||
// +optional
|
||||
optional k8s.io.api.authentication.v1.UserInfo impersonatedUser = 9;
|
||||
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// +optional
|
||||
repeated string sourceIPs = 10;
|
||||
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||
// +optional
|
||||
optional string userAgent = 18;
|
||||
|
||||
// Object reference this request is targeted at.
|
||||
// Does not apply for List-type requests, or non-resource requests.
|
||||
// +optional
|
||||
optional ObjectReference objectRef = 11;
|
||||
|
||||
// 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 non-status type error responses, this will be auto-populated with the error Message.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Status responseStatus = 12;
|
||||
|
||||
// API object from the request, in JSON format. The RequestObject is recorded as-is in the request
|
||||
// (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or
|
||||
// merging. It is an external versioned object type, and may not be a valid object on its own.
|
||||
// Omitted for non-resource requests. Only logged at Request Level and higher.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.runtime.Unknown requestObject = 13;
|
||||
|
||||
// API object returned in the response, in JSON. The ResponseObject is recorded after conversion
|
||||
// to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged
|
||||
// at Response Level.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.runtime.Unknown responseObject = 14;
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime requestReceivedTimestamp = 15;
|
||||
|
||||
// Time the request reached current audit stage.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.MicroTime stageTimestamp = 16;
|
||||
|
||||
// Annotations is an unstructured key value map stored with an audit event that may be set by
|
||||
// plugins invoked in the request serving chain, including authentication, authorization and
|
||||
// admission plugins. Note that these annotations are for the audit event, and do not correspond
|
||||
// to the metadata.annotations of the submitted object. Keys should uniquely identify the informing
|
||||
// component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values
|
||||
// should be short. Annotations are included in the Metadata level.
|
||||
// +optional
|
||||
map<string, string> annotations = 17;
|
||||
}
|
||||
|
||||
// EventList is a list of audit Events.
|
||||
message EventList {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
repeated Event items = 2;
|
||||
}
|
||||
|
||||
// GroupResources represents resource kinds in an API group.
|
||||
message GroupResources {
|
||||
// Group is the name of the API group that contains the resources.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
optional string group = 1;
|
||||
|
||||
// Resources is a list of resources this rule applies to.
|
||||
//
|
||||
// For example:
|
||||
// 'pods' matches pods.
|
||||
// 'pods/log' matches the log subresource of pods.
|
||||
// '*' matches all resources and their subresources.
|
||||
// 'pods/*' matches all subresources of pods.
|
||||
// '*/scale' matches all scale subresources.
|
||||
//
|
||||
// If wildcard is present, the validation rule will ensure resources do not
|
||||
// overlap with each other.
|
||||
//
|
||||
// An empty list implies all resources and subresources in this API groups apply.
|
||||
// +optional
|
||||
repeated string resources = 2;
|
||||
|
||||
// ResourceNames is a list of resource instance names that the policy matches.
|
||||
// Using this field requires Resources to be specified.
|
||||
// An empty list implies that every instance of the resource is matched.
|
||||
// +optional
|
||||
repeated string resourceNames = 3;
|
||||
}
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
message ObjectReference {
|
||||
// +optional
|
||||
optional string resource = 1;
|
||||
|
||||
// +optional
|
||||
optional string namespace = 2;
|
||||
|
||||
// +optional
|
||||
optional string name = 3;
|
||||
|
||||
// +optional
|
||||
optional string uid = 4;
|
||||
|
||||
// APIGroup is the name of the API group that contains the referred object.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
optional string apiGroup = 5;
|
||||
|
||||
// APIVersion is the version of the API group that contains the referred object.
|
||||
// +optional
|
||||
optional string apiVersion = 6;
|
||||
|
||||
// +optional
|
||||
optional string resourceVersion = 7;
|
||||
|
||||
// +optional
|
||||
optional string subresource = 8;
|
||||
}
|
||||
|
||||
// DEPRECATED - This group version of Policy is deprecated by audit.k8s.io/v1/Policy. See the release notes for
|
||||
// more information.
|
||||
// Policy defines the configuration of audit logging, and the rules for how different request
|
||||
// categories are logged.
|
||||
message Policy {
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Rules specify the audit Level a request should be recorded at.
|
||||
// A request may match multiple rules, in which case the FIRST matching rule is used.
|
||||
// The default audit level is None, but can be overridden by a catch-all rule at the end of the list.
|
||||
// PolicyRules are strictly ordered.
|
||||
repeated PolicyRule rules = 2;
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified per rule in which case the union of both are omitted.
|
||||
// +optional
|
||||
repeated string omitStages = 3;
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// This is used as a global default - a value of 'true' will omit the managed fileds,
|
||||
// otherwise the managed fields will be included in the API audit log.
|
||||
// Note that this can also be specified per rule in which case the value specified
|
||||
// in a rule will override the global default.
|
||||
// +optional
|
||||
optional bool omitManagedFields = 4;
|
||||
}
|
||||
|
||||
// PolicyList is a list of audit Policies.
|
||||
message PolicyList {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
repeated Policy items = 2;
|
||||
}
|
||||
|
||||
// PolicyRule maps requests based off metadata to an audit Level.
|
||||
// Requests must match the rules of every field (an intersection of rules).
|
||||
message PolicyRule {
|
||||
// The Level that requests matching this rule are recorded at.
|
||||
optional string level = 1;
|
||||
|
||||
// The users (by authenticated user name) this rule applies to.
|
||||
// An empty list implies every user.
|
||||
// +optional
|
||||
repeated string users = 2;
|
||||
|
||||
// The user groups this rule applies to. A user is considered matching
|
||||
// if it is a member of any of the UserGroups.
|
||||
// An empty list implies every user group.
|
||||
// +optional
|
||||
repeated string userGroups = 3;
|
||||
|
||||
// The verbs that match this rule.
|
||||
// An empty list implies every verb.
|
||||
// +optional
|
||||
repeated string verbs = 4;
|
||||
|
||||
// Resources that this rule matches. An empty list implies all kinds in all API groups.
|
||||
// +optional
|
||||
repeated GroupResources resources = 5;
|
||||
|
||||
// Namespaces that this rule matches.
|
||||
// The empty string "" matches non-namespaced resources.
|
||||
// An empty list implies every namespace.
|
||||
// +optional
|
||||
repeated string namespaces = 6;
|
||||
|
||||
// NonResourceURLs is a set of URL paths that should be audited.
|
||||
// *s are allowed, but only as the full, final step in the path.
|
||||
// Examples:
|
||||
// "/metrics" - Log requests for apiserver metrics
|
||||
// "/healthz*" - Log all health checks
|
||||
// +optional
|
||||
repeated string nonResourceURLs = 7;
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified policy wide in which case the union of both are omitted.
|
||||
// An empty list means no restrictions will apply.
|
||||
// +optional
|
||||
repeated string omitStages = 8;
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// - a value of 'true' will drop the managed fields from the API audit log
|
||||
// - a value of 'false' indicates that the managed fileds should be included
|
||||
// in the API audit log
|
||||
// Note that the value, if specified, in this rule will override the global default
|
||||
// If a value is not specified then the global default specified in
|
||||
// Policy.OmitManagedFields will stand.
|
||||
// +optional
|
||||
optional bool omitManagedFields = 9;
|
||||
}
|
||||
|
58
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/register.go
generated
vendored
58
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/register.go
generated
vendored
@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "audit.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Event{},
|
||||
&EventList{},
|
||||
&Policy{},
|
||||
&PolicyList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
324
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/types.go
generated
vendored
324
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/types.go
generated
vendored
@ -1,324 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
authnv1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// Header keys used by the audit system.
|
||||
const (
|
||||
// Header to hold the audit ID as the request is propagated through the serving hierarchy. The
|
||||
// Audit-ID header should be set by the first server to receive the request (e.g. the federation
|
||||
// server or kube-aggregator).
|
||||
HeaderAuditID = "Audit-ID"
|
||||
)
|
||||
|
||||
// Level defines the amount of information logged during auditing
|
||||
type Level string
|
||||
|
||||
// Valid audit levels
|
||||
const (
|
||||
// LevelNone disables auditing
|
||||
LevelNone Level = "None"
|
||||
// LevelMetadata provides the basic level of auditing.
|
||||
LevelMetadata Level = "Metadata"
|
||||
// LevelRequest provides Metadata level of auditing, and additionally
|
||||
// logs the request object (does not apply for non-resource requests).
|
||||
LevelRequest Level = "Request"
|
||||
// LevelRequestResponse provides Request level of auditing, and additionally
|
||||
// logs the response object (does not apply for non-resource requests).
|
||||
LevelRequestResponse Level = "RequestResponse"
|
||||
)
|
||||
|
||||
// Stage defines the stages in request handling that audit events may be generated.
|
||||
type Stage string
|
||||
|
||||
// Valid audit stages.
|
||||
const (
|
||||
// The stage for events generated as soon as the audit handler receives the request, and before it
|
||||
// is delegated down the handler chain.
|
||||
StageRequestReceived Stage = "RequestReceived"
|
||||
// The stage for events generated once the response headers are sent, but before the response body
|
||||
// is sent. This stage is only generated for long-running requests (e.g. watch).
|
||||
StageResponseStarted Stage = "ResponseStarted"
|
||||
// The stage for events generated once the response body has been completed, and no more bytes
|
||||
// will be sent.
|
||||
StageResponseComplete Stage = "ResponseComplete"
|
||||
// The stage for events generated when a panic occurred.
|
||||
StagePanic Stage = "Panic"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,Event
|
||||
|
||||
// DEPRECATED - This group version of Event is deprecated by audit.k8s.io/v1/Event. See the release notes for
|
||||
// more information.
|
||||
// Event captures all the information that can be included in an API audit log.
|
||||
type Event struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
// DEPRECATED: Use StageTimestamp which supports micro second instead of ObjectMeta.CreateTimestamp
|
||||
// and the rest of the object is not used
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// AuditLevel at which event was generated
|
||||
Level Level `json:"level" protobuf:"bytes,2,opt,name=level,casttype=Level"`
|
||||
|
||||
// Time the request reached the apiserver.
|
||||
// DEPRECATED: Use RequestReceivedTimestamp which supports micro second instead.
|
||||
Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,opt,name=timestamp"`
|
||||
// Unique audit ID, generated for each request.
|
||||
AuditID types.UID `json:"auditID" protobuf:"bytes,4,opt,name=auditID,casttype=k8s.io/apimachinery/pkg/types.UID"`
|
||||
// Stage of the request handling when this event instance was generated.
|
||||
Stage Stage `json:"stage" protobuf:"bytes,5,opt,name=stage,casttype=Stage"`
|
||||
|
||||
// RequestURI is the request URI as sent by the client to a server.
|
||||
RequestURI string `json:"requestURI" protobuf:"bytes,6,opt,name=requestURI"`
|
||||
// Verb is the kubernetes verb associated with the request.
|
||||
// For non-resource requests, this is the lower-cased HTTP method.
|
||||
Verb string `json:"verb" protobuf:"bytes,7,opt,name=verb"`
|
||||
// Authenticated user information.
|
||||
User authnv1.UserInfo `json:"user" protobuf:"bytes,8,opt,name=user"`
|
||||
// Impersonated user information.
|
||||
// +optional
|
||||
ImpersonatedUser *authnv1.UserInfo `json:"impersonatedUser,omitempty" protobuf:"bytes,9,opt,name=impersonatedUser"`
|
||||
// Source IPs, from where the request originated and intermediate proxies.
|
||||
// +optional
|
||||
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
||||
// UserAgent records the user agent string reported by the client.
|
||||
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||
// +optional
|
||||
UserAgent string `json:"userAgent,omitempty" protobuf:"bytes,18,opt,name=userAgent"`
|
||||
// Object reference this request is targeted at.
|
||||
// Does not apply for List-type requests, or non-resource requests.
|
||||
// +optional
|
||||
ObjectRef *ObjectReference `json:"objectRef,omitempty" protobuf:"bytes,11,opt,name=objectRef"`
|
||||
// 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 non-status type error responses, this will be auto-populated with the error Message.
|
||||
// +optional
|
||||
ResponseStatus *metav1.Status `json:"responseStatus,omitempty" protobuf:"bytes,12,opt,name=responseStatus"`
|
||||
|
||||
// API object from the request, in JSON format. The RequestObject is recorded as-is in the request
|
||||
// (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or
|
||||
// merging. It is an external versioned object type, and may not be a valid object on its own.
|
||||
// Omitted for non-resource requests. Only logged at Request Level and higher.
|
||||
// +optional
|
||||
RequestObject *runtime.Unknown `json:"requestObject,omitempty" protobuf:"bytes,13,opt,name=requestObject"`
|
||||
// API object returned in the response, in JSON. The ResponseObject is recorded after conversion
|
||||
// to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged
|
||||
// at Response Level.
|
||||
// +optional
|
||||
ResponseObject *runtime.Unknown `json:"responseObject,omitempty" protobuf:"bytes,14,opt,name=responseObject"`
|
||||
// Time the request reached the apiserver.
|
||||
// +optional
|
||||
RequestReceivedTimestamp metav1.MicroTime `json:"requestReceivedTimestamp" protobuf:"bytes,15,opt,name=requestReceivedTimestamp"`
|
||||
// Time the request reached current audit stage.
|
||||
// +optional
|
||||
StageTimestamp metav1.MicroTime `json:"stageTimestamp" protobuf:"bytes,16,opt,name=stageTimestamp"`
|
||||
|
||||
// Annotations is an unstructured key value map stored with an audit event that may be set by
|
||||
// plugins invoked in the request serving chain, including authentication, authorization and
|
||||
// admission plugins. Note that these annotations are for the audit event, and do not correspond
|
||||
// to the metadata.annotations of the submitted object. Keys should uniquely identify the informing
|
||||
// component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values
|
||||
// should be short. Annotations are included in the Metadata level.
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,17,rep,name=annotations"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,EventList
|
||||
|
||||
// EventList is a list of audit Events.
|
||||
type EventList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
Items []Event `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,Policy
|
||||
|
||||
// DEPRECATED - This group version of Policy is deprecated by audit.k8s.io/v1/Policy. See the release notes for
|
||||
// more information.
|
||||
// Policy defines the configuration of audit logging, and the rules for how different request
|
||||
// categories are logged.
|
||||
type Policy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// ObjectMeta is included for interoperability with API infrastructure.
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Rules specify the audit Level a request should be recorded at.
|
||||
// A request may match multiple rules, in which case the FIRST matching rule is used.
|
||||
// The default audit level is None, but can be overridden by a catch-all rule at the end of the list.
|
||||
// PolicyRules are strictly ordered.
|
||||
Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified per rule in which case the union of both are omitted.
|
||||
// +optional
|
||||
OmitStages []Stage `json:"omitStages,omitempty" protobuf:"bytes,3,rep,name=omitStages"`
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// This is used as a global default - a value of 'true' will omit the managed fileds,
|
||||
// otherwise the managed fields will be included in the API audit log.
|
||||
// Note that this can also be specified per rule in which case the value specified
|
||||
// in a rule will override the global default.
|
||||
// +optional
|
||||
OmitManagedFields bool `json:"omitManagedFields,omitempty" protobuf:"varint,4,opt,name=omitManagedFields"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.8
|
||||
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
|
||||
// +k8s:prerelease-lifecycle-gen:replacement=audit.k8s.io,v1,PolicyList
|
||||
|
||||
// PolicyList is a list of audit Policies.
|
||||
type PolicyList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
Items []Policy `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// PolicyRule maps requests based off metadata to an audit Level.
|
||||
// Requests must match the rules of every field (an intersection of rules).
|
||||
type PolicyRule struct {
|
||||
// The Level that requests matching this rule are recorded at.
|
||||
Level Level `json:"level" protobuf:"bytes,1,opt,name=level,casttype=Level"`
|
||||
|
||||
// The users (by authenticated user name) this rule applies to.
|
||||
// An empty list implies every user.
|
||||
// +optional
|
||||
Users []string `json:"users,omitempty" protobuf:"bytes,2,rep,name=users"`
|
||||
// The user groups this rule applies to. A user is considered matching
|
||||
// if it is a member of any of the UserGroups.
|
||||
// An empty list implies every user group.
|
||||
// +optional
|
||||
UserGroups []string `json:"userGroups,omitempty" protobuf:"bytes,3,rep,name=userGroups"`
|
||||
|
||||
// The verbs that match this rule.
|
||||
// An empty list implies every verb.
|
||||
// +optional
|
||||
Verbs []string `json:"verbs,omitempty" protobuf:"bytes,4,rep,name=verbs"`
|
||||
|
||||
// Rules can apply to API resources (such as "pods" or "secrets"),
|
||||
// non-resource URL paths (such as "/api"), or neither, but not both.
|
||||
// If neither is specified, the rule is treated as a default for all URLs.
|
||||
|
||||
// Resources that this rule matches. An empty list implies all kinds in all API groups.
|
||||
// +optional
|
||||
Resources []GroupResources `json:"resources,omitempty" protobuf:"bytes,5,rep,name=resources"`
|
||||
// Namespaces that this rule matches.
|
||||
// The empty string "" matches non-namespaced resources.
|
||||
// An empty list implies every namespace.
|
||||
// +optional
|
||||
Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,6,rep,name=namespaces"`
|
||||
|
||||
// NonResourceURLs is a set of URL paths that should be audited.
|
||||
// *s are allowed, but only as the full, final step in the path.
|
||||
// Examples:
|
||||
// "/metrics" - Log requests for apiserver metrics
|
||||
// "/healthz*" - Log all health checks
|
||||
// +optional
|
||||
NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,7,rep,name=nonResourceURLs"`
|
||||
|
||||
// OmitStages is a list of stages for which no events are created. Note that this can also
|
||||
// be specified policy wide in which case the union of both are omitted.
|
||||
// An empty list means no restrictions will apply.
|
||||
// +optional
|
||||
OmitStages []Stage `json:"omitStages,omitempty" protobuf:"bytes,8,rep,name=omitStages"`
|
||||
|
||||
// OmitManagedFields indicates whether to omit the managed fields of the request
|
||||
// and response bodies from being written to the API audit log.
|
||||
// - a value of 'true' will drop the managed fields from the API audit log
|
||||
// - a value of 'false' indicates that the managed fileds should be included
|
||||
// in the API audit log
|
||||
// Note that the value, if specified, in this rule will override the global default
|
||||
// If a value is not specified then the global default specified in
|
||||
// Policy.OmitManagedFields will stand.
|
||||
// +optional
|
||||
OmitManagedFields *bool `json:"omitManagedFields,omitempty" protobuf:"varint,9,opt,name=omitManagedFields"`
|
||||
}
|
||||
|
||||
// GroupResources represents resource kinds in an API group.
|
||||
type GroupResources struct {
|
||||
// Group is the name of the API group that contains the resources.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
|
||||
// Resources is a list of resources this rule applies to.
|
||||
//
|
||||
// For example:
|
||||
// 'pods' matches pods.
|
||||
// 'pods/log' matches the log subresource of pods.
|
||||
// '*' matches all resources and their subresources.
|
||||
// 'pods/*' matches all subresources of pods.
|
||||
// '*/scale' matches all scale subresources.
|
||||
//
|
||||
// If wildcard is present, the validation rule will ensure resources do not
|
||||
// overlap with each other.
|
||||
//
|
||||
// An empty list implies all resources and subresources in this API groups apply.
|
||||
// +optional
|
||||
Resources []string `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"`
|
||||
// ResourceNames is a list of resource instance names that the policy matches.
|
||||
// Using this field requires Resources to be specified.
|
||||
// An empty list implies that every instance of the resource is matched.
|
||||
// +optional
|
||||
ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,3,rep,name=resourceNames"`
|
||||
}
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
type ObjectReference struct {
|
||||
// +optional
|
||||
Resource string `json:"resource,omitempty" protobuf:"bytes,1,opt,name=resource"`
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
|
||||
// +optional
|
||||
Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
|
||||
// +optional
|
||||
UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
|
||||
// APIGroup is the name of the API group that contains the referred object.
|
||||
// The empty string represents the core API group.
|
||||
// +optional
|
||||
APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,5,opt,name=apiGroup"`
|
||||
// APIVersion is the version of the API group that contains the referred object.
|
||||
// +optional
|
||||
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,6,opt,name=apiVersion"`
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,7,opt,name=resourceVersion"`
|
||||
// +optional
|
||||
Subresource string `json:"subresource,omitempty" protobuf:"bytes,8,opt,name=subresource"`
|
||||
}
|
339
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.conversion.go
generated
vendored
339
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.conversion.go
generated
vendored
@ -1,339 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
v1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
audit "k8s.io/apiserver/pkg/apis/audit"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*EventList)(nil), (*audit.EventList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_EventList_To_audit_EventList(a.(*EventList), b.(*audit.EventList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.EventList)(nil), (*EventList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_EventList_To_v1beta1_EventList(a.(*audit.EventList), b.(*EventList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*GroupResources)(nil), (*audit.GroupResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_GroupResources_To_audit_GroupResources(a.(*GroupResources), b.(*audit.GroupResources), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.GroupResources)(nil), (*GroupResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_GroupResources_To_v1beta1_GroupResources(a.(*audit.GroupResources), b.(*GroupResources), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*ObjectReference)(nil), (*audit.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_ObjectReference_To_audit_ObjectReference(a.(*ObjectReference), b.(*audit.ObjectReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.ObjectReference)(nil), (*ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_ObjectReference_To_v1beta1_ObjectReference(a.(*audit.ObjectReference), b.(*ObjectReference), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*Policy)(nil), (*audit.Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Policy_To_audit_Policy(a.(*Policy), b.(*audit.Policy), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.Policy)(nil), (*Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_Policy_To_v1beta1_Policy(a.(*audit.Policy), b.(*Policy), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*PolicyList)(nil), (*audit.PolicyList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_PolicyList_To_audit_PolicyList(a.(*PolicyList), b.(*audit.PolicyList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.PolicyList)(nil), (*PolicyList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_PolicyList_To_v1beta1_PolicyList(a.(*audit.PolicyList), b.(*PolicyList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*PolicyRule)(nil), (*audit.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_PolicyRule_To_audit_PolicyRule(a.(*PolicyRule), b.(*audit.PolicyRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*audit.PolicyRule)(nil), (*PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_PolicyRule_To_v1beta1_PolicyRule(a.(*audit.PolicyRule), b.(*PolicyRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*audit.Event)(nil), (*Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_audit_Event_To_v1beta1_Event(a.(*audit.Event), b.(*Event), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*Event)(nil), (*audit.Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Event_To_audit_Event(a.(*Event), b.(*audit.Event), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Event_To_audit_Event(in *Event, out *audit.Event, s conversion.Scope) error {
|
||||
// WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type
|
||||
out.Level = audit.Level(in.Level)
|
||||
// WARNING: in.Timestamp requires manual conversion: does not exist in peer-type
|
||||
out.AuditID = types.UID(in.AuditID)
|
||||
out.Stage = audit.Stage(in.Stage)
|
||||
out.RequestURI = in.RequestURI
|
||||
out.Verb = in.Verb
|
||||
out.User = in.User
|
||||
out.ImpersonatedUser = (*v1.UserInfo)(unsafe.Pointer(in.ImpersonatedUser))
|
||||
out.SourceIPs = *(*[]string)(unsafe.Pointer(&in.SourceIPs))
|
||||
out.UserAgent = in.UserAgent
|
||||
out.ObjectRef = (*audit.ObjectReference)(unsafe.Pointer(in.ObjectRef))
|
||||
out.ResponseStatus = (*metav1.Status)(unsafe.Pointer(in.ResponseStatus))
|
||||
out.RequestObject = (*runtime.Unknown)(unsafe.Pointer(in.RequestObject))
|
||||
out.ResponseObject = (*runtime.Unknown)(unsafe.Pointer(in.ResponseObject))
|
||||
out.RequestReceivedTimestamp = in.RequestReceivedTimestamp
|
||||
out.StageTimestamp = in.StageTimestamp
|
||||
out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_audit_Event_To_v1beta1_Event(in *audit.Event, out *Event, s conversion.Scope) error {
|
||||
out.Level = Level(in.Level)
|
||||
out.AuditID = types.UID(in.AuditID)
|
||||
out.Stage = Stage(in.Stage)
|
||||
out.RequestURI = in.RequestURI
|
||||
out.Verb = in.Verb
|
||||
out.User = in.User
|
||||
out.ImpersonatedUser = (*v1.UserInfo)(unsafe.Pointer(in.ImpersonatedUser))
|
||||
out.SourceIPs = *(*[]string)(unsafe.Pointer(&in.SourceIPs))
|
||||
out.UserAgent = in.UserAgent
|
||||
out.ObjectRef = (*ObjectReference)(unsafe.Pointer(in.ObjectRef))
|
||||
out.ResponseStatus = (*metav1.Status)(unsafe.Pointer(in.ResponseStatus))
|
||||
out.RequestObject = (*runtime.Unknown)(unsafe.Pointer(in.RequestObject))
|
||||
out.ResponseObject = (*runtime.Unknown)(unsafe.Pointer(in.ResponseObject))
|
||||
out.RequestReceivedTimestamp = in.RequestReceivedTimestamp
|
||||
out.StageTimestamp = in.StageTimestamp
|
||||
out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_EventList_To_audit_EventList(in *EventList, out *audit.EventList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]audit.Event, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta1_Event_To_audit_Event(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_EventList_To_audit_EventList is an autogenerated conversion function.
|
||||
func Convert_v1beta1_EventList_To_audit_EventList(in *EventList, out *audit.EventList, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_EventList_To_audit_EventList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_EventList_To_v1beta1_EventList(in *audit.EventList, out *EventList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Event, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_audit_Event_To_v1beta1_Event(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_EventList_To_v1beta1_EventList is an autogenerated conversion function.
|
||||
func Convert_audit_EventList_To_v1beta1_EventList(in *audit.EventList, out *EventList, s conversion.Scope) error {
|
||||
return autoConvert_audit_EventList_To_v1beta1_EventList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_GroupResources_To_audit_GroupResources(in *GroupResources, out *audit.GroupResources, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_GroupResources_To_audit_GroupResources is an autogenerated conversion function.
|
||||
func Convert_v1beta1_GroupResources_To_audit_GroupResources(in *GroupResources, out *audit.GroupResources, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_GroupResources_To_audit_GroupResources(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_GroupResources_To_v1beta1_GroupResources(in *audit.GroupResources, out *GroupResources, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_GroupResources_To_v1beta1_GroupResources is an autogenerated conversion function.
|
||||
func Convert_audit_GroupResources_To_v1beta1_GroupResources(in *audit.GroupResources, out *GroupResources, s conversion.Scope) error {
|
||||
return autoConvert_audit_GroupResources_To_v1beta1_GroupResources(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, out *audit.ObjectReference, s conversion.Scope) error {
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
out.UID = types.UID(in.UID)
|
||||
out.APIGroup = in.APIGroup
|
||||
out.APIVersion = in.APIVersion
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.Subresource = in.Subresource
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_ObjectReference_To_audit_ObjectReference is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ObjectReference_To_audit_ObjectReference(in *ObjectReference, out *audit.ObjectReference, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ObjectReference_To_audit_ObjectReference(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_ObjectReference_To_v1beta1_ObjectReference(in *audit.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||
out.Resource = in.Resource
|
||||
out.Namespace = in.Namespace
|
||||
out.Name = in.Name
|
||||
out.UID = types.UID(in.UID)
|
||||
out.APIGroup = in.APIGroup
|
||||
out.APIVersion = in.APIVersion
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.Subresource = in.Subresource
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_ObjectReference_To_v1beta1_ObjectReference is an autogenerated conversion function.
|
||||
func Convert_audit_ObjectReference_To_v1beta1_ObjectReference(in *audit.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||
return autoConvert_audit_ObjectReference_To_v1beta1_ObjectReference(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Policy_To_audit_Policy(in *Policy, out *audit.Policy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
out.Rules = *(*[]audit.PolicyRule)(unsafe.Pointer(&in.Rules))
|
||||
out.OmitStages = *(*[]audit.Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = in.OmitManagedFields
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Policy_To_audit_Policy is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Policy_To_audit_Policy(in *Policy, out *audit.Policy, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Policy_To_audit_Policy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_Policy_To_v1beta1_Policy(in *audit.Policy, out *Policy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules))
|
||||
out.OmitStages = *(*[]Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = in.OmitManagedFields
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_Policy_To_v1beta1_Policy is an autogenerated conversion function.
|
||||
func Convert_audit_Policy_To_v1beta1_Policy(in *audit.Policy, out *Policy, s conversion.Scope) error {
|
||||
return autoConvert_audit_Policy_To_v1beta1_Policy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_PolicyList_To_audit_PolicyList(in *PolicyList, out *audit.PolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]audit.Policy)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_PolicyList_To_audit_PolicyList is an autogenerated conversion function.
|
||||
func Convert_v1beta1_PolicyList_To_audit_PolicyList(in *PolicyList, out *audit.PolicyList, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_PolicyList_To_audit_PolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_PolicyList_To_v1beta1_PolicyList(in *audit.PolicyList, out *PolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]Policy)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_PolicyList_To_v1beta1_PolicyList is an autogenerated conversion function.
|
||||
func Convert_audit_PolicyList_To_v1beta1_PolicyList(in *audit.PolicyList, out *PolicyList, s conversion.Scope) error {
|
||||
return autoConvert_audit_PolicyList_To_v1beta1_PolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.PolicyRule, s conversion.Scope) error {
|
||||
out.Level = audit.Level(in.Level)
|
||||
out.Users = *(*[]string)(unsafe.Pointer(&in.Users))
|
||||
out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups))
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.Resources = *(*[]audit.GroupResources)(unsafe.Pointer(&in.Resources))
|
||||
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
out.OmitStages = *(*[]audit.Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_PolicyRule_To_audit_PolicyRule is an autogenerated conversion function.
|
||||
func Convert_v1beta1_PolicyRule_To_audit_PolicyRule(in *PolicyRule, out *audit.PolicyRule, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_PolicyRule_To_audit_PolicyRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_audit_PolicyRule_To_v1beta1_PolicyRule(in *audit.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
||||
out.Level = Level(in.Level)
|
||||
out.Users = *(*[]string)(unsafe.Pointer(&in.Users))
|
||||
out.UserGroups = *(*[]string)(unsafe.Pointer(&in.UserGroups))
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.Resources = *(*[]GroupResources)(unsafe.Pointer(&in.Resources))
|
||||
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
out.OmitStages = *(*[]Stage)(unsafe.Pointer(&in.OmitStages))
|
||||
out.OmitManagedFields = (*bool)(unsafe.Pointer(in.OmitManagedFields))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_audit_PolicyRule_To_v1beta1_PolicyRule is an autogenerated conversion function.
|
||||
func Convert_audit_PolicyRule_To_v1beta1_PolicyRule(in *audit.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
||||
return autoConvert_audit_PolicyRule_To_v1beta1_PolicyRule(in, out, s)
|
||||
}
|
299
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.deepcopy.go
generated
vendored
299
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.deepcopy.go
generated
vendored
@ -1,299 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/authentication/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Event) DeepCopyInto(out *Event) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Timestamp.DeepCopyInto(&out.Timestamp)
|
||||
in.User.DeepCopyInto(&out.User)
|
||||
if in.ImpersonatedUser != nil {
|
||||
in, out := &in.ImpersonatedUser, &out.ImpersonatedUser
|
||||
*out = new(v1.UserInfo)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.SourceIPs != nil {
|
||||
in, out := &in.SourceIPs, &out.SourceIPs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ObjectRef != nil {
|
||||
in, out := &in.ObjectRef, &out.ObjectRef
|
||||
*out = new(ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.ResponseStatus != nil {
|
||||
in, out := &in.ResponseStatus, &out.ResponseStatus
|
||||
*out = new(metav1.Status)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.RequestObject != nil {
|
||||
in, out := &in.RequestObject, &out.RequestObject
|
||||
*out = new(runtime.Unknown)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ResponseObject != nil {
|
||||
in, out := &in.ResponseObject, &out.ResponseObject
|
||||
*out = new(runtime.Unknown)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.RequestReceivedTimestamp.DeepCopyInto(&out.RequestReceivedTimestamp)
|
||||
in.StageTimestamp.DeepCopyInto(&out.StageTimestamp)
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Event.
|
||||
func (in *Event) DeepCopy() *Event {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Event)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Event) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EventList) DeepCopyInto(out *EventList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Event, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventList.
|
||||
func (in *EventList) DeepCopy() *EventList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EventList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EventList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupResources) DeepCopyInto(out *GroupResources) {
|
||||
*out = *in
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupResources.
|
||||
func (in *GroupResources) DeepCopy() *GroupResources {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupResources)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
|
||||
func (in *ObjectReference) DeepCopy() *ObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Policy) DeepCopyInto(out *Policy) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.OmitStages != nil {
|
||||
in, out := &in.OmitStages, &out.OmitStages
|
||||
*out = make([]Stage, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
|
||||
func (in *Policy) DeepCopy() *Policy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Policy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Policy) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyList) DeepCopyInto(out *PolicyList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Policy, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyList.
|
||||
func (in *PolicyList) DeepCopy() *PolicyList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PolicyList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyRule) DeepCopyInto(out *PolicyRule) {
|
||||
*out = *in
|
||||
if in.Users != nil {
|
||||
in, out := &in.Users, &out.Users
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.UserGroups != nil {
|
||||
in, out := &in.UserGroups, &out.UserGroups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]GroupResources, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Namespaces != nil {
|
||||
in, out := &in.Namespaces, &out.Namespaces
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NonResourceURLs != nil {
|
||||
in, out := &in.NonResourceURLs, &out.NonResourceURLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.OmitStages != nil {
|
||||
in, out := &in.OmitStages, &out.OmitStages
|
||||
*out = make([]Stage, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.OmitManagedFields != nil {
|
||||
in, out := &in.OmitManagedFields, &out.OmitManagedFields
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRule.
|
||||
func (in *PolicyRule) DeepCopy() *PolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
33
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.defaults.go
generated
vendored
33
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.defaults.go
generated
vendored
@ -1,33 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by defaulter-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
122
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.prerelease-lifecycle.go
generated
vendored
122
vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1/zz_generated.prerelease-lifecycle.go
generated
vendored
@ -1,122 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by prerelease-lifecycle-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *Event) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 8
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *Event) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *Event) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "Event"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *Event) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *EventList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 8
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *EventList) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *EventList) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "EventList"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *EventList) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *Policy) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 8
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *Policy) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *Policy) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "Policy"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *Policy) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
||||
|
||||
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
|
||||
func (in *PolicyList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 8
|
||||
}
|
||||
|
||||
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
|
||||
func (in *PolicyList) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 21
|
||||
}
|
||||
|
||||
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
|
||||
func (in *PolicyList) APILifecycleReplacement() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{Group: "audit.k8s.io", Version: "v1", Kind: "PolicyList"}
|
||||
}
|
||||
|
||||
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
|
||||
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
|
||||
func (in *PolicyList) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 24
|
||||
}
|
7
vendor/k8s.io/apiserver/pkg/audit/OWNERS
generated
vendored
7
vendor/k8s.io/apiserver/pkg/audit/OWNERS
generated
vendored
@ -1,9 +1,8 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- sig-auth-audit-approvers
|
||||
- sig-auth-audit-approvers
|
||||
reviewers:
|
||||
- sig-auth-audit-reviewers
|
||||
- sig-auth-audit-reviewers
|
||||
labels:
|
||||
- sig/auth
|
||||
|
||||
- sig/auth
|
||||
|
139
vendor/k8s.io/apiserver/pkg/audit/context.go
generated
vendored
139
vendor/k8s.io/apiserver/pkg/audit/context.go
generated
vendored
@ -18,9 +18,11 @@ package audit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
auditinternal "k8s.io/apiserver/pkg/apis/audit"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// The key type is unexported to prevent collisions
|
||||
@ -28,15 +30,15 @@ type key int
|
||||
|
||||
const (
|
||||
// auditAnnotationsKey is the context key for the audit annotations.
|
||||
// TODO: it's wasteful to store the audit annotations under a separate key, we
|
||||
// copy the request context twice for audit purposes. We should move the audit
|
||||
// annotations under AuditContext so we can get rid of the additional request
|
||||
// context copy.
|
||||
// TODO: consolidate all audit info under the AuditContext, rather than storing 3 separate keys.
|
||||
auditAnnotationsKey key = iota
|
||||
|
||||
// auditKey is the context key for storing the audit event that is being
|
||||
// captured and the evaluated policy that applies to the given request.
|
||||
auditKey
|
||||
|
||||
// auditAnnotationsMutexKey is the context key for the audit annotations mutex.
|
||||
auditAnnotationsMutexKey
|
||||
)
|
||||
|
||||
// annotations = *[]annotation instead of a map to preserve order of insertions
|
||||
@ -54,6 +56,7 @@ func WithAuditAnnotations(parent context.Context) context.Context {
|
||||
if _, ok := parent.Value(auditAnnotationsKey).(*[]annotation); ok {
|
||||
return parent
|
||||
}
|
||||
parent = withAuditAnnotationsMutex(parent)
|
||||
|
||||
var annotations []annotation // avoid allocations until we actually need it
|
||||
return genericapirequest.WithValue(parent, auditAnnotationsKey, &annotations)
|
||||
@ -67,35 +70,126 @@ func WithAuditAnnotations(parent context.Context) context.Context {
|
||||
// Handlers that are unaware of their position in the overall request flow should
|
||||
// prefer AddAuditAnnotation over LogAnnotation to avoid dropping annotations.
|
||||
func AddAuditAnnotation(ctx context.Context, key, value string) {
|
||||
// use the audit event directly if we have it
|
||||
if ae := AuditEventFrom(ctx); ae != nil {
|
||||
LogAnnotation(ae, key, value)
|
||||
mutex, ok := auditAnnotationsMutex(ctx)
|
||||
if !ok {
|
||||
// auditing is not enabled
|
||||
return
|
||||
}
|
||||
|
||||
annotations, ok := ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
if !ok {
|
||||
return // adding audit annotation is not supported at this call site
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
ae := AuditEventFrom(ctx)
|
||||
var ctxAnnotations *[]annotation
|
||||
if ae == nil {
|
||||
ctxAnnotations, _ = ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
}
|
||||
|
||||
*annotations = append(*annotations, annotation{key: key, value: value})
|
||||
addAuditAnnotationLocked(ae, ctxAnnotations, key, value)
|
||||
}
|
||||
|
||||
// AddAuditAnnotations is a bulk version of AddAuditAnnotation. Refer to AddAuditAnnotation for
|
||||
// restrictions on when this can be called.
|
||||
// keysAndValues are the key-value pairs to add, and must have an even number of items.
|
||||
func AddAuditAnnotations(ctx context.Context, keysAndValues ...string) {
|
||||
mutex, ok := auditAnnotationsMutex(ctx)
|
||||
if !ok {
|
||||
// auditing is not enabled
|
||||
return
|
||||
}
|
||||
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
ae := AuditEventFrom(ctx)
|
||||
var ctxAnnotations *[]annotation
|
||||
if ae == nil {
|
||||
ctxAnnotations, _ = ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
}
|
||||
|
||||
if len(keysAndValues)%2 != 0 {
|
||||
klog.Errorf("Dropping mismatched audit annotation %q", keysAndValues[len(keysAndValues)-1])
|
||||
}
|
||||
for i := 0; i < len(keysAndValues); i += 2 {
|
||||
addAuditAnnotationLocked(ae, ctxAnnotations, keysAndValues[i], keysAndValues[i+1])
|
||||
}
|
||||
}
|
||||
|
||||
// AddAuditAnnotationsMap is a bulk version of AddAuditAnnotation. Refer to AddAuditAnnotation for
|
||||
// restrictions on when this can be called.
|
||||
func AddAuditAnnotationsMap(ctx context.Context, annotations map[string]string) {
|
||||
mutex, ok := auditAnnotationsMutex(ctx)
|
||||
if !ok {
|
||||
// auditing is not enabled
|
||||
return
|
||||
}
|
||||
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
ae := AuditEventFrom(ctx)
|
||||
var ctxAnnotations *[]annotation
|
||||
if ae == nil {
|
||||
ctxAnnotations, _ = ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
}
|
||||
|
||||
for k, v := range annotations {
|
||||
addAuditAnnotationLocked(ae, ctxAnnotations, k, v)
|
||||
}
|
||||
}
|
||||
|
||||
// addAuditAnnotationLocked is the shared code for recording an audit annotation. This method should
|
||||
// only be called while the auditAnnotationsMutex is locked.
|
||||
func addAuditAnnotationLocked(ae *auditinternal.Event, annotations *[]annotation, key, value string) {
|
||||
if ae != nil {
|
||||
logAnnotation(ae, key, value)
|
||||
} else if annotations != nil {
|
||||
*annotations = append(*annotations, annotation{key: key, value: value})
|
||||
}
|
||||
}
|
||||
|
||||
// This is private to prevent reads/write to the slice from outside of this package.
|
||||
// The audit event should be directly read to get access to the annotations.
|
||||
func auditAnnotationsFrom(ctx context.Context) []annotation {
|
||||
annotations, ok := ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
func addAuditAnnotationsFrom(ctx context.Context, ev *auditinternal.Event) {
|
||||
mutex, ok := auditAnnotationsMutex(ctx)
|
||||
if !ok {
|
||||
return nil // adding audit annotation is not supported at this call site
|
||||
// auditing is not enabled
|
||||
return
|
||||
}
|
||||
|
||||
return *annotations
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
annotations, ok := ctx.Value(auditAnnotationsKey).(*[]annotation)
|
||||
if !ok {
|
||||
return // no annotations to copy
|
||||
}
|
||||
|
||||
for _, kv := range *annotations {
|
||||
logAnnotation(ev, kv.key, kv.value)
|
||||
}
|
||||
}
|
||||
|
||||
// LogAnnotation fills in the Annotations according to the key value pair.
|
||||
func logAnnotation(ae *auditinternal.Event, key, value string) {
|
||||
if ae == nil || ae.Level.Less(auditinternal.LevelMetadata) {
|
||||
return
|
||||
}
|
||||
if ae.Annotations == nil {
|
||||
ae.Annotations = make(map[string]string)
|
||||
}
|
||||
if v, ok := ae.Annotations[key]; ok && v != value {
|
||||
klog.Warningf("Failed to set annotations[%q] to %q for audit:%q, it has already been set to %q", key, value, ae.AuditID, ae.Annotations[key])
|
||||
return
|
||||
}
|
||||
ae.Annotations[key] = value
|
||||
}
|
||||
|
||||
// WithAuditContext returns a new context that stores the pair of the audit
|
||||
// configuration object that applies to the given request and
|
||||
// the audit event that is going to be written to the API audit log.
|
||||
func WithAuditContext(parent context.Context, ev *AuditContext) context.Context {
|
||||
parent = withAuditAnnotationsMutex(parent)
|
||||
return genericapirequest.WithValue(parent, auditKey, ev)
|
||||
}
|
||||
|
||||
@ -114,3 +208,18 @@ func AuditContextFrom(ctx context.Context) *AuditContext {
|
||||
ev, _ := ctx.Value(auditKey).(*AuditContext)
|
||||
return ev
|
||||
}
|
||||
|
||||
// WithAuditAnnotationMutex adds a mutex for guarding context.AddAuditAnnotation.
|
||||
func withAuditAnnotationsMutex(parent context.Context) context.Context {
|
||||
if _, ok := parent.Value(auditAnnotationsMutexKey).(*sync.Mutex); ok {
|
||||
return parent
|
||||
}
|
||||
var mutex sync.Mutex
|
||||
return genericapirequest.WithValue(parent, auditAnnotationsMutexKey, &mutex)
|
||||
}
|
||||
|
||||
// AuditAnnotationsMutex returns the audit annotations mutex from the context.
|
||||
func auditAnnotationsMutex(ctx context.Context) (*sync.Mutex, bool) {
|
||||
mutex, ok := ctx.Value(auditAnnotationsMutexKey).(*sync.Mutex)
|
||||
return mutex, ok
|
||||
}
|
||||
|
27
vendor/k8s.io/apiserver/pkg/audit/request.go
generated
vendored
27
vendor/k8s.io/apiserver/pkg/audit/request.go
generated
vendored
@ -87,9 +87,7 @@ func NewEventFromRequest(req *http.Request, requestReceivedTimestamp time.Time,
|
||||
}
|
||||
}
|
||||
|
||||
for _, kv := range auditAnnotationsFrom(req.Context()) {
|
||||
LogAnnotation(ev, kv.key, kv.value)
|
||||
}
|
||||
addAuditAnnotationsFrom(req.Context(), ev)
|
||||
|
||||
return ev, nil
|
||||
}
|
||||
@ -196,9 +194,11 @@ func LogResponseObject(ctx context.Context, obj runtime.Object, gv schema.GroupV
|
||||
if status, ok := obj.(*metav1.Status); ok {
|
||||
// selectively copy the bounded fields.
|
||||
ae.ResponseStatus = &metav1.Status{
|
||||
Status: status.Status,
|
||||
Reason: status.Reason,
|
||||
Code: status.Code,
|
||||
Status: status.Status,
|
||||
Message: status.Message,
|
||||
Reason: status.Reason,
|
||||
Details: status.Details,
|
||||
Code: status.Code,
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,21 +243,6 @@ func encodeObject(obj runtime.Object, gv schema.GroupVersion, serializer runtime
|
||||
}, nil
|
||||
}
|
||||
|
||||
// LogAnnotation fills in the Annotations according to the key value pair.
|
||||
func LogAnnotation(ae *auditinternal.Event, key, value string) {
|
||||
if ae == nil || ae.Level.Less(auditinternal.LevelMetadata) {
|
||||
return
|
||||
}
|
||||
if ae.Annotations == nil {
|
||||
ae.Annotations = make(map[string]string)
|
||||
}
|
||||
if v, ok := ae.Annotations[key]; ok && v != value {
|
||||
klog.Warningf("Failed to set annotations[%q] to %q for audit:%q, it has already been set to %q", key, value, ae.AuditID, ae.Annotations[key])
|
||||
return
|
||||
}
|
||||
ae.Annotations[key] = value
|
||||
}
|
||||
|
||||
// truncate User-Agent if too long, otherwise return it directly.
|
||||
func maybeTruncateUserAgent(req *http.Request) string {
|
||||
ua := req.UserAgent()
|
||||
|
6
vendor/k8s.io/apiserver/pkg/audit/scheme.go
generated
vendored
6
vendor/k8s.io/apiserver/pkg/audit/scheme.go
generated
vendored
@ -25,8 +25,6 @@ import (
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
auditinternal "k8s.io/apiserver/pkg/apis/audit"
|
||||
"k8s.io/apiserver/pkg/apis/audit/v1"
|
||||
"k8s.io/apiserver/pkg/apis/audit/v1alpha1"
|
||||
"k8s.io/apiserver/pkg/apis/audit/v1beta1"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
@ -35,8 +33,6 @@ var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
func init() {
|
||||
metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
utilruntime.Must(v1.AddToScheme(Scheme))
|
||||
utilruntime.Must(v1alpha1.AddToScheme(Scheme))
|
||||
utilruntime.Must(v1beta1.AddToScheme(Scheme))
|
||||
utilruntime.Must(auditinternal.AddToScheme(Scheme))
|
||||
utilruntime.Must(Scheme.SetVersionPriority(v1.SchemeGroupVersion, v1beta1.SchemeGroupVersion, v1alpha1.SchemeGroupVersion))
|
||||
utilruntime.Must(Scheme.SetVersionPriority(v1.SchemeGroupVersion))
|
||||
}
|
||||
|
2
vendor/k8s.io/apiserver/pkg/endpoints/request/OWNERS
generated
vendored
2
vendor/k8s.io/apiserver/pkg/endpoints/request/OWNERS
generated
vendored
@ -1,4 +1,4 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
reviewers:
|
||||
- sttts
|
||||
- sttts
|
||||
|
202
vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go
generated
vendored
202
vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go
generated
vendored
@ -35,9 +35,20 @@ func maxDuration(d1 time.Duration, d2 time.Duration) time.Duration {
|
||||
return d2
|
||||
}
|
||||
|
||||
// DurationTracker is a simple interface for tracking functions duration
|
||||
// DurationTracker is a simple interface for tracking functions duration,
|
||||
// it is safe for concurrent use by multiple goroutines.
|
||||
type DurationTracker interface {
|
||||
Track(func())
|
||||
// Track measures time spent in the given function f and
|
||||
// aggregates measured duration using aggregateFunction.
|
||||
// if Track is invoked with f from multiple goroutines concurrently,
|
||||
// then f must be safe to be invoked concurrently by multiple goroutines.
|
||||
Track(f func())
|
||||
|
||||
// TrackDuration tracks latency from the specified duration
|
||||
// and aggregate it using aggregateFunction
|
||||
TrackDuration(time.Duration)
|
||||
|
||||
// GetLatency returns the total latency incurred so far
|
||||
GetLatency() time.Duration
|
||||
}
|
||||
|
||||
@ -64,6 +75,14 @@ func (t *durationTracker) Track(f func()) {
|
||||
f()
|
||||
}
|
||||
|
||||
// TrackDuration tracks latency from the given duration
|
||||
// using aggregateFunction
|
||||
func (t *durationTracker) TrackDuration(d time.Duration) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
t.latency = t.aggregateFunction(t.latency, d)
|
||||
}
|
||||
|
||||
// GetLatency returns aggregated latency tracked by a tracker
|
||||
func (t *durationTracker) GetLatency() time.Duration {
|
||||
t.mu.Lock()
|
||||
@ -85,38 +104,169 @@ func newMaxLatencyTracker(c clock.Clock) DurationTracker {
|
||||
}
|
||||
}
|
||||
|
||||
// WebhookDuration stores trackers used to measure webhook request durations.
|
||||
// Since admit webhooks are done sequentially duration is aggregated using
|
||||
// sum function. Validate webhooks are done in parallel so max function
|
||||
// is used.
|
||||
type WebhookDuration struct {
|
||||
AdmitTracker DurationTracker
|
||||
ValidateTracker DurationTracker
|
||||
// LatencyTrackers stores trackers used to measure latecny incurred in
|
||||
// components within the apiserver.
|
||||
type LatencyTrackers struct {
|
||||
// MutatingWebhookTracker tracks the latency incurred in mutating webhook(s).
|
||||
// Since mutating webhooks are done sequentially, latency
|
||||
// is aggregated using sum function.
|
||||
MutatingWebhookTracker DurationTracker
|
||||
|
||||
// ValidatingWebhookTracker tracks the latency incurred in validating webhook(s).
|
||||
// Validate webhooks are done in parallel, so max function is used.
|
||||
ValidatingWebhookTracker DurationTracker
|
||||
|
||||
// StorageTracker tracks the latency incurred inside the storage layer,
|
||||
// it accounts for the time it takes to send data to the underlying
|
||||
// storage layer (etcd) and get the complete response back.
|
||||
// If a request involves N (N>=1) round trips to the underlying
|
||||
// stogare layer, the latency will account for the total duration
|
||||
// from these N round trips.
|
||||
// It does not include the time incurred in admission, or validation.
|
||||
StorageTracker DurationTracker
|
||||
|
||||
// TransformTracker tracks the latency incurred in transforming the
|
||||
// response object(s) returned from the underlying storage layer.
|
||||
// This includes transforming the object to user's desired form
|
||||
// (ie. as Table), and also setting appropriate API level fields.
|
||||
// This does not include the latency incurred in serialization
|
||||
// (json or protobuf) of the response object or writing
|
||||
// of it to the http ResponseWriter object.
|
||||
TransformTracker DurationTracker
|
||||
|
||||
// SerializationTracker tracks the latency incurred in serialization
|
||||
// (json or protobuf) of the response object.
|
||||
// NOTE: serialization and writing of the serialized raw bytes to the
|
||||
// associated http ResponseWriter object are interleaved, and hence
|
||||
// the latency measured here will include the time spent writing the
|
||||
// serialized raw bytes to the http ResponseWriter object.
|
||||
SerializationTracker DurationTracker
|
||||
|
||||
// ResponseWriteTracker tracks the latency incurred in writing the
|
||||
// serialized raw bytes to the http ResponseWriter object (via the
|
||||
// Write method) associated with the request.
|
||||
// The Write method can be invoked multiple times, so we use a
|
||||
// latency tracker that sums up the duration from each call.
|
||||
ResponseWriteTracker DurationTracker
|
||||
}
|
||||
|
||||
type webhookDurationKeyType int
|
||||
type latencyTrackersKeyType int
|
||||
|
||||
// webhookDurationKey is the WebhookDuration (the time the request spent waiting
|
||||
// for the webhooks to finish) key for the context.
|
||||
const webhookDurationKey webhookDurationKeyType = iota
|
||||
// latencyTrackersKey is the key that associates a LatencyTrackers
|
||||
// instance with the request context.
|
||||
const latencyTrackersKey latencyTrackersKeyType = iota
|
||||
|
||||
// WithWebhookDuration returns a copy of parent context to which the
|
||||
// WebhookDuration trackers are added.
|
||||
func WithWebhookDuration(parent context.Context) context.Context {
|
||||
return WithWebhookDurationAndCustomClock(parent, clock.RealClock{})
|
||||
// WithLatencyTrackers returns a copy of parent context to which an
|
||||
// instance of LatencyTrackers is added.
|
||||
func WithLatencyTrackers(parent context.Context) context.Context {
|
||||
return WithLatencyTrackersAndCustomClock(parent, clock.RealClock{})
|
||||
}
|
||||
|
||||
// WithWebhookDurationAndCustomClock returns a copy of parent context to which
|
||||
// the WebhookDuration trackers are added. Tracers use given clock.
|
||||
func WithWebhookDurationAndCustomClock(parent context.Context, c clock.Clock) context.Context {
|
||||
return WithValue(parent, webhookDurationKey, &WebhookDuration{
|
||||
AdmitTracker: newSumLatencyTracker(c),
|
||||
ValidateTracker: newMaxLatencyTracker(c),
|
||||
// WithLatencyTrackersAndCustomClock returns a copy of parent context to which
|
||||
// an instance of LatencyTrackers is added. Tracers use given clock.
|
||||
func WithLatencyTrackersAndCustomClock(parent context.Context, c clock.Clock) context.Context {
|
||||
return WithValue(parent, latencyTrackersKey, &LatencyTrackers{
|
||||
MutatingWebhookTracker: newSumLatencyTracker(c),
|
||||
ValidatingWebhookTracker: newMaxLatencyTracker(c),
|
||||
StorageTracker: newSumLatencyTracker(c),
|
||||
TransformTracker: newSumLatencyTracker(c),
|
||||
SerializationTracker: newSumLatencyTracker(c),
|
||||
ResponseWriteTracker: newSumLatencyTracker(c),
|
||||
})
|
||||
}
|
||||
|
||||
// WebhookDurationFrom returns the value of the WebhookDuration key from the specified context.
|
||||
func WebhookDurationFrom(ctx context.Context) (*WebhookDuration, bool) {
|
||||
wd, ok := ctx.Value(webhookDurationKey).(*WebhookDuration)
|
||||
// LatencyTrackersFrom returns the associated LatencyTrackers instance
|
||||
// from the specified context.
|
||||
func LatencyTrackersFrom(ctx context.Context) (*LatencyTrackers, bool) {
|
||||
wd, ok := ctx.Value(latencyTrackersKey).(*LatencyTrackers)
|
||||
return wd, ok && wd != nil
|
||||
}
|
||||
|
||||
// TrackTransformResponseObjectLatency is used to track latency incurred
|
||||
// inside the function that takes an object returned from the underlying
|
||||
// storage layer (etcd) and performs any necessary transformations
|
||||
// of the response object. This does not include the latency incurred in
|
||||
// serialization (json or protobuf) of the response object or writing of
|
||||
// it to the http ResponseWriter object.
|
||||
// When called multiple times, the latency incurred inside the
|
||||
// transform func each time will be summed up.
|
||||
func TrackTransformResponseObjectLatency(ctx context.Context, transform func()) {
|
||||
if tracker, ok := LatencyTrackersFrom(ctx); ok {
|
||||
tracker.TransformTracker.Track(transform)
|
||||
return
|
||||
}
|
||||
|
||||
transform()
|
||||
}
|
||||
|
||||
// TrackStorageLatency is used to track latency incurred
|
||||
// inside the underlying storage layer.
|
||||
// When called multiple times, the latency provided will be summed up.
|
||||
func TrackStorageLatency(ctx context.Context, d time.Duration) {
|
||||
if tracker, ok := LatencyTrackersFrom(ctx); ok {
|
||||
tracker.StorageTracker.TrackDuration(d)
|
||||
}
|
||||
}
|
||||
|
||||
// TrackSerializeResponseObjectLatency is used to track latency incurred in
|
||||
// serialization (json or protobuf) of the response object.
|
||||
// When called multiple times, the latency provided will be summed up.
|
||||
func TrackSerializeResponseObjectLatency(ctx context.Context, f func()) {
|
||||
if tracker, ok := LatencyTrackersFrom(ctx); ok {
|
||||
tracker.SerializationTracker.Track(f)
|
||||
return
|
||||
}
|
||||
|
||||
f()
|
||||
}
|
||||
|
||||
// TrackResponseWriteLatency is used to track latency incurred in writing
|
||||
// the serialized raw bytes to the http ResponseWriter object (via the
|
||||
// Write method) associated with the request.
|
||||
// When called multiple times, the latency provided will be summed up.
|
||||
func TrackResponseWriteLatency(ctx context.Context, d time.Duration) {
|
||||
if tracker, ok := LatencyTrackersFrom(ctx); ok {
|
||||
tracker.ResponseWriteTracker.TrackDuration(d)
|
||||
}
|
||||
}
|
||||
|
||||
// AuditAnnotationsFromLatencyTrackers will inspect each latency tracker
|
||||
// associated with the request context and return a set of audit
|
||||
// annotations that can be added to the API audit entry.
|
||||
func AuditAnnotationsFromLatencyTrackers(ctx context.Context) map[string]string {
|
||||
const (
|
||||
transformLatencyKey = "apiserver.latency.k8s.io/transform-response-object"
|
||||
storageLatencyKey = "apiserver.latency.k8s.io/etcd"
|
||||
serializationLatencyKey = "apiserver.latency.k8s.io/serialize-response-object"
|
||||
responseWriteLatencyKey = "apiserver.latency.k8s.io/response-write"
|
||||
mutatingWebhookLatencyKey = "apiserver.latency.k8s.io/mutating-webhook"
|
||||
validatingWebhookLatencyKey = "apiserver.latency.k8s.io/validating-webhook"
|
||||
)
|
||||
|
||||
tracker, ok := LatencyTrackersFrom(ctx)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
annotations := map[string]string{}
|
||||
if latency := tracker.TransformTracker.GetLatency(); latency != 0 {
|
||||
annotations[transformLatencyKey] = latency.String()
|
||||
}
|
||||
if latency := tracker.StorageTracker.GetLatency(); latency != 0 {
|
||||
annotations[storageLatencyKey] = latency.String()
|
||||
}
|
||||
if latency := tracker.SerializationTracker.GetLatency(); latency != 0 {
|
||||
annotations[serializationLatencyKey] = latency.String()
|
||||
}
|
||||
if latency := tracker.ResponseWriteTracker.GetLatency(); latency != 0 {
|
||||
annotations[responseWriteLatencyKey] = latency.String()
|
||||
}
|
||||
if latency := tracker.MutatingWebhookTracker.GetLatency(); latency != 0 {
|
||||
annotations[mutatingWebhookLatencyKey] = latency.String()
|
||||
}
|
||||
if latency := tracker.ValidatingWebhookTracker.GetLatency(); latency != 0 {
|
||||
annotations[validatingWebhookLatencyKey] = latency.String()
|
||||
}
|
||||
|
||||
return annotations
|
||||
}
|
||||
|
2
vendor/k8s.io/apiserver/pkg/features/OWNERS
generated
vendored
2
vendor/k8s.io/apiserver/pkg/features/OWNERS
generated
vendored
@ -1,4 +1,4 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- feature-approvers
|
||||
- feature-approvers
|
||||
|
50
vendor/k8s.io/apiserver/pkg/features/kube_features.go
generated
vendored
50
vendor/k8s.io/apiserver/pkg/features/kube_features.go
generated
vendored
@ -30,26 +30,6 @@ const (
|
||||
// // alpha: v1.4
|
||||
// MyFeature() bool
|
||||
|
||||
// owner: @tallclair
|
||||
// alpha: v1.5
|
||||
// beta: v1.6
|
||||
// deprecated: v1.18
|
||||
//
|
||||
// StreamingProxyRedirects controls whether the apiserver should intercept (and follow)
|
||||
// redirects from the backend (Kubelet) for streaming requests (exec/attach/port-forward).
|
||||
//
|
||||
// This feature is deprecated, and will be removed in v1.24.
|
||||
StreamingProxyRedirects featuregate.Feature = "StreamingProxyRedirects"
|
||||
|
||||
// owner: @tallclair
|
||||
// alpha: v1.12
|
||||
// beta: v1.14
|
||||
// deprecated: v1.22
|
||||
//
|
||||
// ValidateProxyRedirects controls whether the apiserver should validate that redirects are only
|
||||
// followed to the same host. Only used if StreamingProxyRedirects is enabled.
|
||||
ValidateProxyRedirects featuregate.Feature = "ValidateProxyRedirects"
|
||||
|
||||
// owner: @tallclair
|
||||
// alpha: v1.7
|
||||
// beta: v1.8
|
||||
@ -124,15 +104,18 @@ const (
|
||||
WatchBookmark featuregate.Feature = "WatchBookmark"
|
||||
|
||||
// owner: @MikeSpreitzer @yue9944882
|
||||
// alpha: v1.15
|
||||
// alpha: v1.18
|
||||
// beta: v1.20
|
||||
//
|
||||
//
|
||||
// Enables managing request concurrency with prioritization and fairness at each server
|
||||
// Enables managing request concurrency with prioritization and fairness at each server.
|
||||
// The FeatureGate was introduced in release 1.15 but the feature
|
||||
// was not really implemented before 1.18.
|
||||
APIPriorityAndFairness featuregate.Feature = "APIPriorityAndFairness"
|
||||
|
||||
// owner: @wojtek-t
|
||||
// alpha: v1.16
|
||||
// beta: v1.20
|
||||
// GA: v1.24
|
||||
//
|
||||
// Deprecates and removes SelfLink from ObjectMeta and ListMeta.
|
||||
RemoveSelfLink featuregate.Feature = "RemoveSelfLink"
|
||||
@ -145,16 +128,10 @@ const (
|
||||
// Allows label and field based indexes in apiserver watch cache to accelerate list operations.
|
||||
SelectorIndex featuregate.Feature = "SelectorIndex"
|
||||
|
||||
// owner: @liggitt
|
||||
// beta: v1.19
|
||||
// GA: v1.22
|
||||
//
|
||||
// Allows sending warning headers in API responses.
|
||||
WarningHeaders featuregate.Feature = "WarningHeaders"
|
||||
|
||||
// owner: @wojtek-t
|
||||
// alpha: v1.20
|
||||
// beta: v1.21
|
||||
// GA: v1.24
|
||||
//
|
||||
// Allows for updating watchcache resource version with progress notify events.
|
||||
EfficientWatchResumption featuregate.Feature = "EfficientWatchResumption"
|
||||
@ -174,6 +151,7 @@ const (
|
||||
// owner: @jiahuif
|
||||
// kep: http://kep.k8s.io/2887
|
||||
// alpha: v1.23
|
||||
// beta: v1.24
|
||||
//
|
||||
// Enables populating "enum" field of OpenAPI schemas
|
||||
// in the spec returned from kube-apiserver.
|
||||
@ -189,6 +167,7 @@ const (
|
||||
// owner: @jefftree
|
||||
// kep: http://kep.k8s.io/2896
|
||||
// alpha: v1.23
|
||||
// beta: v1.24
|
||||
//
|
||||
// Enables kubernetes to publish OpenAPI v3
|
||||
OpenAPIV3 featuregate.Feature = "OpenAPIV3"
|
||||
@ -209,8 +188,6 @@ func init() {
|
||||
// To add a new feature, define a key for it above and add it here. The features will be
|
||||
// available throughout Kubernetes binaries.
|
||||
var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
|
||||
StreamingProxyRedirects: {Default: false, PreRelease: featuregate.Deprecated},
|
||||
ValidateProxyRedirects: {Default: true, PreRelease: featuregate.Deprecated},
|
||||
AdvancedAuditing: {Default: true, PreRelease: featuregate.GA},
|
||||
APIResponseCompression: {Default: true, PreRelease: featuregate.Beta},
|
||||
APIListChunking: {Default: true, PreRelease: featuregate.Beta},
|
||||
@ -221,14 +198,13 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
||||
StorageVersionAPI: {Default: false, PreRelease: featuregate.Alpha},
|
||||
WatchBookmark: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
APIPriorityAndFairness: {Default: true, PreRelease: featuregate.Beta},
|
||||
RemoveSelfLink: {Default: true, PreRelease: featuregate.Beta},
|
||||
RemoveSelfLink: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
SelectorIndex: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
WarningHeaders: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
EfficientWatchResumption: {Default: true, PreRelease: featuregate.Beta},
|
||||
EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
APIServerIdentity: {Default: false, PreRelease: featuregate.Alpha},
|
||||
APIServerTracing: {Default: false, PreRelease: featuregate.Alpha},
|
||||
OpenAPIEnums: {Default: false, PreRelease: featuregate.Alpha},
|
||||
OpenAPIEnums: {Default: true, PreRelease: featuregate.Beta},
|
||||
CustomResourceValidationExpressions: {Default: false, PreRelease: featuregate.Alpha},
|
||||
OpenAPIV3: {Default: false, PreRelease: featuregate.Alpha},
|
||||
OpenAPIV3: {Default: true, PreRelease: featuregate.Beta},
|
||||
ServerSideFieldValidation: {Default: false, PreRelease: featuregate.Alpha},
|
||||
}
|
||||
|
16
vendor/k8s.io/apiserver/pkg/quota/v1/OWNERS
generated
vendored
16
vendor/k8s.io/apiserver/pkg/quota/v1/OWNERS
generated
vendored
@ -1,13 +1,13 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
- vishh
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
reviewers:
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
- smarterclayton
|
||||
- vishh
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
- smarterclayton
|
||||
labels:
|
||||
- sig/api-machinery
|
||||
- sig/api-machinery
|
||||
emeritus_approvers:
|
||||
- vishh
|
||||
|
7
vendor/k8s.io/apiserver/pkg/util/webhook/client.go
generated
vendored
7
vendor/k8s.io/apiserver/pkg/util/webhook/client.go
generated
vendored
@ -148,8 +148,11 @@ func (cm *ClientManager) HookClient(cc ClientConfig) (*rest.RESTClient, error) {
|
||||
cfg.ContentConfig.ContentType = runtime.ContentTypeJSON
|
||||
|
||||
// Add a transport wrapper that allows detection of TLS connections to
|
||||
// servers without SAN extension in their serving certificates
|
||||
cfg.Wrap(x509metrics.NewMissingSANRoundTripperWrapperConstructor(x509MissingSANCounter))
|
||||
// servers with serving certificates with deprecated characteristics
|
||||
cfg.Wrap(x509metrics.NewDeprecatedCertificateRoundTripperWrapperConstructor(
|
||||
x509MissingSANCounter,
|
||||
x509InsecureSHA1Counter,
|
||||
))
|
||||
|
||||
client, err := rest.UnversionedRESTClientFor(cfg)
|
||||
if err == nil {
|
||||
|
27
vendor/k8s.io/apiserver/pkg/util/webhook/gencerts.sh
generated
vendored
27
vendor/k8s.io/apiserver/pkg/util/webhook/gencerts.sh
generated
vendored
@ -23,6 +23,14 @@ set -e
|
||||
|
||||
CN_BASE="webhook_tests"
|
||||
|
||||
cat > intermediate_ca.conf << EOF
|
||||
[ v3_ca ]
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid:always,issuer
|
||||
basicConstraints = critical,CA:true
|
||||
keyUsage = cRLSign, keyCertSign
|
||||
EOF
|
||||
|
||||
cat > server.conf << EOF
|
||||
[req]
|
||||
req_extensions = v3_req
|
||||
@ -71,6 +79,15 @@ openssl req -x509 -new -nodes -key caKey.pem -days 100000 -out caCert.pem -subj
|
||||
openssl genrsa -out badCAKey.pem 2048
|
||||
openssl req -x509 -new -nodes -key badCAKey.pem -days 100000 -out badCACert.pem -subj "/CN=${CN_BASE}_ca"
|
||||
|
||||
# Create an intermediate certificate authority
|
||||
openssl genrsa -out caKeyInter.pem 2048
|
||||
openssl req -new -nodes -key caKeyInter.pem -days 100000 -out caCertInter.csr -subj "/CN=${CN_BASE}_intermediate_ca"
|
||||
openssl x509 -req -in caCertInter.csr -CA caCert.pem -CAkey caKey.pem -CAcreateserial -out caCertInter.pem -days 100000 -extensions v3_ca -extfile intermediate_ca.conf
|
||||
|
||||
# Create an intermediate certificate authority with sha1 signature
|
||||
openssl req -new -nodes -key caKeyInter.pem -days 100000 -out caCertInterSHA1.csr -subj "/CN=${CN_BASE}_intermediate_ca"
|
||||
openssl x509 -sha1 -req -in caCertInterSHA1.csr -CA caCert.pem -CAkey caKey.pem -CAcreateserial -out caCertInterSHA1.pem -days 100000 -extensions v3_ca -extfile intermediate_ca.conf
|
||||
|
||||
# Create a server certiticate
|
||||
openssl genrsa -out serverKey.pem 2048
|
||||
openssl req -new -key serverKey.pem -out server.csr -subj "/CN=${CN_BASE}_server" -config server.conf
|
||||
@ -80,6 +97,14 @@ openssl x509 -req -in server.csr -CA caCert.pem -CAkey caKey.pem -CAcreateserial
|
||||
openssl req -new -key serverKey.pem -out serverNoSAN.csr -subj "/CN=localhost" -config server_no_san.conf
|
||||
openssl x509 -req -in serverNoSAN.csr -CA caCert.pem -CAkey caKey.pem -CAcreateserial -out serverCertNoSAN.pem -days 100000 -extensions v3_req -extfile server_no_san.conf
|
||||
|
||||
# Create a server certiticate with SHA1 signature signed by OK intermediate CA
|
||||
openssl req -new -key serverKey.pem -out serverSHA1.csr -subj "/CN=localhost" -config server.conf
|
||||
openssl x509 -sha1 -req -in serverSHA1.csr -CA caCertInter.pem -CAkey caKeyInter.pem -CAcreateserial -out sha1ServerCertInter.pem -days 100000 -extensions v3_req -extfile server.conf
|
||||
|
||||
# Create a server certiticate signed by SHA1-signed intermediate CA
|
||||
openssl req -new -key serverKey.pem -out serverInterSHA1.csr -subj "/CN=localhost" -config server.conf
|
||||
openssl x509 -req -in serverInterSHA1.csr -CA caCertInterSHA1.pem -CAkey caKeyInter.pem -CAcreateserial -out serverCertInterSHA1.pem -days 100000 -extensions v3_req -extfile server.conf
|
||||
|
||||
# Create a client certiticate
|
||||
openssl genrsa -out clientKey.pem 2048
|
||||
openssl req -new -key clientKey.pem -out client.csr -subj "/CN=${CN_BASE}_client" -config client.conf
|
||||
@ -110,7 +135,7 @@ limitations under the License.
|
||||
package webhook
|
||||
EOF
|
||||
|
||||
for file in caKey caCert badCAKey badCACert serverKey serverCert serverCertNoSAN clientKey clientCert; do
|
||||
for file in caKey caCert badCAKey badCACert caCertInter caCertInterSHA1 serverKey serverCert serverCertNoSAN clientKey clientCert sha1ServerCertInter serverCertInterSHA1; do
|
||||
data=$(cat ${file}.pem)
|
||||
echo "" >> $outfile
|
||||
echo "var $file = []byte(\`$data\`)" >> $outfile
|
||||
|
13
vendor/k8s.io/apiserver/pkg/util/webhook/metrics.go
generated
vendored
13
vendor/k8s.io/apiserver/pkg/util/webhook/metrics.go
generated
vendored
@ -34,6 +34,19 @@ var x509MissingSANCounter = metrics.NewCounter(
|
||||
},
|
||||
)
|
||||
|
||||
var x509InsecureSHA1Counter = metrics.NewCounter(
|
||||
&metrics.CounterOpts{
|
||||
Subsystem: "webhooks",
|
||||
Namespace: "apiserver",
|
||||
Name: "x509_insecure_sha1_total",
|
||||
Help: "Counts the number of requests to servers with insecure SHA1 signatures " +
|
||||
"in their serving certificate OR the number of connection failures " +
|
||||
"due to the insecure SHA1 signatures (either/or, based on the runtime environment)",
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
)
|
||||
|
||||
func init() {
|
||||
legacyregistry.MustRegister(x509MissingSANCounter)
|
||||
legacyregistry.MustRegister(x509InsecureSHA1Counter)
|
||||
}
|
||||
|
60
vendor/k8s.io/apiserver/pkg/util/webhook/webhook.go
generated
vendored
60
vendor/k8s.io/apiserver/pkg/util/webhook/webhook.go
generated
vendored
@ -72,43 +72,23 @@ func DefaultShouldRetry(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// NewGenericWebhook creates a new GenericWebhook from the provided kubeconfig file.
|
||||
func NewGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFactory, kubeConfigFile string, groupVersions []schema.GroupVersion, retryBackoff wait.Backoff, customDial utilnet.DialFunc) (*GenericWebhook, error) {
|
||||
return newGenericWebhook(scheme, codecFactory, kubeConfigFile, groupVersions, retryBackoff, defaultRequestTimeout, customDial)
|
||||
}
|
||||
|
||||
func newGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFactory, kubeConfigFile string, groupVersions []schema.GroupVersion, retryBackoff wait.Backoff, requestTimeout time.Duration, customDial utilnet.DialFunc) (*GenericWebhook, error) {
|
||||
// NewGenericWebhook creates a new GenericWebhook from the provided rest.Config.
|
||||
func NewGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFactory, config *rest.Config, groupVersions []schema.GroupVersion, retryBackoff wait.Backoff) (*GenericWebhook, error) {
|
||||
for _, groupVersion := range groupVersions {
|
||||
if !scheme.IsVersionRegistered(groupVersion) {
|
||||
return nil, fmt.Errorf("webhook plugin requires enabling extension resource: %s", groupVersion)
|
||||
}
|
||||
}
|
||||
|
||||
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
|
||||
loadingRules.ExplicitPath = kubeConfigFile
|
||||
loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
|
||||
|
||||
clientConfig, err := loader.ClientConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Kubeconfigs can't set a timeout, this can only be set through a command line flag.
|
||||
//
|
||||
// https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/overrides.go
|
||||
//
|
||||
// Set this to something reasonable so request to webhooks don't hang forever.
|
||||
clientConfig.Timeout = requestTimeout
|
||||
|
||||
// Avoid client-side rate limiting talking to the webhook backend.
|
||||
// Rate limiting should happen when deciding how many requests to serve.
|
||||
clientConfig.QPS = -1
|
||||
clientConfig := rest.CopyConfig(config)
|
||||
|
||||
codec := codecFactory.LegacyCodec(groupVersions...)
|
||||
clientConfig.ContentConfig.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec})
|
||||
|
||||
clientConfig.Dial = customDial
|
||||
clientConfig.Wrap(x509metrics.NewMissingSANRoundTripperWrapperConstructor(x509MissingSANCounter))
|
||||
clientConfig.Wrap(x509metrics.NewDeprecatedCertificateRoundTripperWrapperConstructor(
|
||||
x509MissingSANCounter,
|
||||
x509InsecureSHA1Counter,
|
||||
))
|
||||
|
||||
restClient, err := rest.UnversionedRESTClientFor(clientConfig)
|
||||
if err != nil {
|
||||
@ -162,3 +142,29 @@ func WithExponentialBackoff(ctx context.Context, retryBackoff wait.Backoff, webh
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func LoadKubeconfig(kubeConfigFile string, customDial utilnet.DialFunc) (*rest.Config, error) {
|
||||
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
|
||||
loadingRules.ExplicitPath = kubeConfigFile
|
||||
loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
|
||||
|
||||
clientConfig, err := loader.ClientConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clientConfig.Dial = customDial
|
||||
|
||||
// Kubeconfigs can't set a timeout, this can only be set through a command line flag.
|
||||
//
|
||||
// https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/overrides.go
|
||||
//
|
||||
// Set this to something reasonable so request to webhooks don't hang forever.
|
||||
clientConfig.Timeout = defaultRequestTimeout
|
||||
|
||||
// Avoid client-side rate limiting talking to the webhook backend.
|
||||
// Rate limiting should happen when deciding how many requests to serve.
|
||||
clientConfig.QPS = -1
|
||||
|
||||
return clientConfig, nil
|
||||
}
|
||||
|
92
vendor/k8s.io/apiserver/pkg/util/x509metrics/missing_san.go
generated
vendored
92
vendor/k8s.io/apiserver/pkg/util/x509metrics/missing_san.go
generated
vendored
@ -1,92 +0,0 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package x509metrics
|
||||
|
||||
import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/component-base/metrics"
|
||||
)
|
||||
|
||||
var _ utilnet.RoundTripperWrapper = &x509MissingSANErrorMetricsRTWrapper{}
|
||||
|
||||
type x509MissingSANErrorMetricsRTWrapper struct {
|
||||
rt http.RoundTripper
|
||||
|
||||
counter *metrics.Counter
|
||||
}
|
||||
|
||||
// NewMissingSANRoundTripperWrapperConstructor returns a RoundTripper wrapper that's usable
|
||||
// within ClientConfig.Wrap that increases the `metricCounter` whenever:
|
||||
// 1. we get a x509.HostnameError with string `x509: certificate relies on legacy Common Name field`
|
||||
// which indicates an error caused by the deprecation of Common Name field when veryfing remote
|
||||
// hostname
|
||||
// 2. the server certificate in response contains no SAN. This indicates that this binary run
|
||||
// with the GODEBUG=x509ignoreCN=0 in env
|
||||
func NewMissingSANRoundTripperWrapperConstructor(metricCounter *metrics.Counter) func(rt http.RoundTripper) http.RoundTripper {
|
||||
return func(rt http.RoundTripper) http.RoundTripper {
|
||||
return &x509MissingSANErrorMetricsRTWrapper{
|
||||
rt: rt,
|
||||
counter: metricCounter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (w *x509MissingSANErrorMetricsRTWrapper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
resp, err := w.rt.RoundTrip(req)
|
||||
checkForHostnameError(err, w.counter)
|
||||
checkRespForNoSAN(resp, w.counter)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (w *x509MissingSANErrorMetricsRTWrapper) WrappedRoundTripper() http.RoundTripper {
|
||||
return w.rt
|
||||
}
|
||||
|
||||
// checkForHostnameError increases the metricCounter when we're running w/o GODEBUG=x509ignoreCN=0
|
||||
// and the client reports a HostnameError about the legacy CN fields
|
||||
func checkForHostnameError(err error, metricCounter *metrics.Counter) {
|
||||
if err != nil && errors.As(err, &x509.HostnameError{}) && strings.Contains(err.Error(), "x509: certificate relies on legacy Common Name field") {
|
||||
// increase the count of registered failures due to Go 1.15 x509 cert Common Name deprecation
|
||||
metricCounter.Inc()
|
||||
}
|
||||
}
|
||||
|
||||
// checkRespForNoSAN increases the metricCounter when the server response contains
|
||||
// a leaf certificate w/o the SAN extension
|
||||
func checkRespForNoSAN(resp *http.Response, metricCounter *metrics.Counter) {
|
||||
if resp != nil && resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
|
||||
if serverCert := resp.TLS.PeerCertificates[0]; !hasSAN(serverCert) {
|
||||
metricCounter.Inc()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func hasSAN(c *x509.Certificate) bool {
|
||||
sanOID := []int{2, 5, 29, 17}
|
||||
|
||||
for _, e := range c.Extensions {
|
||||
if e.Id.Equal(sanOID) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
225
vendor/k8s.io/apiserver/pkg/util/x509metrics/server_cert_deprecations.go
generated
vendored
Normal file
225
vendor/k8s.io/apiserver/pkg/util/x509metrics/server_cert_deprecations.go
generated
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package x509metrics
|
||||
|
||||
import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/apiserver/pkg/audit"
|
||||
"k8s.io/component-base/metrics"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
var _ utilnet.RoundTripperWrapper = &x509DeprecatedCertificateMetricsRTWrapper{}
|
||||
|
||||
type x509DeprecatedCertificateMetricsRTWrapper struct {
|
||||
rt http.RoundTripper
|
||||
|
||||
checkers []deprecatedCertificateAttributeChecker
|
||||
}
|
||||
|
||||
type deprecatedCertificateAttributeChecker interface {
|
||||
// CheckRoundTripError returns true if the err is an error specific
|
||||
// to this deprecated certificate attribute
|
||||
CheckRoundTripError(err error) bool
|
||||
// CheckPeerCertificates returns true if the deprecated attribute/value pair
|
||||
// was found in a given certificate in the http.Response.TLS.PeerCertificates bundle
|
||||
CheckPeerCertificates(certs []*x509.Certificate) bool
|
||||
// IncreaseCounter increases the counter internal to this interface
|
||||
// Use the req to derive and log information useful for troubleshooting the certificate issue
|
||||
IncreaseMetricsCounter(req *http.Request)
|
||||
}
|
||||
|
||||
// counterRaiser is a helper structure to include in certificate deprecation checkers.
|
||||
// It implements the IncreaseMetricsCounter() method so that, when included in the checker,
|
||||
// it does not have to be reimplemented.
|
||||
type counterRaiser struct {
|
||||
counter *metrics.Counter
|
||||
// programmatic id used in log and audit annotations prefixes
|
||||
id string
|
||||
// human readable explanation
|
||||
reason string
|
||||
}
|
||||
|
||||
func (c *counterRaiser) IncreaseMetricsCounter(req *http.Request) {
|
||||
if req != nil && req.URL != nil {
|
||||
if hostname := req.URL.Hostname(); len(hostname) > 0 {
|
||||
prefix := fmt.Sprintf("%s.invalid-cert.kubernetes.io", c.id)
|
||||
klog.Infof("%s: invalid certificate detected connecting to %q: %s", prefix, hostname, c.reason)
|
||||
audit.AddAuditAnnotation(req.Context(), prefix+"/"+hostname, c.reason)
|
||||
}
|
||||
}
|
||||
c.counter.Inc()
|
||||
}
|
||||
|
||||
// NewDeprecatedCertificateRoundTripperWrapperConstructor returns a RoundTripper wrapper that's usable within ClientConfig.Wrap.
|
||||
//
|
||||
// It increases the `missingSAN` counter whenever:
|
||||
// 1. we get a x509.HostnameError with string `x509: certificate relies on legacy Common Name field`
|
||||
// which indicates an error caused by the deprecation of Common Name field when veryfing remote
|
||||
// hostname
|
||||
// 2. the server certificate in response contains no SAN. This indicates that this binary run
|
||||
// with the GODEBUG=x509ignoreCN=0 in env
|
||||
//
|
||||
// It increases the `sha1` counter whenever:
|
||||
// 1. we get a x509.InsecureAlgorithmError with string `SHA1`
|
||||
// which indicates an error caused by an insecure SHA1 signature
|
||||
// 2. the server certificate in response contains a SHA1WithRSA or ECDSAWithSHA1 signature.
|
||||
// This indicates that this binary run with the GODEBUG=x509sha1=1 in env
|
||||
func NewDeprecatedCertificateRoundTripperWrapperConstructor(missingSAN, sha1 *metrics.Counter) func(rt http.RoundTripper) http.RoundTripper {
|
||||
return func(rt http.RoundTripper) http.RoundTripper {
|
||||
return &x509DeprecatedCertificateMetricsRTWrapper{
|
||||
rt: rt,
|
||||
checkers: []deprecatedCertificateAttributeChecker{
|
||||
NewSANDeprecatedChecker(missingSAN),
|
||||
NewSHA1SignatureDeprecatedChecker(sha1),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (w *x509DeprecatedCertificateMetricsRTWrapper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
resp, err := w.rt.RoundTrip(req)
|
||||
|
||||
if err != nil {
|
||||
for _, checker := range w.checkers {
|
||||
if checker.CheckRoundTripError(err) {
|
||||
checker.IncreaseMetricsCounter(req)
|
||||
}
|
||||
}
|
||||
} else if resp != nil {
|
||||
if resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
|
||||
for _, checker := range w.checkers {
|
||||
if checker.CheckPeerCertificates(resp.TLS.PeerCertificates) {
|
||||
checker.IncreaseMetricsCounter(req)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (w *x509DeprecatedCertificateMetricsRTWrapper) WrappedRoundTripper() http.RoundTripper {
|
||||
return w.rt
|
||||
}
|
||||
|
||||
var _ deprecatedCertificateAttributeChecker = &missingSANChecker{}
|
||||
|
||||
type missingSANChecker struct {
|
||||
counterRaiser
|
||||
}
|
||||
|
||||
func NewSANDeprecatedChecker(counter *metrics.Counter) *missingSANChecker {
|
||||
return &missingSANChecker{
|
||||
counterRaiser: counterRaiser{
|
||||
counter: counter,
|
||||
id: "missing-san",
|
||||
reason: "relies on a legacy Common Name field instead of the SAN extension for subject validation",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// CheckRoundTripError returns true when we're running w/o GODEBUG=x509ignoreCN=0
|
||||
// and the client reports a HostnameError about the legacy CN fields
|
||||
func (c *missingSANChecker) CheckRoundTripError(err error) bool {
|
||||
if err != nil && errors.As(err, &x509.HostnameError{}) && strings.Contains(err.Error(), "x509: certificate relies on legacy Common Name field") {
|
||||
// increase the count of registered failures due to Go 1.15 x509 cert Common Name deprecation
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// CheckPeerCertificates returns true when the server response contains
|
||||
// a leaf certificate w/o the SAN extension
|
||||
func (c *missingSANChecker) CheckPeerCertificates(peerCertificates []*x509.Certificate) bool {
|
||||
if len(peerCertificates) > 0 {
|
||||
if serverCert := peerCertificates[0]; !hasSAN(serverCert) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func hasSAN(c *x509.Certificate) bool {
|
||||
sanOID := []int{2, 5, 29, 17}
|
||||
|
||||
for _, e := range c.Extensions {
|
||||
if e.Id.Equal(sanOID) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type sha1SignatureChecker struct {
|
||||
*counterRaiser
|
||||
}
|
||||
|
||||
func NewSHA1SignatureDeprecatedChecker(counter *metrics.Counter) *sha1SignatureChecker {
|
||||
return &sha1SignatureChecker{
|
||||
counterRaiser: &counterRaiser{
|
||||
counter: counter,
|
||||
id: "insecure-sha1",
|
||||
reason: "uses an insecure SHA-1 signature",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// CheckRoundTripError returns true when we're running w/o GODEBUG=x509sha1=1
|
||||
// and the client reports an InsecureAlgorithmError about a SHA1 signature
|
||||
func (c *sha1SignatureChecker) CheckRoundTripError(err error) bool {
|
||||
var unknownAuthorityError x509.UnknownAuthorityError
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if !errors.As(err, &unknownAuthorityError) {
|
||||
return false
|
||||
}
|
||||
|
||||
errMsg := err.Error()
|
||||
if strIdx := strings.Index(errMsg, "x509: cannot verify signature: insecure algorithm"); strIdx != -1 && strings.Contains(errMsg[strIdx:], "SHA1") {
|
||||
// increase the count of registered failures due to Go 1.18 x509 sha1 signature deprecation
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// CheckPeerCertificates returns true when the server response contains
|
||||
// a non-root non-self-signed certificate with a deprecated SHA1 signature
|
||||
func (c *sha1SignatureChecker) CheckPeerCertificates(peerCertificates []*x509.Certificate) bool {
|
||||
// check all received non-self-signed certificates for deprecated signing algorithms
|
||||
for _, cert := range peerCertificates {
|
||||
if cert.SignatureAlgorithm == x509.SHA1WithRSA || cert.SignatureAlgorithm == x509.ECDSAWithSHA1 {
|
||||
// the SHA-1 deprecation does not involve self-signed root certificates
|
||||
if !reflect.DeepEqual(cert.Issuer, cert.Subject) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user