Documentation
¶
Index ¶
Constants ¶
View Source
const NoopMetricsRecorder = noopMetricsRecorder(0)
NoopMetricsRecorder is a no-op metrics recorder.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MeasureMutatingOpData ¶
type MeasureMutatingOpData struct {
MeasureOpCommonData
Mutated bool
}
MeasureMutatingOpData is the data to measure webhook mutating operation data.
type MeasureOpCommonData ¶
type MeasureOpCommonData struct {
WebhookID string
WebhookType string
AdmissionReviewVersion string
Duration time.Duration
Success bool
ResourceName string
ResourceNamespace string
Operation string
ResourceKind string
DryRun bool
WarningsNumber int
}
MeasureOpCommonData is the measuring data used to measure a webhook operation.
type MeasureValidatingOpData ¶
type MeasureValidatingOpData struct {
MeasureOpCommonData
Allowed bool
}
MeasureValidatingOpData is the data to measure webhook validating operation data.
type MetricsRecorder ¶
type MetricsRecorder interface {
MeasureValidatingWebhookReviewOp(ctx context.Context, data MeasureValidatingOpData)
MeasureMutatingWebhookReviewOp(ctx context.Context, data MeasureMutatingOpData)
}
MetricsRecorder knows how to record webhook recorder metrics.
type Webhook ¶
type Webhook interface {
// The id of the webhook.
ID() string
// The kind of the webhook.
Kind() model.WebhookKind
// Review will handle the admission review and return the AdmissionResponse with the result of the admission
// error, mutation...
Review(ctx context.Context, ar model.AdmissionReview) (model.AdmissionResponse, error)
}
Webhook knows how to handle the admission reviews, in other words Webhook is a dynamic admission webhook for Kubernetes.
func NewMeasuredWebhook ¶
func NewMeasuredWebhook(rec MetricsRecorder, next Webhook) Webhook
NewMeasuredWebhook returns a wrapped webhook that will measure the webhook operations.
Click to show internal directories.
Click to hide internal directories.