Skip to content

Commit

Permalink
add freight ref to promotion status after done with validation
Browse files Browse the repository at this point in the history
  • Loading branch information
phuongdnguyen committed Apr 10, 2024
1 parent 30525ce commit 48f6333
Show file tree
Hide file tree
Showing 10 changed files with 1,523 additions and 226 deletions.
475 changes: 265 additions & 210 deletions api/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions api/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions api/v1alpha1/promotion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ func (p *PromotionPhase) IsTerminal() bool {
}
}

//+kubebuilder:resource:shortName={promo,promos}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name=Shard,type=string,JSONPath=`.metadata.labels.kargo\.akuity\.io/shard`
//+kubebuilder:printcolumn:name=Stage,type=string,JSONPath=`.spec.stage`
//+kubebuilder:printcolumn:name=Freight,type=string,JSONPath=`.spec.freight`
//+kubebuilder:printcolumn:name=Phase,type=string,JSONPath=`.status.phase`
//+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:resource:shortName={promo,promos}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name=Shard,type=string,JSONPath=`.metadata.labels.kargo\.akuity\.io/shard`
// +kubebuilder:printcolumn:name=Stage,type=string,JSONPath=`.spec.stage`
// +kubebuilder:printcolumn:name=Freight,type=string,JSONPath=`.spec.freight`
// +kubebuilder:printcolumn:name=Phase,type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`

// Promotion represents a request to transition a particular Stage into a
// particular Freight.
Expand All @@ -55,7 +55,7 @@ type Promotion struct {
// Spec describes the desired transition of a specific Stage into a specific
// Freight.
//
//+kubebuilder:validation:Required
// +kubebuilder:validation:Required
Spec *PromotionSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// Status describes the current state of the transition represented by this
// Promotion.
Expand All @@ -73,13 +73,13 @@ type PromotionSpec struct {
// applies. The Stage referenced by this field MUST be in the same
// namespace as the Promotion.
//
//+kubebuilder:validation:MinLength=1
//+kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
Stage string `json:"stage" protobuf:"bytes,1,opt,name=stage"`
// Freight specifies the piece of Freight to be promoted into the Stage
// referenced by the Stage field.
//
//+kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MinLength=1
Freight string `json:"freight" protobuf:"bytes,2,opt,name=freight"`
}

Expand All @@ -96,6 +96,8 @@ type PromotionStatus struct {
// Metadata holds arbitrary metadata set by promotion mechanisms
// (e.g. for display purposes, or internal bookkeeping)
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,3,rep,name=metadata" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// PromotedFreight is the detail of the piece of freight that was referenced by this promotion.
PromotedFreight *FreightReference `json:"promotedFreight,omitempty" protobuf:"bytes,4,opt,name=promotedFreight"`
}

// WithPhase returns a copy of PromotionStatus with the given phase
Expand All @@ -105,7 +107,7 @@ func (p *PromotionStatus) WithPhase(phase PromotionPhase) *PromotionStatus {
return status
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// PromotionList contains a list of Promotion
type PromotionList struct {
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

206 changes: 206 additions & 0 deletions charts/kargo/resources/crds/kargo.akuity.io_promotions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,212 @@ spec:
description: Phase describes where the Promotion currently is in its
lifecycle.
type: string
promotedFreight:
description: PromotedFreight is the detail of the piece of freight
that was referenced by this promotion.
properties:
charts:
description: Charts describes specific versions of specific Helm
charts.
items:
description: Chart describes a specific version of a Helm chart.
properties:
name:
description: Name specifies the name of the chart.
type: string
repoURL:
description: |-
RepoURL specifies the URL of a Helm chart repository. Classic chart
repositories (using HTTP/S) can contain differently named charts. When this
field points to such a repository, the Name field will specify the name of
the chart within the repository. In the case of a repository within an OCI
registry, the URL implicitly points to a specific chart and the Name field
will be empty.
type: string
version:
description: Version specifies a particular version of the
chart.
type: string
type: object
type: array
commits:
description: Commits describes specific Git repository commits.
items:
description: GitCommit describes a specific commit from a specific
Git repository.
properties:
author:
description: Author is the git commit author
type: string
branch:
description: Branch denotes the branch of the repository
where this commit was found.
type: string
healthCheckCommit:
description: |-
HealthCheckCommit is the ID of a specific commit. When specified,
assessments of Stage health will used this value (instead of ID) when
determining if applicable sources of Argo CD Application resources
associated with the Stage are or are not synced to this commit. Note that
there are cases (as in that of Kargo Render being utilized as a promotion
mechanism) wherein the value of this field may differ from the commit ID
found in the ID field.
type: string
id:
description: |-
ID is the ID of a specific commit in the Git repository specified by
RepoURL.
type: string
message:
description: Message is the git commit message
type: string
repoURL:
description: RepoURL is the URL of a Git repository.
type: string
tag:
description: |-
Tag denotes a tag in the repository that matched selection criteria and
resolved to this commit.
type: string
type: object
type: array
images:
description: Images describes specific versions of specific container
images.
items:
description: Image describes a specific version of a container
image.
properties:
digest:
description: |-
Digest identifies a specific version of the image in the repository
specified by RepoURL. This is a more precise identifier than Tag.
type: string
gitRepoURL:
description: |-
GitRepoURL specifies the URL of a Git repository that contains the source
code for the image repository referenced by the RepoURL field if Kargo was
able to infer it.
type: string
repoURL:
description: RepoURL describes the repository in which the
image can be found.
type: string
tag:
description: |-
Tag identifies a specific version of the image in the repository specified
by RepoURL.
type: string
type: object
type: array
name:
description: |-
Name is system-assigned identifier that is derived deterministically from
the contents of the Freight. i.e. Two pieces of Freight can be compared for
equality by comparing their Names.
type: string
verificationHistory:
description: |-
VerificationHistory is a stack of recent VerificationInfo. By default,
the last ten VerificationInfo are stored.
items:
description: |-
VerificationInfo contains information about the currently running
Verification process.
properties:
analysisRun:
description: |-
AnalysisRun is a reference to the Argo Rollouts AnalysisRun that implements
the Verification process.
properties:
name:
description: Name is the name of the AnalysisRun.
type: string
namespace:
description: Namespace is the namespace of the AnalysisRun.
type: string
phase:
description: Phase is the last observed phase of the
AnalysisRun referenced by Name.
type: string
required:
- name
- namespace
- phase
type: object
id:
description: ID is the identifier of the Verification process.
type: string
message:
description: |-
Message may contain additional information about why the verification
process is in its current phase.
type: string
phase:
description: |-
Phase describes the current phase of the Verification process. Generally,
this will be a reflection of the underlying AnalysisRun's phase, however,
there are exceptions to this, such as in the case where an AnalysisRun
cannot be launched successfully.
type: string
startTime:
description: StartTime is the time at which the Verification
process was started.
format: date-time
type: string
type: object
type: array
verificationInfo:
description: |-
VerificationInfo is information about any verification process that was
associated with this Freight for this Stage.
properties:
analysisRun:
description: |-
AnalysisRun is a reference to the Argo Rollouts AnalysisRun that implements
the Verification process.
properties:
name:
description: Name is the name of the AnalysisRun.
type: string
namespace:
description: Namespace is the namespace of the AnalysisRun.
type: string
phase:
description: Phase is the last observed phase of the AnalysisRun
referenced by Name.
type: string
required:
- name
- namespace
- phase
type: object
id:
description: ID is the identifier of the Verification process.
type: string
message:
description: |-
Message may contain additional information about why the verification
process is in its current phase.
type: string
phase:
description: |-
Phase describes the current phase of the Verification process. Generally,
this will be a reflection of the underlying AnalysisRun's phase, however,
there are exceptions to this, such as in the case where an AnalysisRun
cannot be launched successfully.
type: string
startTime:
description: StartTime is the time at which the Verification
process was started.
format: date-time
type: string
type: object
warehouse:
description: Warehouse is the name of the Warehouse that created
this Freight.
type: string
type: object
type: object
required:
- spec
Expand Down
Loading

0 comments on commit 48f6333

Please sign in to comment.