generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When using conditional logic to add annotations inside KCL list comprehensions, the syntax if condition: annotation inside an annotations block doesn't work, but moving the
condition outside the annotations block does work. I'm not sure if this is the expected behavior.
Environment
- Crossplane function-kcl version: v0.11.2
- KCL version: v0.11.3
- Crossplane version: v2.0
Current Behavior
This doesn't work - annotation is not added:
_items += [{
metadata = {
annotations = {
if some_condition:
"krm.kcl.dev/ready": "True"
}
}
} for item in items]Working Alternative
This works - annotation is added:
_items += [{
metadata = {
annotations = {
"krm.kcl.dev/ready": "True"
} if some_condition else {}
}
} for item in items]
Questions
- Is this the expected behavior for conditional expressions inside dictionary literals within list comprehensions?
- Should both syntaxes work the same way, or is the second approach the preferred/correct one?
- Is there documentation about the recommended syntax for conditional annotations?
Additional Notes
- Static annotations work fine in list comprehensions
- The conditional logic evaluates correctly - only the annotation assignment differs
- This occurs specifically in list comprehensions; regular conditional blocks work as expected
Any clarification on the expected behavior would be helpful!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working