Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Surprising effect of bulk field templates #893

Answered by myitcv
mxey asked this question in Q&A
Discussion options

You must be logged in to vote

AFAICT this is actually working as intended. The reason is that the Component.objects pattern constraint [string]: [string]: metadata: labels applies to existing fields (somewhat related I note the observations in #1024, but this does not affect the analysis of this case). Hence it applies to Component.objects.ConfigMap, hence we see the following (using 0070bb10):

exec cue eval

-- x.cue --
package x

Component: {
	class: string

	objects: {
		ConfigMap: "\(class)-component": {
			kind:       "ConfigMap"
			apiVersion: "v1"
		}
	}

	objects: [string]: [string]: metadata: labels: {
		"class": class
	}
}

a: Component & {class: "a"}
b: Component & {class: "b"}

gives:

...
a: {
    class: "…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mxey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants