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

cmd/cue: cmd exec.Run runner of kind "XXX" not found with k8s resources #1061

Closed
cueckoo opened this issue Jul 3, 2021 · 6 comments
Closed

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @b4nst in cuelang/cue#1061

What version of CUE are you using (cue version)?

$ cue version
cue version v0.4.0 darwin/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

I'm still trying to cut down my module in order to send something short that reproduces my issue.

command: deploy: {
	apply: exec.Run & {
		r:                  release.#Release
		stdin: r.output
		cmd:   "cat"
	}
}

r.output being a string generated by a yaml.MarshalStream of a list in release.#Release. This list contains Kubernetes definitions.

I've noticed that if I use yaml.Marshal(single-resource) it works. It does not work with a list comprehension + strings.Join (same error)
The command works if I replace exec.Run by cli.Print with proper changes (stdin --> text, remove cmd)

What did you expect to see?

Command executed with sucess (prints r.output content)

What did you see instead?

Prints r.output content then exit with error

runner of kind "XXX" not found

XXX being the kind value of the first resource displayed (e.g. Deployment)

@myitcv myitcv added the Triage Requires triage/attention label Jul 15, 2021
@myitcv myitcv added CannotReproduce and removed NeedsInvestigation Triage Requires triage/attention labels Jul 29, 2021
@myitcv myitcv changed the title exec.Run runner of kind "XXX" not found with k8s resources cmd/cue: cmd exec.Run runner of kind "XXX" not found with k8s resources Jul 29, 2021
@myitcv
Copy link
Member

myitcv commented Jul 29, 2021

Apologies for the delay in getting back to you, @b4nst we were busy with the migration (#1078)!

We're going to need a bit more to go on here. Have you had any luck reproducing this?

If you have a large repro that's fine. If it's private, happy to reduce and discuss offline.

@b4nst
Copy link

b4nst commented Jul 29, 2021

I can't remember exactly what was the issue, but it seems I fixed it. I remember that for some reason, adding a nested level in the command for task seemed to work better (command: deploy: task: apply instead of command: deploy: apply).

I think we can close this one since I ended up achieving my goals by cleaning my code. I strongly suspect PEBAK on this one. I can reopen it if I achieve to reproduce it. Thanks for your answer, and don't worry for the delay!

@myitcv
Copy link
Member

myitcv commented Jul 29, 2021

Thanks for the quick follow up, @b4nst!

@myitcv myitcv closed this as completed Jul 29, 2021
@astraios
Copy link

Hey, I'm afraid I'm facing the same issue in a very similar context.

I'm attaching a small public repo with a reproducible example: https://github.com/astraios/cuelangfoo

Each time you run cue build, it will fail because of:

cue build
runner of kind "ServiceAccount" not found

@eonpatapon
Copy link
Contributor

@astraios In your example you are passing a k8s resource, not an actual cue task

The thing is cue determines something is a task by looking a some particular attribute $id, but also for historic reasons kind. Since your k8s resource has a kind field it thinks it is a task and tries to run go code associated with it. Obviously this code doesn't exists.

https://github.com/cuelang/cue/blob/master/cmd/cue/cmd/custom.go#L168

@astraios
Copy link

OIC, thanks for that insight. I had a look at that file yesterday, but the fact that I was trying to turn my "Release" structure into an actual cue "task" completely escaped me. With the following approach it works!!!

command: build: {
	// Write manifests
	task: writeManifest: file.Create & {
		filename: "manifests.yaml"
		contents: yaml.Marshal(foo.Release.manifests.default.ServiceAccount."test-sa")
	}
}

My original idea was to have a "variable" I could work with in tasks. I guess my approach is not a correct one...
Thanks for the help!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants