validate

package
v0.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package validate centralises input validation for cluster-facing seictl commands. Every side-effecting subcommand calls these helpers before any kubeconfig, AWS, or filesystem mutation.

The regex shapes and the deny-list match docs/design/cluster-cli.md §Input validation. Image validation is policy-only — it does not resolve references to digests; that lives in internal/aws.

Index

Constants

View Source
const (
	AllowedRegistry   = "189176372795.dkr.ecr.us-east-2.amazonaws.com"
	AllowedRepoPrefix = "sei/"

	BenchSizeSmall  = "s"
	BenchSizeMedium = "m"
	BenchSizeLarge  = "l"

	BenchDurationMin = 1
	BenchDurationMax = 240
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Category string
	Message  string
}

Error is a validation failure carrying the CLI category and message. Callers attach the exit code at the call site via ExitWith — validation owns the WHAT (this input is invalid, here is why); the caller owns the WHEN/WHERE (which verb is failing, hence which exit code).

func Alias

func Alias(s string) *Error

func ChainID

func ChainID(s string) *Error

ChainID enforces a non-empty bech32-friendly chain identifier. Engineers usually pass the value emitted by `chain up`'s envelope.

func DurationMinutes

func DurationMinutes(n int) *Error

func Image

func Image(ref string) *Error

Image enforces the registry policy (ECR-only, sei/* prefix, tag or digest required). Digest resolution lives in internal/aws.

func Name

func Name(alias, name string) *Error

Name validates a benchmark name and enforces the combined `bench-<alias>-<name>` chain-id stays within K8s' 63-char label cap.

func Namespace

func Namespace(ns string) *Error

Namespace enforces RFC-1123 label shape. Convention enforcement (e.g. namespace = "eng-<alias>" for engineer cells) lives in `seictl onboard` — verbs read namespace verbatim from config so non-engineer flows can operate against arbitrary namespaces.

func RPCReplicas

func RPCReplicas(n int) *Error

func Size

func Size(s string) *Error

func Validators

func Validators(n int) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) ExitWith

func (e *Error) ExitWith(code int) *clioutput.Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL