-
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: 4 comments
-
This approach seems to work, but seems rather convoluted in comparison:
|
Beta Was this translation helpful? Give feedback.
-
Instead of embedding Oh, I see, you're embedding two trees that have distinct branches partway down. |
Beta Was this translation helpful? Give feedback.
-
AFAICT this is actually working as intended. The reason is that the
gives:
Therefore when
which |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#893. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
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 toComponent.objects.ConfigMap
, hence we see the following (using0070bb10
):gives: