Skip to content
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

Merged
merged 14 commits into from
Feb 10, 2021
Merged

feat(controller): Add podMetadata field to workflow spec. Resolves #4985 #5031

merged 14 commits into from
Feb 10, 2021

Conversation

dylanhellems
Copy link
Contributor

@dylanhellems dylanhellems commented Feb 4, 2021

Closes #4985

Checklist:

@CLAassistant
Copy link

CLAassistant commented Feb 4, 2021

CLA assistant check
All committers have signed the CLA.

Signed-off-by: Dylan Hellems <dylanhellems@gmail.com>
@dylanhellems dylanhellems marked this pull request as ready for review February 4, 2021 22:41
@alexec alexec changed the title feat: Pods inherit workflow annotations and labels feat: Pods inherit workflow annotations and labels. Resolves #4985 Feb 5, 2021
@@ -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 {
Copy link
Contributor

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 ?

@@ -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
Copy link
Member

@terrytangyuan terrytangyuan Feb 5, 2021

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>
@dylanhellems dylanhellems changed the title feat: Pods inherit workflow annotations and labels. Resolves #4985 feat: Add podMetadata field to workflow spec. Resolves #4985 Feb 5, 2021
@dylanhellems
Copy link
Contributor Author

dylanhellems commented Feb 5, 2021

@alexec @terrytangyuan Makes sense; I've added a podMetadata field to the workflow spec. I have a couple of questions though:

  1. I had to update the maxWorkflowSize in the packer and hydrator tests. Is that an arbitrary value for testing or are there implications to that change that I'm unaware of? Was due to not using a pointer
  2. I'm having trouble getting codegen working locally. Any thoughts on what may be going wrong? Here is the output I'm seeing: see: feat(controller): Add podMetadata field to workflow spec. Resolves #4985 #5031 (comment)
dylanhellems@Dylans-MBP argo % make codegen                                                        
# protoc pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto
[ -e vendor ] || go mod vendor
protoc -I /usr/local/include -I /Users/dylanhellems/Documents/repos/argo -I /Users/dylanhellems/Documents/repos/argo/vendor -I /Users/dylanhellems/go/src -I /Users/dylanhellems/go/pkg/mod/github.com/gogo/protobuf@v1.3.1/gogoproto -I /Users/dylanhellems/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.16.0/third_party/googleapis --gogofast_out=plugins=grpc:/Users/dylanhellems/go/src --grpc-gateway_out=logtostderr=true:/Users/dylanhellems/go/src --swagger_out=logtostderr=true,fqn_for_swagger_name=true:. pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto
github.com/argoproj/argo/pkg/apis/workflow/v1alpha1/generated.proto: File not found.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:6:1: Import "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1/generated.proto" was not found or had errors.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:15:5: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:31:5: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:41:5: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:46:87: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:53:81: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:57:84: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplateList" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:61:87: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:72:83: "github.com.argoproj.argo.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
make: *** [pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.swagger.json] Error 1

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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be pointer type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dylanhellems
Copy link
Contributor Author

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>
@dylanhellems
Copy link
Contributor Author

@alexec This should be ready for another look

@jessesuen jessesuen removed their assignment Feb 10, 2021
@alexec alexec changed the title feat: Add podMetadata field to workflow spec. Resolves #4985 feat(controller): Add podMetadata field to workflow spec. Resolves #4985 Feb 10, 2021
@alexec
Copy link
Contributor

alexec commented Feb 10, 2021

Please sync with master.

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve conflicts.

@dylanhellems
Copy link
Contributor Author

@alexec Conflicts resolved

@alexec
Copy link
Contributor

alexec commented Feb 10, 2021

LGTM

@alexec alexec merged commit f461b04 into argoproj:master Feb 10, 2021
@simster7 simster7 mentioned this pull request Feb 16, 2021
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default annotations for workflow pods
5 participants