Documentation
¶
Index ¶
- Constants
- func AbortPromotion(ctx context.Context, c client.Client, namespacedName types.NamespacedName, ...) error
- func AbortPromotionAnnotationValue(annotations map[string]string) (*kargoapi.AbortPromotionRequest, bool)
- func AbortStageFreightVerification(ctx context.Context, c client.Client, namespacedName types.NamespacedName) error
- func AbortVerificationAnnotationValue(annotations map[string]string) (*kargoapi.VerificationRequest, bool)
- func AddMigrationAnnotationValue(obj client.Object, migrationType string)
- func AnnotateStageWithArgoCDContext(ctx context.Context, c client.Client, promo *kargoapi.Promotion, ...) error
- func AnySelectorMatches(selectors []labels.Selector, lbls map[string]string) bool
- func ArgoCDAppRefsToOutput(refs []ArgoCDAppRef) []any
- func AuthorizedStages(value string) ([]types.NamespacedName, error)
- func ComparePromotionByPhaseAndCreationTime(a, b kargoapi.Promotion) int
- func ComparePromotionPhase(a, b kargoapi.PromotionPhase) int
- func ComparePromotionRequestByPhaseAndCreationTime(a, b kargoapi.PromotionRequest) int
- func ComparePromotionRequestPhase(a, b kargoapi.PromotionRequestPhase) int
- func CreateActorAnnotationValue(promo *kargoapi.Promotion) string
- func EnsureFinalizer(ctx context.Context, c client.Client, obj client.Object) (bool, error)
- func FormatEventControllerActor(name string) string
- func FormatEventKubernetesUserActor(u authnv1.UserInfo) string
- func FormatEventUserActor(u user.Info) string
- func GenerateChildPromotionName(stageName, targetName, freight string) string
- func GenerateFreightID(f *kargoapi.Freight) string
- func GeneratePromotionName(stageName, freight string) string
- func GeneratePromotionRequestName(stageName, freight string) string
- func GetClusterConfig(ctx context.Context, c client.Client) (*kargoapi.ClusterConfig, error)
- func GetFreight(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Freight, error)
- func GetFreightByAlias(ctx context.Context, c client.Client, project string, alias string) (*kargoapi.Freight, error)
- func GetFreightByNameOrAlias(ctx context.Context, c client.Client, project string, name string, ...) (*kargoapi.Freight, error)
- func GetProject(ctx context.Context, c client.Client, name string) (*kargoapi.Project, error)
- func GetProjectConfig(ctx context.Context, c client.Client, name string) (*kargoapi.ProjectConfig, error)
- func GetPromotion(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Promotion, error)
- func GetStage(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Stage, error)
- func GetTarget(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Target, error)
- func GetWarehouse(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Warehouse, error)
- func HasMigrationAnnotationValue(obj client.Object, migrationType string) bool
- func InflateSteps(ctx context.Context, c client.Client, promo *kargoapi.Promotion) error
- func IsAutoPromotionEnabled(ctx context.Context, c client.Client, stage metav1.ObjectMeta) (bool, error)
- func IsCurrentStepRunning(promo *kargoapi.Promotion) bool
- func IsTargetAware(stage *kargoapi.Stage) bool
- func ListFreightAvailableToStage(ctx context.Context, c client.Client, s *kargoapi.Stage) ([]kargoapi.Freight, error)
- func ListFreightByCurrentStage(ctx context.Context, c client.Client, stage *kargoapi.Stage) ([]kargoapi.Freight, error)
- func ListFreightFromWarehouse(ctx context.Context, c client.Client, w *kargoapi.Warehouse, ...) ([]kargoapi.Freight, error)
- func ListStagesByWarehouses(ctx context.Context, c client.Client, project string, opts *ListStagesOptions) ([]kargoapi.Stage, error)
- func ListTargetsForStage(ctx context.Context, c client.Client, stage *kargoapi.Stage) ([]kargoapi.Target, error)
- func NewFreightCollectionForStage(stage *kargoapi.Stage, freight kargoapi.FreightReference) *kargoapi.FreightCollection
- func NewMinimalPromotion(stage *kargoapi.Stage, freightName string) *kargoapi.Promotion
- func NewMinimalPromotionForOrigin(stage *kargoapi.Stage, origin kargoapi.FreightOrigin) *kargoapi.Promotion
- func NewPromotionRequest(ctx context.Context, c client.Client, stage *kargoapi.Stage, ...) (*kargoapi.PromotionRequest, error)
- func PatchOwnerReferences(ctx context.Context, c client.Client, obj client.Object) error
- func PromotionRequestOwner(promo *kargoapi.Promotion) string
- func RefreshAnnotationValue(annotations map[string]string) (string, bool)
- func RefreshClusterConfig(ctx context.Context, c client.Client) (*kargoapi.ClusterConfig, error)
- func RefreshObject(ctx context.Context, c client.Client, obj client.Object) error
- func RefreshProjectConfig(ctx context.Context, c client.Client, project string) (*kargoapi.ProjectConfig, error)
- func RefreshPromotion(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Promotion, error)
- func RefreshStage(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Stage, error)
- func RefreshWarehouse(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Warehouse, error)
- func RemoveFinalizer(ctx context.Context, c client.Client, obj client.Object) error
- func ReverifyAnnotationValue(annotations map[string]string) (*kargoapi.VerificationRequest, bool)
- func ReverifyStageFreight(ctx context.Context, c client.Client, namespacedName types.NamespacedName) error
- func SelectAutoPromotionCandidates(ctx context.Context, stage *kargoapi.Stage, ...) map[string]kargoapi.Freight
- func SetAutoPromotionHoldAnnotation(promo *kargoapi.Promotion, origin kargoapi.FreightOrigin)
- func SetAutoPromotionResumeAnnotation(promo *kargoapi.Promotion, origin kargoapi.FreightOrigin)
- func SetCreateActorAnnotation(obj client.Object, actor string)
- func StageAwaitsPromotion(stage *kargoapi.Stage, promo *kargoapi.Promotion) bool
- func StageMatchesAnyWarehouse(stage *kargoapi.Stage, warehouses []string) bool
- func TargetSelectorsForStage(stage *kargoapi.Stage) ([]labels.Selector, error)
- type ArgoCDAppRef
- type ListStagesOptions
- type ListWarehouseFreightOptions
Constants ¶
const ArgoCDAppsOutputKey = "apps"
ArgoCDAppsOutputKey is the key under which Argo CD-aware promotion steps report the Argo CD Applications they resolved as step output. The value is a list of ArgoCDAppRef in the JSON-native form produced by ArgoCDAppRefsToOutput.
const ClusterConfigName = "cluster"
const PromotionAliasSeparator = "::"
PromotionAliasSeparator is the separator used in the alias of an inflated PromotionTask step to separate the task alias from the step alias.
Variables ¶
This section is empty.
Functions ¶
func AbortPromotion ¶
func AbortPromotion( ctx context.Context, c client.Client, namespacedName types.NamespacedName, action kargoapi.AbortAction, ) error
AbortPromotion forces aborting the Promotion by setting an annotation on the object, causing the controller to abort the Promotion. The annotation value is the action to take on the Promotion to abort it.
func AbortPromotionAnnotationValue ¶
func AbortPromotionAnnotationValue(annotations map[string]string) (*kargoapi.AbortPromotionRequest, bool)
AbortPromotionAnnotationValue returns the value of the AnnotationKeyAbort annotation which can be used to abort the promotion of a Freight, and a boolean indicating whether the annotation was present.
If the value of the annotation is a valid JSON object, it is unmarshalled into an AbortPromotionRequest struct. Otherwise, the value is treated as the action to be taken on the Promotion and set as the Action field of the returned AbortPromotionRequest.
func AbortStageFreightVerification ¶
func AbortStageFreightVerification( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) error
AbortStageFreightVerification forces aborting the verification of the Freight associated with a Stage by setting an AnnotationKeyAbort annotation on the Stage, causing the controller to abort the verification. The annotation value is the identifier of the existing VerificationInfo for the Stage.
func AbortVerificationAnnotationValue ¶
func AbortVerificationAnnotationValue(annotations map[string]string) (*kargoapi.VerificationRequest, bool)
AbortVerificationAnnotationValue returns the value of the AnnotationKeyAbort annotation which can be used to abort the verification of a Freight, and a boolean indicating whether the annotation was present.
If the value of the annotation is a valid JSON object, it is unmarshalled into a VerificationRequest struct. Otherwise, the value is treated as the ID of the verification to be aborted and set as the ID field of the returned VerificationRequest.
func AddMigrationAnnotationValue ¶
AddMigrationAnnotationValue updates the AnnotationKeyMigrated annotation in the provided annotations map to indicate that the specified migration type has been performed. If the annotation does not exist, it is created.
func AnnotateStageWithArgoCDContext ¶
func AnnotateStageWithArgoCDContext( ctx context.Context, c client.Client, promo *kargoapi.Promotion, stage types.NamespacedName, ) error
AnnotateStageWithArgoCDContext annotates a Stage with the ArgoCD context necessary for the frontend to display ArgoCD information for the Stage.
The annotation value is a JSON-encoded list of ArgoCD apps that are associated with the Stage, constructed from the given Promotion. Two sources contribute: the Applications that Argo CD-aware steps reported as step output, and the Applications named by the health check criteria those steps registered. The latter is what Promotions from before Argo CD-aware steps began reporting step output rely on.
If the Promotion is nil, or no ArgoCD apps are found, the annotation is removed.
This deliberately takes the Stage's identity rather than a caller's working Stage object. This is to avoid the patchAnnotation() call in this method overwriting pending status changes to the working Stage object with live status, which may be stale in comparison.
func AnySelectorMatches ¶ added in v1.12.0
AnySelectorMatches returns true if any of the provided selectors matches the provided labels. A Target is governed by a Stage when it matches any one of the Stage's selectors, so this is the test for governance once the selectors have been parsed. It returns false when there are no selectors.
func ArgoCDAppRefsToOutput ¶ added in v1.12.0
func ArgoCDAppRefsToOutput(refs []ArgoCDAppRef) []any
ArgoCDAppRefsToOutput converts refs into the representation an Argo CD-aware step must report them as.
Step output is shared state, and shared state is deep-copied between steps with runtime.DeepCopyJSON, which panics on any value that is not one of the types JSON decodes to. A []ArgoCDAppRef would therefore take the Promotion controller down on the next step, so refs are flattened to the maps they would have been decoded into.
func AuthorizedStages ¶ added in v1.11.0
func AuthorizedStages(value string) ([]types.NamespacedName, error)
AuthorizedStages parses the value of an AnnotationKeyAuthorizedStage annotation into the set of Stages authorized to manage the annotated resource (typically an Argo CD Application).
The value is a comma-separated list of "<project>:<stage>" entries, permitting more than one Stage to be authorized. A single "<project>:<stage>" value (the historical format) parses to a single-element list. The returned NamespacedNames use the project as the Namespace and the Stage name as the Name.
Whitespace around entries and around the project and Stage of each entry is ignored. Deprecated glob expressions (entries containing "*") are rejected with an error, as are malformed or empty entries.
func ComparePromotionByPhaseAndCreationTime ¶
ComparePromotionByPhaseAndCreationTime compares two Promotions by their phase and creation timestamp. It returns a negative value if Promotion `a` should come before Promotion `b`, a positive value if Promotion `a` should come after Promotion `b`, or zero if they are considered equal for sorting purposes. It can be used in conjunction with slices.SortFunc to sort a list of Promotions.
The order of Promotions is as follows:
- Running Promotions
- Non-terminal Promotions (ordered by ULID in ascending order)
- Terminal Promotions (ordered by ULID in descending order)
func ComparePromotionPhase ¶
func ComparePromotionPhase(a, b kargoapi.PromotionPhase) int
ComparePromotionPhase compares two Promotion phases. It returns a negative value if phase `a` should come before phase `b`, a positive value if phase `a` should come after phase `b`, or zero if they are considered equal for sorting purposes. It can be used in combination with slices.SortFunc to sort a list of Promotion phases.
The order of Promotion phases is as follows:
- Running
- Non-terminal phases
- Terminal phases
func ComparePromotionRequestByPhaseAndCreationTime ¶ added in v1.12.0
func ComparePromotionRequestByPhaseAndCreationTime(a, b kargoapi.PromotionRequest) int
ComparePromotionRequestByPhaseAndCreationTime compares two PromotionRequests by their phase and creation time. It returns a negative value if PromotionRequest `a` should come before PromotionRequest `b`, a positive value if `a` should come after `b`, or zero if they are considered equal for sorting purposes. It can be used in conjunction with slices.SortFunc to sort a list of PromotionRequests.
The order is the one ComparePromotionByPhaseAndCreationTime imposes on Promotions, so that a Stage chooses the PromotionRequest it is promoting through exactly as it chooses its current Promotion:
- Running PromotionRequests
- Non-terminal PromotionRequests (ordered by ULID in ascending order)
- Terminal PromotionRequests (ordered by ULID in descending order)
As there, name order stands in for creation order: a generated PromotionRequest name is <stage>.<ulid>.<short-hash>, so among the requests of a single Stage everything left of the ULID is identical and comparing names whole is comparing the ULIDs.
func ComparePromotionRequestPhase ¶ added in v1.12.0
func ComparePromotionRequestPhase(a, b kargoapi.PromotionRequestPhase) int
ComparePromotionRequestPhase compares two PromotionRequest phases. It returns a negative value if phase `a` should come before phase `b`, a positive value if phase `a` should come after phase `b`, or zero if they are considered equal for sorting purposes. It can be used in combination with slices.SortFunc to sort a list of PromotionRequest phases.
The order of PromotionRequest phases matches the one ComparePromotionPhase imposes on Promotion phases:
- Running
- Non-terminal phases
- Terminal phases
func CreateActorAnnotationValue ¶ added in v1.8.8
CreateActorAnnotationValue extracts the v1alpha1.AnnotationKeyCreateActor value from the Promotion's annotations and returns it. If the value contains a colon, everything after the first colon is returned. Otherwise, the entire value or an empty string is returned.
func EnsureFinalizer ¶
func FormatEventUserActor ¶
FormatEventUserActor returns a string representation of the user acting in an event that can be used as a value of AnnotationKeyEventActor.
- If the user is admin, it returns EventActorAdmin since other information is not available.
- If the user was authenticated by Kubernetes directly (e.g. a Kargo API token), it returns that identity in "kubernetes:<username>" format (see FormatEventKubernetesUserActor).
- If the username is known, it returns username in "<claim>:<username>" format (see formatOIDCUsername).
- If the email is available, it returns email in "email:<email>" format.
- If the subject is available, it returns subject in "subject:<subject>" format.
- Otherwise, it returns EventActorUnknown.
func GenerateChildPromotionName ¶ added in v1.12.0
GenerateChildPromotionName generates a name for a Promotion created by a PromotionRequest to promote Freight to one of its Targets.
The name has the format of:
<stage-name>.<target-name>.<ulid>.<short-hash>
Naming a child after its Target makes the fan-out legible at a glance and greppable by Target. The ULID and Freight hash are retained so that repeated promotions to the same Target do not collide, and so that lex order continues to match creation order as it does for every other Promotion.
func GenerateFreightID ¶
GenerateFreightID deterministically calculates a piece of Freight's ID based on its contents and returns it.
func GeneratePromotionName ¶ added in v1.11.0
GeneratePromotionName generates a name for a Promotion by combining the Stage name, a ULID, and a short hash of the Freight.
The name has the format of:
<stage-name>.<ulid>.<short-hash>
Promotion sorting and comparison logic elsewhere in Kargo relies on names in this format -- the embedded ULID makes lex order match creation order. Callers that need a Promotion name should always use this function.
func GeneratePromotionRequestName ¶ added in v1.12.0
GeneratePromotionRequestName generates a name for a PromotionRequest by combining the Stage name, a ULID, and a short hash of the Freight, in the same format used for Promotion names. Callers that need a PromotionRequest name should always use this function.
func GetClusterConfig ¶
GetClusterConfig returns a pointer to the ClusterConfig resource. If no such resource is found, nil is returned instead.
func GetFreight ¶
func GetFreight( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Freight, error)
GetFreight returns a pointer to the Freight resource specified by the namespacedName argument. If no such resource is found, nil is returned instead.
func GetFreightByAlias ¶
func GetFreightByAlias( ctx context.Context, c client.Client, project string, alias string, ) (*kargoapi.Freight, error)
GetFreightByAlias returns a pointer to the Freight resource specified by the project and alias arguments. If no such resource is found, nil is returned instead.
func GetFreightByNameOrAlias ¶
func GetFreightByNameOrAlias( ctx context.Context, c client.Client, project string, name string, alias string, ) (*kargoapi.Freight, error)
GetFreightByNameOrAlias returns a pointer to the Freight resource specified by the project, and name OR alias arguments. If no such resource is found, nil is returned instead.
func GetProject ¶
GetProject returns a pointer to the cluster-scoped Project resource specified by the name argument. If no such resource is found, nil is returned instead.
func GetProjectConfig ¶
func GetProjectConfig( ctx context.Context, c client.Client, name string, ) (*kargoapi.ProjectConfig, error)
GetProjectConfig returns a pointer to the ProjectConfig resource specified by the provided name. If no such resource is found, nil is returned instead.
func GetPromotion ¶
func GetPromotion( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Promotion, error)
GetPromotion returns a pointer to the Promotion resource specified by the namespacedName argument. If no such resource is found, nil is returned instead.
func GetStage ¶
func GetStage( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Stage, error)
GetStage returns a pointer to the Stage resource specified by the namespacedName argument. If no such resource is found, nil is returned instead.
func GetTarget ¶ added in v1.12.0
func GetTarget( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Target, error)
GetTarget returns a pointer to the Target resource specified by the namespacedName argument. If no such resource is found, nil is returned instead.
func GetWarehouse ¶
func GetWarehouse( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Warehouse, error)
GetWarehouse returns a pointer to the Warehouse resource specified by the namespacedName argument. If no such resource is found, nil is returned instead.
func HasMigrationAnnotationValue ¶
HasMigrationAnnotationValue checks if the AnnotationKeyMigrated annotation is present in the provided annotations map and if it contains the specified migration type as a key with a value of true.
func InflateSteps ¶ added in v1.11.0
InflateSteps inflates the given Promotion's steps in place by resolving any references to (Cluster)PromotionTasks and expanding them into their individual steps.
func IsAutoPromotionEnabled ¶ added in v1.11.0
func IsAutoPromotionEnabled( ctx context.Context, c client.Client, stage metav1.ObjectMeta, ) (bool, error)
IsAutoPromotionEnabled returns whether the ProjectConfig enables auto-promotion for the supplied Stage metadata.
func IsCurrentStepRunning ¶ added in v1.8.8
IsCurrentStepRunning returns true if the promotion is in a running state and the current step is also running.
func IsTargetAware ¶ added in v1.12.0
IsTargetAware returns true if the Stage governs Targets, i.e. promotes Freight to destinations described by Target resources rather than to itself.
The presence of the targets block is what decides this, not what its selectors happen to match. A Stage whose selectors currently match nothing is still target-aware; it simply governs no Targets at the moment.
func ListFreightAvailableToStage ¶
func ListFreightAvailableToStage( ctx context.Context, c client.Client, s *kargoapi.Stage, ) ([]kargoapi.Freight, error)
ListFreightAvailableToStage lists all Freight available to the Stage for any reason. This includes:
- Any Freight from a Warehouse that the Stage subscribes to directly
- Any Freight that is verified in upstream Stages matching configured AvailabilityStrategy (with any applicable soak time elapsed)
- Any Freight that is approved for the Stage
func ListFreightByCurrentStage ¶
func ListFreightByCurrentStage( ctx context.Context, c client.Client, stage *kargoapi.Stage, ) ([]kargoapi.Freight, error)
ListFreightByCurrentStage returns a list of Freight resources that think they're currently in use by the Stage specified.
func ListFreightFromWarehouse ¶
func ListFreightFromWarehouse( ctx context.Context, c client.Client, w *kargoapi.Warehouse, opts *ListWarehouseFreightOptions, ) ([]kargoapi.Freight, error)
ListFreightFromWarehouse returns a list of all Freight resources that originated from a Warehouse.
func ListStagesByWarehouses ¶ added in v1.10.3
func ListStagesByWarehouses( ctx context.Context, c client.Client, project string, opts *ListStagesOptions, ) ([]kargoapi.Stage, error)
ListStagesByWarehouses lists Stages in the given Project, optionally filtered by the provided options.
func ListTargetsForStage ¶ added in v1.12.0
func ListTargetsForStage( ctx context.Context, c client.Client, stage *kargoapi.Stage, ) ([]kargoapi.Target, error)
ListTargetsForStage returns the Targets in the Stage's own Project that the Stage governs, i.e. those matching any of its target selectors. Results are sorted by name so that repeated calls agree on ordering.
A classic Stage -- one with no targets block -- governs no Targets, and this returns an empty slice for it. An empty selector within the list selects every Target in the Project.
func NewFreightCollectionForStage ¶ added in v1.12.0
func NewFreightCollectionForStage( stage *kargoapi.Stage, freight kargoapi.FreightReference, ) *kargoapi.FreightCollection
NewFreightCollectionForStage builds the FreightCollection a Stage would be running once the given Freight is promoted to it: the Freight itself, plus the Freight from each of the Stage's other requested origins, carried over unchanged from what the Stage is running now.
Carried-over Freight comes from the Stage's last Promotion when there is one with a collection, and otherwise from the Stage's freight history. The last Promotion is preferred so that Promotions to an ordinary Stage keep building on one another exactly as they always have. A Stage that promotes through PromotionRequests never records a last Promotion (its Promotions are children of a request and take no part in its own flow), so for it the history is the source; without that fallback a multi-origin Stage's collection would name only the promoted origin and the Stage would appear to drop the rest.
Origins the Stage no longer requests are not carried over, so the result never contains Freight the Stage has stopped asking for. The same function builds the collection for a Promotion and for a PromotionRequest, so a request and its child Promotions agree by construction.
func NewMinimalPromotion ¶ added in v1.11.0
NewMinimalPromotion constructs a Promotion containing only the fields that callers (API server endpoints, the Stage controller's auto-promote loop) are responsible for setting. The Promotion defaulting webhook fills in the rest: name, steps copied from the Stage's PromotionTemplate, etc.
func NewMinimalPromotionForOrigin ¶ added in v1.11.0
func NewMinimalPromotionForOrigin( stage *kargoapi.Stage, origin kargoapi.FreightOrigin, ) *kargoapi.Promotion
NewMinimalPromotionForOrigin constructs a Promotion that, unlike NewMinimalPromotion which is explicit about the exact Freight to promote, specifies only an origin. The mutating webhook resolves the origin to the auto-promotion candidate Freight at admission time.
func NewPromotionRequest ¶ added in v1.12.0
func NewPromotionRequest( ctx context.Context, c client.Client, stage *kargoapi.Stage, freightName string, ) (*kargoapi.PromotionRequest, error)
NewPromotionRequest constructs a PromotionRequest expressing the intent to promote the given Freight to the Targets the Stage governs.
The Stage's target selectors are resolved to concrete Targets here, once, and the result recorded in spec.targets. That list is never recomputed: a PromotionRequest is a snapshot of what the Stage governed at this moment, so its threshold and terminal state are computed against a fixed set rather than a selector that could match differently later. A Target that appears after this point is picked up by a subsequent PromotionRequest, not by re-resolving this one.
The Stage is set as the controlling owner, so its PromotionRequests are garbage-collected with it.
The Stage MUST be target-aware. Callers should gate on IsTargetAware.
func PatchOwnerReferences ¶
func PromotionRequestOwner ¶ added in v1.12.0
PromotionRequestOwner returns the name of the PromotionRequest that owns the Promotion, or an empty string if the Promotion is not the child of one.
func RefreshAnnotationValue ¶
RefreshAnnotationValue returns the value of the AnnotationKeyRefresh annotation which can be used to detect changes, and a boolean indicating whether the annotation was present.
func RefreshClusterConfig ¶
RefreshClusterConfig forces reconciliation the ClusterConfig by setting an annotation on the ClusterConfig, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but might in the future include additional metadata/context necessary for the request.
func RefreshObject ¶ added in v1.8.8
RefreshObject forces reconciliation of a Kubernetes object by setting an annotation on the object, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but in the future may include additional metadata/context necessary for the request.
func RefreshProjectConfig ¶
func RefreshProjectConfig( ctx context.Context, c client.Client, project string, ) (*kargoapi.ProjectConfig, error)
RefreshProjectConfig forces reconciliation the ProjectConfig by setting an annotation on the ProjectConfig, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but might in the future include additional metadata/context necessary for the request.
func RefreshPromotion ¶
func RefreshPromotion( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Promotion, error)
RefreshPromotion forces reconciliation of a Promotion by setting an annotation on the Promotion, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but might in the future include additional metadata/context necessary for the request.
func RefreshStage ¶
func RefreshStage( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Stage, error)
RefreshStage forces reconciliation of a Stage by setting an annotation on the Stage, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but might in the future include additional metadata/context necessary for the request.
func RefreshWarehouse ¶
func RefreshWarehouse( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) (*kargoapi.Warehouse, error)
RefreshWarehouse forces reconciliation of a Warehouse by setting an annotation on the Warehouse, causing the controller to reconcile it. Currently, the annotation value is the timestamp of the request, but might in the future include additional metadata/context necessary for the request.
func RemoveFinalizer ¶
func ReverifyAnnotationValue ¶
func ReverifyAnnotationValue(annotations map[string]string) (*kargoapi.VerificationRequest, bool)
ReverifyAnnotationValue returns the value of the AnnotationKeyReverify annotation, which can be used to determine whether the verification of a Freight should be rerun, and a boolean indicating whether the annotation was present.
If the value of the annotation is a valid JSON object, it is unmarshalled into a VerificationRequest struct. Otherwise, the value is treated as the ID of the verification to be reverified and set as the ID field of the returned VerificationRequest.
func ReverifyStageFreight ¶
func ReverifyStageFreight( ctx context.Context, c client.Client, namespacedName types.NamespacedName, ) error
ReverifyStageFreight forces reconfirmation of the verification of the Freight associated with a Stage by setting an AnnotationKeyReverify annotation on the Stage, causing the controller to rerun the verification. The annotation value is the identifier of the existing VerificationInfo for the Stage.
func SelectAutoPromotionCandidates ¶ added in v1.11.0
func SelectAutoPromotionCandidates( ctx context.Context, stage *kargoapi.Stage, availableFreight []kargoapi.Freight, ) map[string]kargoapi.Freight
SelectAutoPromotionCandidates returns, for each origin in the Stage's requested Freight, the available Freight that origin's auto-promotion selection policy would pick. Selection is all this does: it never decides whether the pick should actually be promoted. Before acting on a candidate, callers apply their own checks -- e.g. that the candidate is not already the Stage's current Freight, that no Promotion for it already exists, and that no auto-promotion hold blocks its origin.
func SetAutoPromotionHoldAnnotation ¶ added in v1.11.0
func SetAutoPromotionHoldAnnotation(promo *kargoapi.Promotion, origin kargoapi.FreightOrigin)
SetAutoPromotionHoldAnnotation stamps promo with AnnotationKeyAutoPromotionHold set to origin's canonical key. The Stage controller reads a succeeded Promotion carrying this annotation to establish a hold for that origin.
func SetAutoPromotionResumeAnnotation ¶ added in v1.11.0
func SetAutoPromotionResumeAnnotation(promo *kargoapi.Promotion, origin kargoapi.FreightOrigin)
SetAutoPromotionResumeAnnotation stamps promo with AnnotationKeyAutoPromotionResume set to origin's canonical key. The Stage controller reads a succeeded Promotion carrying this annotation to resume auto-promotion for that origin by clearing any active hold.
func SetCreateActorAnnotation ¶ added in v1.11.0
SetCreateActorAnnotation stamps promo with AnnotationKeyCreateActor set to actor. It initializes the annotations map if necessary.
func StageAwaitsPromotion ¶ added in v1.12.0
StageAwaitsPromotion returns whether the Stage has recorded the Promotion as one it is currently promoting through. The Promotion reconciler does not run a Promotion until the Stage does so; this is what serializes promotions.
The Stage's own Promotions are serialized one at a time by the Stage's current Promotion. A Promotion to one of the Stage's Targets is instead admitted by the Stage's current PromotionRequest: all children of the current request run at once -- a request creates at most one child per Target, so Promotions to distinct Targets run in parallel and Promotions to the same Target never contend -- while the children of a queued request wait for the current round of fan-out to end.
func StageMatchesAnyWarehouse ¶ added in v1.10.3
StageMatchesAnyWarehouse returns true if the Stage requests Freight that originated from at least one of the specified warehouses, either directly or through upstream stages.
func TargetSelectorsForStage ¶ added in v1.12.0
TargetSelectorsForStage parses a Stage's target selectors into label selectors. It returns nil for a classic Stage -- one with no targets block -- which governs no Targets. An empty selector within the list parses to one that matches everything, so it selects every Target in the Project.
Types ¶
type ArgoCDAppRef ¶ added in v1.12.0
type ArgoCDAppRef struct {
// Name is the name of the Argo CD Application.
Name string `json:"name"`
// Namespace is the namespace of the Argo CD Application.
Namespace string `json:"namespace"`
}
ArgoCDAppRef identifies a single Argo CD Application associated with a Stage. A list of these is JSON-encoded into the AnnotationKeyArgoCDContext annotation, from which the UI builds deep links into Argo CD.
type ListStagesOptions ¶ added in v1.10.3
type ListStagesOptions struct {
// Warehouses is an optional list of Warehouse names to filter the Stages by.
Warehouses []string
}
ListStagesOptions defines the options for listing Stages.
type ListWarehouseFreightOptions ¶
type ListWarehouseFreightOptions struct {
// ApprovedFor names a Stage for which all Freight resources that have been
// approved for that Stage should be included in the list results.
//
// IMPORTANT: This is OR'ed with the VerifiedIn field.
ApprovedFor string
// VerifiedIn names zero or more Stages for which all Freight resources that
// have been verified for those Stages should be included in the list results
// AS long as they were verified before the VerifiedBefore time (if set).
//
// IMPORTANT: This is OR'ed with the ApprovedFor field.
VerifiedIn []string
// RequiredSoakTime optionally specifies a minimum duration that a piece of
// Freight must have continuously remained in a Stage at any time after being
// verified.
RequiredSoakTime *metav1.Duration
// AvailabilityStrategy specifies the semantics for how Freight is determined
// to be available. If not set, the default is to consider Freight available
// if it has been verified in any of the provided VerifiedIn stages.
// IMPORTANT: This is also applied to Freight matched using the VerifiedBefore
// condition.
AvailabilityStrategy kargoapi.FreightAvailabilityStrategy
// CurrentlyIn optionally specifies a Stage in which the Freight must
// currently be used in order to be included in the list results.
CurrentlyIn string
}
ListWarehouseFreightOptions is a struct that can be used to specify filtering criteria when listing Freight resources that originated from a Warehouse.
+protobuf=false +k8s:deepcopy-gen=false +k8s:openapi-gen=false