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(podsCount int) int64
- func CreateAnalysisRun(ctx context.Context, analysis apiv1.Analysis, ...) error
- func ExtractScaleMinMax(object map[string]any, pathToScale []string) (*apiv1.ScaleDefinition, 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)
- type ProgressiveRolloutObject
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 CreateAnalysisRun ¶ added in v0.19.0
func CreateAnalysisRun(ctx context.Context, analysis apiv1.Analysis, existingUpgradingChildDef *unstructured.Unstructured, ownerReference metav1.OwnerReference, 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.
- ownerReference: reference to the upgrading child this AnalysisRun is associated with - ensures cleanup
- client: the client used for interacting with the Kubernetes API.
Returns:
- An error if any issues occur during processing.
func ExtractScaleMinMax ¶ added in v0.19.0
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
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