argoproj / argoproj/argo-workflows

Unable to create workflow via argo workflow api client

Open
#9,705 3 comments 0 reactions 0 assignees View on GitHub
P3
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 15h
Merged PRs (30d)
138

Description

### Pre-requisites

- [X] I have double-checked my configuration
- [X] I can confirm the issues exists when I tested with `:latest`
- [X] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/master/docs/CONTRIBUTING.md))

### What happened/what you expected to happen?

I'm creating an argo workflow via api client in golang.
`params := workflow.WorkflowCreateRequest{
Namespace: "ci-test",
Workflow: &wf,
}
`
`_, err = cli.wfclient.CreateWorkflow(ctx, ¶ms)`
and my wf is mentioned below in json format
`{
"kind": "Workflow",
"apiVersion": "argoproj.io/v1alpha1",
"metadata": {
"name": "e-ppsc-test",
"namespace": "ci-test"
},
"spec": {
"templates": [
{
"name": "entrypoint",
"inputs": {},
"outputs": {},
"metadata": {},
"steps": [
[
{
"name": "clone-repo",
"arguments": {
"parameters": [
{
"name": "revision",
"value": "{{parameters.stash-project-name}}"
}
]
},
"templateRef": {
"name": "git-clone",
"template": "git-clone",
"clusterScope": true
}
}
]
]
}
],
"entrypoint": "entrypoint",
"arguments": {
"parameters": [{ "name": "revision", "value": "master" }]
},
"volumeClaimTemplates": [
{
"metadata": { "name": "workdir", "creationTimestamp": null },
"spec": {
"accessModes": ["ReadWriteOnce"],
"resources": { "requests": { "storage": "2Gi" } }
},
"status": {}
}
],
"onExit": "exit-handler"
},
"status": { "startedAt": null, "finishedAt": null }
}
`
While printing the params I'm getting the error **%!v(PANIC=String method: reflect.Value.Bytes of non-byte slice)** and workflow is not creating
When I remove the templates and VolumeClaimTemplates fields from the wf struct the above error was gone.
Am I missing something in the workflow struct? How to resolve this error?

### Version

latest

### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

```YAML
`params := workflow.WorkflowCreateRequest{
Namespace: "ci-test",
Workflow: &wf,
}
`
`_, err = cli.wfclient.CreateWorkflow(ctx, ¶ms)`
```

### Logs from the workflow controller

kubectl logs -n argo deploy/workflow-controller | grep ${workflow}

### Logs from in your workflow's wait container

kubectl logs -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded

Contributor guide

Open the contributing guide

Research direction

Start at the Go workflow.WorkflowCreateRequest and CreateWorkflow entry points, then reproduce the request with templates and volumeClaimTemplates present. Inspect where the parameter is formatted or serialized and compare it with a request that omits those fields. Done means the API client can create the supplied workflow without the reflect.Value.Bytes panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.