Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opt ¶
type Opt = func(cv *StateValidator)
Opt represents is a function that represents an option to configure a StateValidator.
type StateValidation ¶
type StateValidation = func(ctx context.Context, vc StateValidationConfig) error
StateValidation defines a validation that can be registered to the StateValidator.
func RetriableStateValidation ¶
func RetriableStateValidation(retrier *retrier.Retrier, validation StateValidation) StateValidation
RetriableStateValidation returns a StateValidation that is executed with the provided retrier.
type StateValidationConfig ¶
type StateValidationConfig struct { ClusterClient client.Client // the client for the cluster ManagementClusterClient client.Client // the client for the management cluster ClusterSpec *cluster.Spec // the cluster spec }
StateValidationConfig represents the input for the performing validations on the cluster.
type StateValidator ¶
type StateValidator struct { Config StateValidationConfig // contains filtered or unexported fields }
StateValidator is responsible for checking if a cluster is valid against the spec that is provided.
func NewStateValidator ¶
func NewStateValidator(config StateValidationConfig, opts ...Opt) *StateValidator
NewStateValidator returns a cluster validator which can be configured by passing Opt arguments.
func (*StateValidator) Validate ¶
func (c *StateValidator) Validate(ctx context.Context) error
Validate runs through the set registered validations and returns an error if any of them fail after a number of retries.
func (*StateValidator) WithValidations ¶
func (c *StateValidator) WithValidations(validations ...StateValidation)
WithValidations registers multiple validations to the StateValidator that will be run when Validate is called.