-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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(controller): Add podMetadata field to workflow spec. Resolves #4985 #5031
feat(controller): Add podMetadata field to workflow spec. Resolves #4985 #5031
Conversation
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
workflow/controller/workflowpod.go
Outdated
@@ -615,6 +615,14 @@ func isResourcesSpecified(ctr *apiv1.Container) bool { | |||
|
|||
// addMetadata applies metadata specified in the template | |||
func (woc *wfOperationCtx) addMetadata(pod *apiv1.Pod, tmpl *wfv1.Template, opts *createWorkflowPodOpts) { | |||
// inherit workflow annotations and labels | |||
for k, v := range woc.wf.ObjectMeta.Annotations { |
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.
I'm not sure we just want to copy the workflows annotations and labels to the pods. Instead, perhaps a new spec.podMetadata field might be better - @jessesuen ?
workflow/controller/workflowpod.go
Outdated
@@ -615,6 +615,14 @@ func isResourcesSpecified(ctr *apiv1.Container) bool { | |||
|
|||
// addMetadata applies metadata specified in the template | |||
func (woc *wfOperationCtx) addMetadata(pod *apiv1.Pod, tmpl *wfv1.Template, opts *createWorkflowPodOpts) { | |||
// inherit workflow annotations and labels | |||
for k, v := range woc.wf.ObjectMeta.Annotations { | |||
pod.ObjectMeta.Annotations[k] = v |
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.
I agree that we probably don't want to inherit directly as we don't know for sure whether to apply the same set of annotations/labels. Perhaps we could add something similar to podSpecPatch, e.g. podMetadataPatch.
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
@alexec @terrytangyuan Makes sense; I've added a podMetadata field to the workflow spec. I have a couple of questions though:
|
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
@@ -351,6 +351,9 @@ type WorkflowSpec struct { | |||
|
|||
// RetryStrategy for all templates in the workflow. | |||
RetryStrategy *RetryStrategy `json:"retryStrategy,omitempty" protobuf:"bytes,37,opt,name=retryStrategy"` | |||
|
|||
// PodMetadata defines additional metadata that should be applied to workflow pods | |||
PodMetadata Metadata `json:"podMetadata,omitempty" protobuf:"bytes,38,opt,name=podMetadata"` |
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.
should be pointer 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.
Thanks!
Codegen issue above was because I wasn't working within the gopath. Working now. |
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
@alexec This should be ready for another look |
Please sync with master. |
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.
Please resolve conflicts.
@alexec Conflicts resolved |
LGTM |
Closes #4985
Checklist: