Documentation
¶
Index ¶
Constants ¶
const SupportedSelectorSubset = `a stream selector ` +
`(e.g. {scrape_job="audit-logs"}), optional line filters (|=, !=, |~, !~), ` +
`an optional "| json", and optional label filters (e.g. | verb="delete")`
SupportedSelectorSubset describes, for humans, what ValidateSelector accepts.
Variables ¶
This section is empty.
Functions ¶
func ValidateSelector ¶ added in v0.75.0
ValidateSelector reports whether a LogExport selector is a LogQL expression the export pipeline can honour.
The CRD already validates: minLength, maxLength. This adds: the expression is syntactically valid LogQL, and is restricted to the subset the exporter renders.
The accepted subset is deliberately narrower than "any log selector", because it is bounded by what the config rendering can translate into Alloy stages:
- stream selector + line filters -> stage.match { selector = ... }, verbatim
- "| json" + label filters -> stage.json plus a drop of the negated filter
The pipeline selects by dropping the *negated* selector, so an expression accepted here but translated imperfectly over-exports rather than under-exports — customer logs leaving the installation, not missing data. Anything accepted here therefore has to be renderable; widen this only together with the renderer.
Rendering must be driven from the parsed expression (syntax.Expr.String()), never from the raw field value: the parser tolerates trailing "# comment" and non-canonical whitespace, so a negated term appended to the raw string can be commented out.
Types ¶
type TenantValidator ¶
type TenantValidator struct {
// List of forbidden tenant ID values that pass the CRD pattern but are not allowed by Mimir
ForbiddenValues []string
}
TenantValidator provides common validation logic for tenant IDs across API versions.
func NewTenantValidator ¶
func NewTenantValidator() *TenantValidator
NewTenantValidator creates a new TenantValidator with default forbidden values.
func (*TenantValidator) ValidateTenantName ¶
func (v *TenantValidator) ValidateTenantName(tenantName string) error
ValidateTenantName validates a single tenant name for common business rules. This validates: forbidden values and basic naming rules. Duplicate checking is handled separately as it requires context of all tenants.
func (*TenantValidator) ValidateTenantNames ¶
func (v *TenantValidator) ValidateTenantNames(tenantNames []string) error
ValidateTenantNames validates a list of tenant names for all common rules. This combines forbidden value checking and duplicate detection.
func (*TenantValidator) ValidateUniqueNames ¶
func (v *TenantValidator) ValidateUniqueNames(tenantNames []string) error
ValidateUniqueNames validates that all tenant names in the slice are unique.