config

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneWithSerialization

func CloneWithSerialization[T NumaflowControllerDefinitionConfig | GlobalConfig](orig *T) (*T, error)

Types

type AssessmentSchedule added in v0.15.0

type AssessmentSchedule struct {
	// Delay indicates the number of seconds to delay before assessing the status of the child resource to determine healthiness
	Delay time.Duration
	// End indicates the time delta from `Delay` that the assessment window has to be successful within
	End time.Duration
	// Period indicates the minimum window of time for which there must be consecutive success before we can declare
	// the resource successful
	Period time.Duration
	// Interval indicates how often to assess the child status once the first assessment has been performed and before the end
	Interval time.Duration
}

AssessmentSchedule is used for progressive rollout to assess the upgrading child

func ParseAssessmentSchedule added in v0.15.0

func ParseAssessmentSchedule(str string) (AssessmentSchedule, error)

ParseAssessmentSchedule parses the string indicating the AssessmentSchedule Example: "120,360,60,10" => delay assessment by 120s, assessment has to be successful within 360s, assessment must be successful for all checks within 60s, assess every 10s

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

func GetConfigManagerInstance

func GetConfigManagerInstance() *ConfigManager

GetConfigManagerInstance returns a singleton config manager throughout the application

func (*ConfigManager) GetConfig

func (cm *ConfigManager) GetConfig() (GlobalConfig, error)

func (*ConfigManager) GetControllerDefinitionsMgr added in v0.2.0

func (*ConfigManager) GetControllerDefinitionsMgr() *NumaflowControllerDefinitionsManager

func (*ConfigManager) GetNamespaceConfig added in v0.5.0

func (cm *ConfigManager) GetNamespaceConfig(namespace string) *NamespaceConfig

func (*ConfigManager) GetUSDEConfig added in v0.4.0

func (cm *ConfigManager) GetUSDEConfig() USDEConfig

func (*ConfigManager) LoadAllConfigs

func (cm *ConfigManager) LoadAllConfigs(
	onErrorReloading func(error),
	options ...Option,
) error

func (*ConfigManager) RegisterCallback added in v0.2.0

func (cm *ConfigManager) RegisterCallback(f func(config GlobalConfig))

RegisterCallback adds a callback to be called when the config changes

func (*ConfigManager) UnsetNamespaceConfig added in v0.5.0

func (cm *ConfigManager) UnsetNamespaceConfig(namespace string)

func (*ConfigManager) UnsetUSDEConfig added in v0.4.0

func (cm *ConfigManager) UnsetUSDEConfig()

func (*ConfigManager) UpdateNamespaceConfig added in v0.5.0

func (cm *ConfigManager) UpdateNamespaceConfig(namespace string, config NamespaceConfig)

func (*ConfigManager) UpdateUSDEConfig added in v0.4.0

func (cm *ConfigManager) UpdateUSDEConfig(config USDEConfig)

type DefaultAssessmentSchedule added in v0.15.0

type DefaultAssessmentSchedule struct {
	Kind string `json:"kind" mapstructure:"kind"`

	// The Schedule variables defines time information used when assessing a child health status.
	// It is a string with 3 comma-separated integer values representing the following:
	// 1. AssessmentDelay: indicates the amount of seconds to delay before assessing the status of the child resource to determine healthiness
	// 2. AssessmentPeriod: indicates the amount of seconds to perform assessments for after the first assessment has been performed
	//    (if failure is indicated before that, it will not continue however)
	// 3. AssessmentInterval: indicates how often to assess the child status once the first assessment has been performed and before the end
	// of the assessments window defined by adding the AssessmentDelay seconds to the AssessmentPeriod seconds
	// NOTE: the order of the values is important since each value represents a specific amount of time
	// Example: "120,60,10" => delay assessment by 120s, assess for 60s, assess every 10s
	// 0 can be used for AssessmentDelay to mean no delay
	// 0 can be used for AssessmentPeriod to not require a period of time to wait before assessment
	// Don't use 0 for AssessmentInterval: if the result is initially "unknown", this value is still needed as a requeing time interval for checking
	Schedule string `json:"schedule" mapstructure:"schedule"`
}

DefaultAssessmentSchedule defines a default schedule for each Kind

type GlobalConfig

type GlobalConfig struct {
	LogLevel          string `json:"logLevel" mapstructure:"logLevel"`
	IncludedResources string `json:"includedResources" mapstructure:"includedResources"`
	// List of Numaflow Controller image names to look for
	NumaflowControllerImageNames []string `json:"numaflowControllerImageNames" mapstructure:"numaflowControllerImageNames"`
	// If user's config doesn't exist or doesn't specify strategy, this is the default
	DefaultUpgradeStrategy USDEUserStrategy `json:"defaultUpgradeStrategy" mapstructure:"defaultUpgradeStrategy"`

	// Configuration related to the Progressive strategy
	Progressive ProgressiveConfig `json:"progressive" mapstructure:"progressive"`

	// TODO: remove when no longer needed
	// FeatureFlagDisallowProgressiveForNonMonoVertex is a TEMPORARY feature flag to disable progressive upgrades for resources other than MonoVertex
	FeatureFlagDisallowProgressiveForNonMonoVertex bool `json:"featureFlagDisallowProgressiveForNonMonoVertex" mapstructure:"featureFlagDisallowProgressiveForNonMonoVertex"`

	// TODO: remove when no longer needed
	// FeatureFlagIgnoreAnalysisResult is a TEMPORARY feature flag to ignore the result of an AnalysisRun
	FeatureFlagIgnoreAnalysisResult bool `json:"featureFlagIgnoreAnalysisResult" mapstructure:"featureFlagIgnoreAnalysisResult"`

	// List of permitted Kinds for Riders
	PermittedRiders string `json:"permittedRiders" mapstructure:"permittedRiders"`
}

GlobalConfig is the configuration for the controllers, it is supposed to be populated from the configmap attached to the controller manager.

type NamespaceConfig added in v0.5.0

type NamespaceConfig struct {
	UpgradeStrategy USDEUserStrategy `json:"upgradeStrategy,omitempty" yaml:"upgradeStrategy,omitempty"`
}

type NumaflowControllerDefinitionConfig

type NumaflowControllerDefinitionConfig struct {
	ControllerDefinitions []apiv1.ControllerDefinitions `json:"controllerDefinitions" yaml:"controllerDefinitions"`
}

type NumaflowControllerDefinitionsManager added in v0.4.0

type NumaflowControllerDefinitionsManager struct {
	// contains filtered or unexported fields
}

func (*NumaflowControllerDefinitionsManager) GetNumaflowControllerDefinitionsConfig added in v0.4.0

func (cm *NumaflowControllerDefinitionsManager) GetNumaflowControllerDefinitionsConfig(namespace, version string) (string, error)

GetNumaflowControllerDefinitionsConfig looks up the controller definition from user namespace, if not found then use from global namespace.

func (*NumaflowControllerDefinitionsManager) GetRolloutConfig added in v0.13.0

func (cm *NumaflowControllerDefinitionsManager) GetRolloutConfig() map[string]string

func (*NumaflowControllerDefinitionsManager) RemoveNumaflowControllerDefinitionConfig added in v0.4.0

func (cm *NumaflowControllerDefinitionsManager) RemoveNumaflowControllerDefinitionConfig(config NumaflowControllerDefinitionConfig, namespace string)

func (*NumaflowControllerDefinitionsManager) UpdateNumaflowControllerDefinitionConfig added in v0.4.0

func (cm *NumaflowControllerDefinitionsManager) UpdateNumaflowControllerDefinitionConfig(config NumaflowControllerDefinitionConfig, namespace string)

type Option

type Option func(*options)

func WithConfigFileName

func WithConfigFileName(configFileName string) Option

func WithConfigsPath

func WithConfigsPath(configsPath string) Option

type ProgressiveConfig added in v0.15.0

type ProgressiveConfig struct {
	// schedules for assessing upgrading child (one schedule per Kind)
	DefaultAssessmentSchedule []DefaultAssessmentSchedule `json:"defaultAssessmentSchedule" mapstructure:"defaultAssessmentSchedule"`

	// timeout duration which AnalysisRuns cannot continue to run after
	AnalysisRunTimeout string `json:"analysisRunTimeout" mapstructure:"analysisRunTimeout"`

	// when set to true, adds the rollout, promoted, and upgrading objects to all the log messages during progressive upgrade
	LogObjects bool `json:"logObjects" mapstructure:"logObjects"`
}

func (*ProgressiveConfig) GetAnalysisRunTimeout added in v0.19.0

func (config *ProgressiveConfig) GetAnalysisRunTimeout() (time.Duration, error)

GetAnalysisRunTimeout parses the GlobalConfig for the analysisRunTimeout string to convert into a time.Duration

func (*ProgressiveConfig) GetChildStatusAssessmentSchedule added in v0.15.0

func (config *ProgressiveConfig) GetChildStatusAssessmentSchedule(kind string) (AssessmentSchedule, error)

GetChildStatusAssessmentSchedule parses the GlobalConfig Default Assessment Schedule string for this kind into an AssessmentSchedule

type SpecField added in v0.13.0

type SpecField struct {
	Path             string `json:"path" yaml:"path"`
	IncludeSubfields bool   `json:"includeSubfields,omitempty" yaml:"includeSubfields,omitempty"`
}

type USDEConfig added in v0.4.0

type USDEConfig map[string]USDEResourceConfig

type USDEResourceConfig added in v0.13.0

type USDEResourceConfig struct {
	// Recreate indicates fields that require the resource to be recreated upon modification.
	// For PPND strategy, this list is checked before the other two lists.
	Recreate []SpecField `json:"recreate,omitempty" yaml:"recreate,omitempty"`
	// DataLoss represents fields that, when changed, may result in data loss.
	// For PPND strategy, this list is checked after the 'recreate' list.
	DataLoss []SpecField `json:"dataLoss,omitempty" yaml:"dataLoss,omitempty"`
	// Progressive contains fields that can be updated without requiring a full resource recreation and by performing an in-place update.
	// For PPND strategy, this list is checked after the other two lists.
	Progressive []SpecField `json:"progressive,omitempty" yaml:"progressive,omitempty"`
}

type USDEUserStrategy added in v0.6.0

type USDEUserStrategy string
const (
	ProgressiveStrategyID USDEUserStrategy = "progressive"
	PPNDStrategyID        USDEUserStrategy = "pause-and-drain"
	NoStrategyID          USDEUserStrategy = "no-strategy"
)

func (USDEUserStrategy) IsValid added in v0.7.0

func (s USDEUserStrategy) IsValid() bool

func (*USDEUserStrategy) UnmarshalJSON added in v0.6.0

func (s *USDEUserStrategy) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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