Skip to content

Commit

Permalink
fix k8sapi volume check
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiong.lj committed Aug 5, 2020
1 parent 57bdaaf commit f892611
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions workflow/common/util.go
Expand Up @@ -39,6 +39,8 @@ func FindOverlappingVolume(tmpl *wfv1.Template, path string) *apiv1.VolumeMount
volMounts = tmpl.Container.VolumeMounts
} else if tmpl.Script != nil {
volMounts = tmpl.Script.VolumeMounts
} else if tmpl.DAG != nil {
return
} else {
return nil
}
Expand Down
8 changes: 6 additions & 2 deletions workflow/validate/validate.go
Expand Up @@ -1012,7 +1012,9 @@ func (ctx *templateValidationCtx) validateBaseImageOutputs(tmpl *wfv1.Template)
errMsg := fmt.Sprintf("%s executor does not support outputs from base image layer. must use emptyDir", ctx.ContainerRuntimeExecutor)
for _, out := range tmpl.Outputs.Artifacts {
if common.FindOverlappingVolume(tmpl, out.Path) == nil {
return errors.Errorf(errors.CodeBadRequest, "templates.%s.outputs.artifacts.%s: %s", tmpl.Name, out.Name, errMsg)
if tmpl.Container != nil || tmpl.Script != nil {
return errors.Errorf(errors.CodeBadRequest, "templates.%s.outputs.artifacts.%s: %s", tmpl.Name, out.Name, errMsg)
}
}
}
for _, out := range tmpl.Outputs.Parameters {
Expand All @@ -1021,7 +1023,9 @@ func (ctx *templateValidationCtx) validateBaseImageOutputs(tmpl *wfv1.Template)
}
if out.ValueFrom.Path != "" {
if common.FindOverlappingVolume(tmpl, out.ValueFrom.Path) == nil {
return errors.Errorf(errors.CodeBadRequest, "templates.%s.outputs.parameters.%s: %s", tmpl.Name, out.Name, errMsg)
if tmpl.Container != nil || tmpl.Script != nil {
return errors.Errorf(errors.CodeBadRequest, "templates.%s.outputs.parameters.%s: %s", tmpl.Name, out.Name, errMsg)
}
}
}
}
Expand Down

0 comments on commit f892611

Please sign in to comment.