-
Originally opened by @mxey in cuelang/cue#893 I am trying to have Kubernetes objects for a component that can be instantiated multiple times and then emit all the objects to (eventually) pass them to kubectl. This is the CUE code I have, simplified to a minimal reproduction:
When I run CUE, I get conflicts that I find surprising:
It seems like this block is applied by both components to both components:
In this example, there is only a single ConfigMap, but in reality there are multiple ones. I want to use this block to set common labels for all objects of this component. I would like to keep the single |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Original reply by @mxey in cuelang/cue#893 (comment) This approach seems to work, but seems rather convoluted in comparison:
|
Beta Was this translation helpful? Give feedback.
-
Original reply by @seh in cuelang/cue#893 (comment) Instead of embedding Oh, I see, you're embedding two trees that have distinct branches partway down. |
Beta Was this translation helpful? Give feedback.
-
Original reply by @myitcv in cuelang/cue#893 (comment) AFAICT this is actually working as intended. The reason is that the
gives:
Therefore when
which |
Beta Was this translation helpful? Give feedback.
Original reply by @myitcv in cuelang/cue#893 (comment)
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 cuelang/cue#1024, but this does not affect the analysis of this case). Hence it applies toComponent.objects.ConfigMap
, hence we see the following (using0070bb10
):