-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: (cluster) Promotion tasks #3121
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
01b118d
feat(api): add `PromotionTask` kind
hiddeco c4ec253
chore: run codegen
hiddeco a2b05ca
feat(api): add `ClusterPromotionTask`
hiddeco 8bf98a8
chore: run codegen
hiddeco bd6ffab
feat(api): add `Task` field to `PromotionStep`
hiddeco 18cf89f
chore: run codegen
hiddeco 2845b7f
feat(api): add validation rules for Promotion steps
hiddeco 35b2552
chore: run codegen
hiddeco 2563b9f
feat(api): allow `Inputs` config on `PromotionStep`
hiddeco e34147d
chore: run codegen
hiddeco bf087e5
fix(api): register new kinds
hiddeco 722a6a6
feat(kargo): introduce `PromotionBuilder`
hiddeco 023465f
chore: fix broken tests
hiddeco a3702c7
fix(api): make PromotionStep input field a list
hiddeco 65cf54d
chore: run codegen
hiddeco 1510b7b
chore(directives): wire inputs into engine
hiddeco 72d06cb
feat(directives): add `compose-output` directive
hiddeco 87631dd
chore(api): `Inputs` -> `Vars`
hiddeco 478ca82
chore: run codegen
hiddeco 32dcabe
chore(directives): implement step-level vars
hiddeco d502374
feat(directives): filter output for "namespaced" keys
hiddeco 82daebe
fix(ui): type issue, vars cannot be optional
hiddeco b46b1fd
WIP: magically write output of "namespaced" steps to namespace
hiddeco 5c1422d
feat(chart): add base permissions `(Cluster)PromotionTask`
hiddeco 9ee906a
fix(api): use correct struct for list
hiddeco 97cb4e6
fix: small bug fixes
hiddeco cb1907d
fix: ensure (step) vars can access outputs
hiddeco 8d4cae6
fix: add `task-<num>` to reserved aliases
hiddeco 474288f
fix(chart): allow API permissions to `Cluster)PromotionTask`
hiddeco 18a666d
feat: add validation webhook for PromotionTask
hiddeco 82d629c
chore: run codegen
hiddeco 51fc805
fix(chart): add permissions to kargo-admin role
hiddeco 68d62fe
chore: remove redundant test
hiddeco 0891669
chore: tiny bit of `compose-output` documentation
hiddeco 06720fd
chore: move task inflation to mutating webhook
hiddeco c0f3c90
fix: ensure state is available to var getter
hiddeco ae40450
fix: evaluate step vars and outputs in indexer
hiddeco 911cc13
refactor: improve inflation of task step vars
hiddeco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
// +kubebuilder:resource:scope=Cluster,shortName={clusterpromotask,clusterpromotasks} | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
type ClusterPromotionTask struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
// Spec describes the desired transition of a specific Stage into a specific | ||
// Freight. | ||
// | ||
// +kubebuilder:validation:Required | ||
Spec PromotionTaskSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ClusterPromotionTaskList contains a list of PromotionTasks. | ||
type ClusterPromotionTaskList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
Items []ClusterPromotionTask `json:"items" protobuf:"bytes,2,rep,name=items"` | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +kubebuilder:resource:shortName={promotask,promotasks} | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
type PromotionTask struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
|
||
// Spec describes the composition of a PromotionTask, including the | ||
// variables available to the task and the steps. | ||
// | ||
// +kubebuilder:validation:Required | ||
Spec PromotionTaskSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` | ||
} | ||
|
||
type PromotionTaskSpec struct { | ||
// Vars specifies the variables available to the PromotionTask. The | ||
// values of these variables are the default values that can be | ||
// overridden by the step referencing the task. | ||
Vars []PromotionVariable `json:"vars,omitempty" protobuf:"bytes,1,rep,name=vars"` | ||
// Steps specifies the directives to be executed as part of this | ||
// PromotionTask. The steps as defined here are inflated into a | ||
// Promotion when it is built from a PromotionTemplate. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:items:XValidation:message="PromotionTask step must have uses set and must not reference another task",rule="has(self.uses) && !has(self.task)" | ||
Steps []PromotionStep `json:"steps" protobuf:"bytes,2,rep,name=steps"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// PromotionTaskList contains a list of PromotionTasks. | ||
type PromotionTaskList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | ||
Items []PromotionTask `json:"items" protobuf:"bytes,2,rep,name=items"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I know ClusterPromotionTask is technically accurate, I wonder if we want to term this "GlobalPromotionTask". We already refer to credentials and ServiceAccounts that are to be used in a global capacity as "global" credentials and global serviceaccounts, and this would be along those lines.
The "cluster" is less meaningful since kargo is not really used in a workload cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jessesuen I wonder if I can offer a counterpoint. The "global" things we have now (and I don't love that term) such as credentials and SAs are things incapable of living in a cluster scope. Putting them in designated namespaces is essentially a workaround.
Here, we have the opportunity to handle things in a more conventional manner. When a CRD whose instances will exist in the cluster scope needs to be differentiated from a namespace-scoped counterpart, I think "Cluster____" is a very widely observed convention that people will understand intuitively.