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, healthChecks []kargoapi.HealthCheckStep, ...) error
- func ComparePromotionByPhaseAndCreationTime(a, b kargoapi.Promotion) int
- func ComparePromotionPhase(a, b kargoapi.PromotionPhase) int
- 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 GenerateFreightID(f *kargoapi.Freight) 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 GetWarehouse(ctx context.Context, c client.Client, namespacedName types.NamespacedName) (*kargoapi.Warehouse, error)
- func HasMigrationAnnotationValue(obj client.Object, migrationType string) 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 NewFreightApprovedEventAnnotations(actor string, f *kargoapi.Freight, stageName string) map[string]string
- func PatchOwnerReferences(ctx context.Context, c client.Client, obj client.Object) error
- func RefreshAnnotationValue(annotations map[string]string) (string, bool)
- func RefreshClusterConfig(ctx context.Context, c client.Client) (*kargoapi.ClusterConfig, 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 ToVersionProto(v version.Version) *svcv1alpha1.VersionInfo
- type ListWarehouseFreightOptions
Constants ¶
const ClusterConfigName = "cluster"
const ( // MigratedProjectSpecToProjectConfig is the migration type for migrating // ProjectSpec resources to ProjectConfig resources. This migration is // performed by the controller when it detects that a Project resource // has a ProjectSpec resource in its spec, which is the case for Projects // created before the introduction of ProjectConfig resources. MigratedProjectSpecToProjectConfig = "ProjectSpecToProjectConfig" )
Variables ¶
This section is empty.
Functions ¶
func AbortPromotion ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.5.1
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 ¶ added in v1.4.0
func AnnotateStageWithArgoCDContext( ctx context.Context, c client.Client, healthChecks []kargoapi.HealthCheckStep, stage *kargoapi.Stage, ) 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 HealthCheckSteps from the latest Promotion.
If no ArgoCD apps are found, the annotation is removed.
func ComparePromotionByPhaseAndCreationTime ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 EnsureFinalizer ¶ added in v1.4.0
func FormatEventControllerActor ¶ added in v1.4.0
func FormatEventKubernetesUserActor ¶ added in v1.4.0
func FormatEventUserActor ¶ added in v1.4.0
FormatEventUserActor returns a string representation of the user acting in an event that can be used as a value of AnnotationKeyEventActor.
1. If the user is admin, it returns EventActorAdmin since other information is not available. 2. If the email is available, it returns email in "email:<email>" format. 3. If the subject is available, it returns subject in "subject:<subject>" format. 4. Otherwise, it returns EventActorUnknown.
func GenerateFreightID ¶ added in v1.4.0
GenerateFreightID deterministically calculates a piece of Freight's ID based on its contents and returns it.
func GetClusterConfig ¶ added in v1.5.2
GetClusterConfig returns a pointer to the ClusterConfig resource. If no such resource is found, nil is returned instead.
func GetFreight ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.5.2
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 GetWarehouse ¶ added in v1.4.0
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 ¶ added in v1.5.1
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 ListFreightAvailableToStage ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 NewFreightApprovedEventAnnotations ¶ added in v1.4.0
func PatchOwnerReferences ¶ added in v1.4.0
func RefreshAnnotationValue ¶ added in v1.4.0
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 ¶ added in v1.6.0
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 RefreshProjectConfig ¶ added in v1.6.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
func ReverifyAnnotationValue ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 ToVersionProto ¶ added in v1.4.0
func ToVersionProto(v version.Version) *svcv1alpha1.VersionInfo
Types ¶
type ListWarehouseFreightOptions ¶ added in v1.4.0
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 }
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