Documentation
¶
Index ¶
- func AreVertexReplicasReady(existingUpgradingChildDef *unstructured.Unstructured) (bool, string, error)
- func AssessUpgradingPipelineType(ctx context.Context, analysisStatus *apiv1.AnalysisStatus, ...) (apiv1.AssessmentResult, string, error)
- func CalculateFailureReason(replicasFailureReason, phase string, failedCondition *metav1.Condition) string
- func CalculateScaleMinMaxValues(object map[string]any, podsCount int, pathToMin []string) (int64, int64, error)
- func CreateAnalysisRun(ctx context.Context, analysis apiv1.Analysis, ...) error
- func ExtractScaleMinMaxAsJSONString(object map[string]any, pathToScale []string) (string, error)
- func GetAnalysisTemplatesFromRefs(ctx context.Context, templateRefs *[]argorolloutsv1.AnalysisTemplateRef, ...) ([]*argorolloutsv1.AnalysisTemplate, []*argorolloutsv1.ClusterAnalysisTemplate, ...)
- func ProcessResource(ctx context.Context, rolloutObject ProgressiveRolloutObject, ...) (bool, time.Duration, error)
- func ScaleDefinitionToPatchString(scaleDefinition *ScaleDefinition) string
- type ProgressiveRolloutObject
- type ScaleDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreVertexReplicasReady ¶ added in v0.17.0
func AreVertexReplicasReady(existingUpgradingChildDef *unstructured.Unstructured) (bool, string, error)
AreVertexReplicasReady checks if the number of ready replicas of a vertex matches or exceeds the desired replicas.
Parameters:
- existingUpgradingChildDef: An unstructured object representing the vertex whose replica status is being checked.
Returns:
- A boolean indicating whether the ready replicas are sufficient.
- In the case that ready replicas aren't sufficient, a message providing more information
func AssessUpgradingPipelineType ¶ added in v0.15.0
func AssessUpgradingPipelineType( ctx context.Context, analysisStatus *apiv1.AnalysisStatus, existingUpgradingChildDef *unstructured.Unstructured, verifyReplicasFunc func(existingUpgradingChildDef *unstructured.Unstructured) (bool, string, error), ) (apiv1.AssessmentResult, string, error)
AssessUpgradingPipelineType makes an assessment of the upgrading child (either Pipeline or MonoVertex) to determine if it was successful, failed, or still not known Assessment: Success: phase must be "Running" and all conditions must be True Failure: phase is "Failed" or any condition is False Unknown: neither of the above if met
func CalculateFailureReason ¶ added in v0.18.1
func CalculateFailureReason(replicasFailureReason, phase string, failedCondition *metav1.Condition) string
CalculateFailureReason issues a reason for failure; if there are multiple reasons, it returns one of them
func CalculateScaleMinMaxValues ¶ added in v0.14.0
func CalculateScaleMinMaxValues(object map[string]any, podsCount int, pathToMin []string) (int64, int64, error)
CalculateScaleMinMaxValues computes new minimum and maximum scale values // for a given object based on the current number of pods.
Numaflow notes: - if max is unset, Numaflow uses DefaultMaxReplicas (50) - if min is unset or negative, Numaflow uses 0
Parameters:
- object: A map representing the object from which to retrieve min and max values.
- podsCount: The current number of pods.
- pathToMin: A slice of strings representing the path to the min value in the object.
Returns:
- newMin: The adjusted minimum scale value.
- newMax: The adjusted maximum scale value.
- error: An error if there is an issue retrieving the min or max values.
func CreateAnalysisRun ¶ added in v0.19.0
func CreateAnalysisRun(ctx context.Context, analysis apiv1.Analysis, existingUpgradingChildDef *unstructured.Unstructured, client client.Client) error
CreateAnalysisRun finds all templates specified in the Analysis field in the spec of a rollout and creates the resulting AnalysisRun in k8s.
Parameters:
- ctx: the context for managing request-scoped values.
- analysis: struct which contains templateRefs to AnalysisTemplates and ClusterAnalysisTemplates and arguments that can be passed and override values already specified in the templates
- existingUpgradingChildDef: the definition of the upgrading child as an unstructured object.
- client: the client used for interacting with the Kubernetes API.
Returns:
- An error if any issues occur during processing.
func ExtractScaleMinMaxAsJSONString ¶ added in v0.19.0
ExtractScaleMinMaxAsJSONString returns a JSON string of the scale definition including only min and max fields extracted from the given unstructured object. It returns "null" if the pathToScale is not found.
func GetAnalysisTemplatesFromRefs ¶ added in v0.19.0
func GetAnalysisTemplatesFromRefs(ctx context.Context, templateRefs *[]argorolloutsv1.AnalysisTemplateRef, namespace string, c client.Client) ([]*argorolloutsv1.AnalysisTemplate, []*argorolloutsv1.ClusterAnalysisTemplate, error)
This function is repurposed from the Argo Rollout codebase here: https://github.com/argoproj/argo-rollouts/blob/f4f7eabd6bfa8c068abe1a7b62579aafeda25a0e/rollout/analysis.go#L469-L514
func ProcessResource ¶ added in v0.13.0
func ProcessResource( ctx context.Context, rolloutObject ProgressiveRolloutObject, existingPromotedChild *unstructured.Unstructured, promotedDifference bool, controller progressiveController, c client.Client, ) (bool, time.Duration, error)
return: - whether we're done - duration indicating the requeue delay for the controller to use for next reconciliation - error if any
func ScaleDefinitionToPatchString ¶ added in v0.19.0
func ScaleDefinitionToPatchString(scaleDefinition *ScaleDefinition) string
Types ¶
type ProgressiveRolloutObject ¶ added in v0.14.0
type ProgressiveRolloutObject interface {
ctlrcommon.RolloutObject
GetProgressiveStrategy() apiv1.ProgressiveStrategy
GetUpgradingChildStatus() *apiv1.UpgradingChildStatus
GetPromotedChildStatus() *apiv1.PromotedChildStatus
SetUpgradingChildStatus(*apiv1.UpgradingChildStatus)
// note this resets the entire Upgrading status struct which encapsulates the UpgradingChildStatus struct
ResetUpgradingChildStatus(upgradingChild *unstructured.Unstructured) error
SetPromotedChildStatus(*apiv1.PromotedChildStatus)
// note this resets the entire Promoted status struct which encapsulates the PromotedChildStatus struct
ResetPromotedChildStatus(promotedChild *unstructured.Unstructured) error
}
ProgressiveRolloutObject describes a Rollout instance that supports progressive upgrade
type ScaleDefinition ¶ added in v0.19.0
func ExtractScaleMinMax ¶ added in v0.19.0
func ExtractScaleMinMax(object map[string]any, pathToScale []string) (*ScaleDefinition, error)