validations

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAcceleratedSelectorMissing

func CheckAcceleratedSelectorMissing(ctx context.Context, componentName string, recipeResult *recipe.RecipeResult, bundlerConfig *config.Config, conditions map[string][]string) ([]string, []error)

CheckAcceleratedSelectorMissing checks if accelerated-node-selector is missing when conditions are met. This is a generic check that can be used by any component.

func CheckWorkloadSelectorMissing

func CheckWorkloadSelectorMissing(ctx context.Context, componentName string, recipeResult *recipe.RecipeResult, bundlerConfig *config.Config, conditions map[string][]string) ([]string, []error)

CheckWorkloadSelectorMissing checks if workload-selector is missing when conditions are met. This is a generic check that can be used by any component.

func GetAll

func GetAll() []string

GetAll returns all registered validation function names.

func Register

func Register(name string, fn ValidationFunc)

Register adds a validation function to the registry. This allows components to register custom validation functions. It's also called from init() functions in check files for auto-registration.

func RunValidations

func RunValidations(ctx context.Context, componentName string, validations []recipe.ComponentValidationConfig, recipeResult *recipe.RecipeResult, bundlerConfig *config.Config) (warnings []string, errors []error)

RunValidations executes all validations for a component and returns warnings and errors. The optional message from the validation config is appended to each warning/error. Severity determines whether check results become warnings or errors.

Types

type ValidationFunc

type ValidationFunc func(ctx context.Context, componentName string, recipeResult *recipe.RecipeResult, bundlerConfig *config.Config, conditions map[string][]string) (warnings []string, errors []error)

ValidationFunc is the signature for validation check functions. Parameters:

  • ctx: Context for cancellation/timeout
  • componentName: Name of the component being validated
  • recipeResult: The recipe result containing component refs and criteria
  • bundlerConfig: The bundler configuration (for accessing flags like workload-selector)
  • conditions: Conditions from the validation config (e.g., {"intent": ["training"]} or {"intent": ["training", "inference"]})

Returns:

  • warnings: List of warning messages (non-blocking)
  • errors: List of error messages (blocking)

func Get

func Get(name string) ValidationFunc

Get returns a validation function by name. Returns nil if the function is not found.

Jump to

Keyboard shortcuts

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