Documentation ¶
Index ¶
- func GetPolicyInfos(policy kyvernov1.PolicyInterface) (string, string, PolicyType, PolicyBackgroundMode, PolicyValidationMode, error)
- func ListClient[T any](recorder Recorder, inner controllerutils.ListClient[T]) controllerutils.ListClient[T]
- func Logger() logr.Logger
- func NewOTLPGRPCConfig(endpoint string, certs string, kubeClient kubernetes.Interface, ...) (*controller.Controller, error)
- func NewPrometheusConfig(log logr.Logger) (*http.ServeMux, error)
- func ObjectClient[T metav1.Object](recorder Recorder, inner controllerutils.ObjectClient[T]) controllerutils.ObjectClient[T]
- func ShutDownController(ctx context.Context, pusher *controller.Controller)
- func StatusClient[T metav1.Object](recorder Recorder, inner controllerutils.StatusClient[T]) controllerutils.StatusClient[T]
- type ClientQueryOperation
- type ClientType
- type MetricsConfig
- func (m *MetricsConfig) RecordAdmissionRequests(resourceKind string, resourceNamespace string, ...)
- func (m *MetricsConfig) RecordAdmissionReviewDuration(resourceKind string, resourceNamespace string, resourceRequestOperation string, ...)
- func (m *MetricsConfig) RecordClientQueries(clientQueryOperation ClientQueryOperation, clientType ClientType, ...)
- func (m *MetricsConfig) RecordPolicyChanges(policyValidationMode PolicyValidationMode, policyType PolicyType, ...)
- func (m *MetricsConfig) RecordPolicyExecutionDuration(policyValidationMode PolicyValidationMode, policyType PolicyType, ...)
- func (m *MetricsConfig) RecordPolicyResults(policyValidationMode PolicyValidationMode, policyType PolicyType, ...)
- func (m *MetricsConfig) RecordPolicyRuleInfo(policyValidationMode PolicyValidationMode, policyType PolicyType, ...)
- type MetricsConfigManager
- type PolicyBackgroundMode
- type PolicyType
- type PolicyValidationMode
- type Recorder
- type ResourceRequestOperation
- type RuleExecutionCause
- type RuleResult
- type RuleType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPolicyInfos ¶ added in v1.7.0
func GetPolicyInfos(policy kyvernov1.PolicyInterface) (string, string, PolicyType, PolicyBackgroundMode, PolicyValidationMode, error)
func ListClient ¶ added in v1.8.1
func ListClient[T any](recorder Recorder, inner controllerutils.ListClient[T]) controllerutils.ListClient[T]
func NewOTLPGRPCConfig ¶ added in v1.8.0
func NewOTLPGRPCConfig( endpoint string, certs string, kubeClient kubernetes.Interface, log logr.Logger, ) (*controller.Controller, error)
func NewPrometheusConfig ¶ added in v1.8.0
func ObjectClient ¶ added in v1.8.1
func ObjectClient[T metav1.Object](recorder Recorder, inner controllerutils.ObjectClient[T], ) controllerutils.ObjectClient[T]
func ShutDownController ¶ added in v1.8.0
func ShutDownController(ctx context.Context, pusher *controller.Controller)
func StatusClient ¶ added in v1.8.1
func StatusClient[T metav1.Object](recorder Recorder, inner controllerutils.StatusClient[T]) controllerutils.StatusClient[T]
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
type MetricsConfig struct { // config Config *kconfig.MetricsConfigData Log logr.Logger // contains filtered or unexported fields }
func InitMetrics ¶ added in v1.8.0
func InitMetrics( disableMetricsExport bool, otel string, metricsAddr string, otelCollector string, metricsConfigData *config.MetricsConfigData, transportCreds string, kubeClient kubernetes.Interface, log logr.Logger, ) (*MetricsConfig, *http.ServeMux, *controller.Controller, error)
func NewFakeMetricsConfig ¶ added in v1.8.0
func NewFakeMetricsConfig(client kubernetes.Interface) *MetricsConfig
func (*MetricsConfig) RecordAdmissionRequests ¶ added in v1.8.0
func (m *MetricsConfig) RecordAdmissionRequests(resourceKind string, resourceNamespace string, resourceRequestOperation ResourceRequestOperation)
func (*MetricsConfig) RecordAdmissionReviewDuration ¶ added in v1.8.0
func (m *MetricsConfig) RecordAdmissionReviewDuration(resourceKind string, resourceNamespace string, resourceRequestOperation string, admissionRequestLatency float64)
func (*MetricsConfig) RecordClientQueries ¶ added in v1.8.0
func (m *MetricsConfig) RecordClientQueries(clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string)
func (*MetricsConfig) RecordPolicyChanges ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyChanges(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string)
func (*MetricsConfig) RecordPolicyExecutionDuration ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyExecutionDuration(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(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, resourceKind string, resourceNamespace string, resourceRequestOperation ResourceRequestOperation, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause, )
func (*MetricsConfig) RecordPolicyRuleInfo ¶ added in v1.8.0
func (m *MetricsConfig) RecordPolicyRuleInfo(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, ruleName string, ruleType RuleType, status string, metricValue float64, )
type MetricsConfigManager ¶ added in v1.8.0
type MetricsConfigManager interface { RecordPolicyResults(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(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string) RecordPolicyRuleInfo(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, ruleName string, ruleType RuleType, status string, metricValue float64) RecordAdmissionRequests(resourceKind string, resourceNamespace string, resourceRequestOperation ResourceRequestOperation) RecordPolicyExecutionDuration(policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, ruleName string, ruleResult RuleResult, ruleType RuleType, ruleExecutionCause RuleExecutionCause, ruleExecutionLatency float64) RecordAdmissionReviewDuration(resourceKind string, resourceNamespace string, resourceRequestOperation string, admissionRequestLatency float64) RecordClientQueries(clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string) }
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 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.