Skip to main content

validate_repository_parameters

Function validate_repository_parameters 

Source
pub fn validate_repository_parameters(
    parameters: Option<&RepositoryParameters>,
    mode: RepositoryMode,
    context: &str,
) -> Vec<ValidationError>
Expand description

spec.parameters is well-formed and applicable (#258). Shared by both repository kinds via context, exactly like validate_repository_health.

Two classes of rule:

  • Grammar. Every duration must parse, and every count must be positive. The grammar check matters more here than elsewhere: these are the first CRD durations that reach a kopia CLI, and this module’s contract is that a value the webhook admits never fails at reconcile time.
  • Applicability. A mode: ReadOnly repository can never apply them — kopia hard-errors set-parameters on a read-only connection — so declaring them there is a configuration mistake. Reject it rather than silently ignore the block, matching how volumeSnapshotClassName + an NFS source is handled.