Documentation ¶
Overview ¶
Package webhook implements the audit.Backend interface using HTTP webhooks.
Index ¶
Constants ¶
View Source
const ( // ModeBatch indicates that the webhook should buffer audit events // internally, sending batch updates either once a certain number of // events have been received or a certain amount of time has passed. ModeBatch = "batch" // ModeBlocking causes the webhook to block on every attempt to process // a set of events. This causes requests to the API server to wait for a // round trip to the external audit service before sending a response. ModeBlocking = "blocking" )
Variables ¶
View Source
var AllowedModes = []string{ ModeBatch, ModeBlocking, }
AllowedModes is the modes known by this webhook.
Functions ¶
func NewBackend ¶
func NewBackend(kubeConfigFile string, mode string, groupVersion schema.GroupVersion, config BatchBackendConfig) (audit.Backend, error)
NewBackend returns an audit backend that sends events over HTTP to an external service. The mode indicates the caching behavior of the webhook. Either blocking (ModeBlocking) or buffered with batch POSTs (ModeBatch).
Types ¶
type BatchBackendConfig ¶
type BatchBackendConfig struct { // BufferSize defines a size of the buffering queue. BufferSize int // MaxBatchSize defines maximum size of a batch. MaxBatchSize int // MaxBatchWait defines maximum amount of time to wait for MaxBatchSize // events to be accumulated in the buffer before forcibly sending what's // being accumulated. MaxBatchWait time.Duration // ThrottleQPS defines the allowed rate of batches per second sent to the webhook. ThrottleQPS float32 // ThrottleBurst defines the maximum rate of batches per second sent to the webhook in case // the capacity defined by ThrottleQPS was not utilized. ThrottleBurst int // InitialBackoff defines the amount of time to wait before retrying the requests // to the webhook for the first time. InitialBackoff time.Duration }
BatchBackendConfig represents batching webhook audit backend configuration.
func NewDefaultBatchBackendConfig ¶
func NewDefaultBatchBackendConfig() BatchBackendConfig
NewDefaultBatchBackendConfig returns new BatchBackendConfig objects populated by default values.
Click to show internal directories.
Click to hide internal directories.