Documentation ¶
Index ¶
- Constants
- Variables
- func GetPolicyInfos(policy kyvernov1.PolicyInterface) (string, string, PolicyType, PolicyBackgroundMode, PolicyValidationMode, error)
- func NewOTLPGRPCConfig(ctx context.Context, endpoint string, certs string, ...) (metric.MeterProvider, error)
- func NewPrometheusConfig(ctx context.Context, log logr.Logger) (metric.MeterProvider, *http.ServeMux, error)
- func ShutDownController(ctx context.Context, pusher *sdkmetric.MeterProvider)
- type ClientQueryOperation
- type ClientType
- type MetricsConfig
- func (m *MetricsConfig) Config() kconfig.MetricsConfiguration
- func (m *MetricsConfig) RecordClientQueries(ctx context.Context, clientQueryOperation ClientQueryOperation, ...)
- func (m *MetricsConfig) RecordPolicyChanges(ctx context.Context, policyValidationMode PolicyValidationMode, ...)
- func (m *MetricsConfig) RecordPolicyExecutionDuration(ctx context.Context, policyValidationMode PolicyValidationMode, ...)
- func (m *MetricsConfig) RecordPolicyResults(ctx context.Context, policyValidationMode PolicyValidationMode, ...)
- type MetricsConfigManager
- type PolicyBackgroundMode
- type PolicyType
- type PolicyValidationMode
- type Recorder
- type ResourceRequestOperation
- type RuleExecutionCause
- type RuleResult
- type RuleType
Constants ¶
View Source
const (
MeterName = "kyverno"
)
View Source
const ( // keys RequestWebhookKey = attribute.Key("request_webhook") )
Variables ¶
View Source
var ( // keyvalues WebhookMutating = RequestWebhookKey.String("MutatingWebhookConfiguration") WebhookValidating = RequestWebhookKey.String("ValidatingWebhookConfiguration") )
Functions ¶
func GetPolicyInfos ¶ added in v1.7.0
func GetPolicyInfos(policy kyvernov1.PolicyInterface) (string, string, PolicyType, PolicyBackgroundMode, PolicyValidationMode, error)
func NewOTLPGRPCConfig ¶ added in v1.8.0
func NewPrometheusConfig ¶ added in v1.8.0
func ShutDownController ¶ added in v1.8.0
func ShutDownController(ctx context.Context, pusher *sdkmetric.MeterProvider)
Types ¶
type ClientQueryOperation ¶ added in v1.8.0
type ClientQueryOperation string
const ( ClientCreate ClientQueryOperation = "create" ClientGet ClientQueryOperation = "get" ClientList ClientQueryOperation = "list" ClientUpdate ClientQueryOperation = "update" ClientUpdateStatus ClientQueryOperation = "update_status" ClientDelete ClientQueryOperation = "delete" ClientDeleteCollection ClientQueryOperation = "delete_collection" ClientWatch ClientQueryOperation = "watch" ClientPatch ClientQueryOperation = "patch" )
type ClientType ¶ added in v1.8.0
type ClientType string
const ( KubeDynamicClient ClientType = "dynamic" KubeClient ClientType = "kubeclient" KyvernoClient ClientType = "kyverno" PolicyReportClient ClientType = "policyreport" )
type MetricsConfig ¶ added in v1.8.0
func NewFakeMetricsConfig ¶ added in v1.8.0
func NewFakeMetricsConfig() *MetricsConfig
func (*MetricsConfig) Config ¶ added in v1.8.0
func (m *MetricsConfig) Config() kconfig.MetricsConfiguration
func (*MetricsConfig) RecordClientQueries ¶ added in v1.8.0
func (m *MetricsConfig) RecordClientQueries(ctx context.Context, clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string)
func (*MetricsConfig) RecordPolicyChanges ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyChanges(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string)
func (*MetricsConfig) RecordPolicyExecutionDuration ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyExecutionDuration(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause, ruleExecutionLatency float64, )
func (*MetricsConfig) RecordPolicyResults ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyResults(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, resourceKind string, resourceNamespace string, resourceRequestOperation ResourceRequestOperation, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause, )
type MetricsConfigManager ¶ added in v1.8.0
type MetricsConfigManager interface { Config() kconfig.MetricsConfiguration RecordPolicyResults(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, resourceKind string, resourceNamespace string, resourceRequestOperation ResourceRequestOperation, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause) RecordPolicyChanges(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string) RecordPolicyExecutionDuration(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause, ruleExecutionLatency float64) RecordClientQueries(ctx context.Context, clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string) }
func InitMetrics ¶ added in v1.8.0
func InitMetrics( ctx context.Context, disableMetricsExport bool, otel string, metricsAddr string, otelCollector string, metricsConfiguration config.MetricsConfiguration, transportCreds string, kubeClient kubernetes.Interface, logger logr.Logger, ) (MetricsConfigManager, *http.ServeMux, *sdkmetric.MeterProvider, error)
type PolicyBackgroundMode ¶
type PolicyBackgroundMode string
const ( BackgroundTrue PolicyBackgroundMode = "true" BackgroundFalse PolicyBackgroundMode = "false" )
func ParsePolicyBackgroundMode ¶
func ParsePolicyBackgroundMode(policy kyvernov1.PolicyInterface) PolicyBackgroundMode
type PolicyType ¶
type PolicyType string
const ( Cluster PolicyType = "cluster" Namespaced PolicyType = "namespaced" )
type PolicyValidationMode ¶
type PolicyValidationMode string
const ( Enforce PolicyValidationMode = "enforce" Audit PolicyValidationMode = "audit" )
func ParsePolicyValidationMode ¶
func ParsePolicyValidationMode(validationFailureAction kyvernov1.ValidationFailureAction) (PolicyValidationMode, error)
type Recorder ¶ added in v1.8.1
type Recorder interface { Record(ClientQueryOperation) RecordWithContext(context.Context, ClientQueryOperation) }
func ClusteredClientQueryRecorder ¶ added in v1.8.1
func ClusteredClientQueryRecorder(m MetricsConfigManager, kind string, client ClientType) Recorder
func NamespacedClientQueryRecorder ¶ added in v1.8.1
func NamespacedClientQueryRecorder(m MetricsConfigManager, ns, kind string, client ClientType) Recorder
type ResourceRequestOperation ¶
type ResourceRequestOperation string
const ( ResourceCreated ResourceRequestOperation = "create" ResourceUpdated ResourceRequestOperation = "update" ResourceDeleted ResourceRequestOperation = "delete" ResourceConnected ResourceRequestOperation = "connect" )
func ParseResourceRequestOperation ¶ added in v1.7.0
func ParseResourceRequestOperation(requestOperationStr string) (ResourceRequestOperation, error)
type RuleExecutionCause ¶
type RuleExecutionCause string
const ( AdmissionRequest RuleExecutionCause = "admission_request" BackgroundScan RuleExecutionCause = "background_scan" )
type RuleResult ¶
type RuleResult string
const ( Pass RuleResult = "pass" Fail RuleResult = "fail" Warn RuleResult = "warn" Error RuleResult = "error" Skip RuleResult = "skip" )
type RuleType ¶
type RuleType string
func ParseRuleType ¶
func ParseRuleTypeFromEngineRuleResponse ¶ added in v1.7.0
func ParseRuleTypeFromEngineRuleResponse(rule response.RuleResponse) RuleType
Source Files ¶
Click to show internal directories.
Click to hide internal directories.