-
Notifications
You must be signed in to change notification settings - Fork 690
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
Support overriding task annotations and labels via with_overrides #6171
base: master
Are you sure you want to change the base?
Changes from 1 commit
5f9eb9d
694ffc5
ce8aca8
eeba0e5
2533937
cc9e723
2ada3c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,12 @@ type NodeSpec struct { | |
Interruptible *bool `json:"interruptible,omitempty"` | ||
|
||
ContainerImage string `json:"containerImage,omitempty"` | ||
// If specified, includes overrides for annotations to allocate to the node | ||
//+optional | ||
Annotations map[string]string `json:"annotation,omitempty" protobuf:"bytes,22,opt,name=annotation"` | ||
// If specified, includes overrides for labels to allocate to the node | ||
//+optional | ||
Labels map[string]string `json:"label,omitempty" protobuf:"bytes,22,opt,name=label"` | ||
Comment on lines
+164
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate protobuf field numbers need updating
Consider updating the protobuf field numbers for Code suggestionCheck the AI-generated fix before applying
Code Review Run #d2a6a3 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||
} | ||
|
||
func (in *NodeSpec) GetName() string { | ||
|
@@ -268,3 +274,11 @@ func (in *NodeSpec) GetInputBindings() []*Binding { | |
func (in *NodeSpec) GetContainerImage() string { | ||
return in.ContainerImage | ||
} | ||
|
||
func (in *NodeSpec) GetAnnotations() map[string]string { | ||
return in.Annotations | ||
} | ||
|
||
func (in *NodeSpec) GetLabels() map[string]string { | ||
return in.Labels | ||
} | ||
Comment on lines
+278
to
+284
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding nil check for maps
Consider adding validation for
Code suggestionCheck the AI-generated fix before applying
Code Review Run #d2a6a3 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,6 +31,8 @@ func buildNodeSpec(n *core.Node, tasks []*core.CompiledTask, errs errors.Compile | |||||||||||||||||||||||||||||||
var resources *core.Resources | ||||||||||||||||||||||||||||||||
var extendedResources *v1alpha1.ExtendedResources | ||||||||||||||||||||||||||||||||
var containerImage string | ||||||||||||||||||||||||||||||||
var annotations map[string]string | ||||||||||||||||||||||||||||||||
var labels map[string]string | ||||||||||||||||||||||||||||||||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider initializing maps with make()
Consider initializing the maps Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #d2a6a3 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||||||||||||||||||||||||||||||||
if n.GetTaskNode() != nil { | ||||||||||||||||||||||||||||||||
taskID := n.GetTaskNode().GetReferenceId().String() | ||||||||||||||||||||||||||||||||
// TODO: Use task index for quick lookup | ||||||||||||||||||||||||||||||||
|
@@ -60,6 +62,14 @@ func buildNodeSpec(n *core.Node, tasks []*core.CompiledTask, errs errors.Compile | |||||||||||||||||||||||||||||||
if len(overrides.GetContainerImage()) > 0 { | ||||||||||||||||||||||||||||||||
containerImage = overrides.GetContainerImage() | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
if overrides.GetAnnotations() != nil { | ||||||||||||||||||||||||||||||||
annotations = overrides.GetAnnotations() | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
if overrides.GetLabels() != nil { | ||||||||||||||||||||||||||||||||
labels = overrides.GetLabels() | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
Comment on lines
+66
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider consolidating override handling logic
Consider combining the annotation and label override checks into a single function to improve code organization and reusability. The current implementation has similar logic repeated for both annotations and labels. Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #d2a6a3 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
@@ -102,6 +112,8 @@ func buildNodeSpec(n *core.Node, tasks []*core.CompiledTask, errs errors.Compile | |||||||||||||||||||||||||||||||
ActiveDeadline: activeDeadline, | ||||||||||||||||||||||||||||||||
Interruptible: interruptible, | ||||||||||||||||||||||||||||||||
ContainerImage: containerImage, | ||||||||||||||||||||||||||||||||
Annotations: annotations, | ||||||||||||||||||||||||||||||||
Labels: labels, | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
switch v := n.GetTarget().(type) { | ||||||||||||||||||||||||||||||||
|
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.
Consider consolidating the
GetAnnotations()
andGetLabels()
methods since they already exist in theMeta
interface. This appears to be semantic duplication.Code suggestion
Code Review Run #d2a6a3
Is this a valid issue, or was it incorrectly flagged by the Agent?