Documentation Issue
Quick disclaimer: I am unsure whether this is about missing documentation, a bug or a mistake on my end.
While getting to know kro I stumbled upon its use of CEL Expressions and I am wondering, how powerful they make kro. Especially whether you could use .map(x,t) to create mixed type list and map literal values.
I tried using a list of strings of keys of a secret that is already deployed on my cluster to provide those secrets to a deployment:
# spec.schema...
deployment:
secretName: string | default="my-secret"
secretNames: '[]string | default=["SECRET_1","SECRET_2"]'
# resources...
env: '${schema.spec.deployment.secretNames.map(s, { "name": s, "valueFrom": { "secretKeyRef": { "name": schema.spec.deployment.secretName, "key": s } } } ) }'
# goal (deployment)
env:
- name: SECRET_1
valueFrom:
secretKeyRef:
name: my-secret
key: SECRET_1
- name: SECRET_2
valueFrom:
secretKeyRef:
name: my-secret
key: SECRET_2
However this results in the following error in the logs of the kro operator:
I was able to apply a RGD that contains the provided snippet and as far as I understand, it passed RGD validation, since it had State: Active.
However the instance had State: ERROR and Ready:Unknown without a clear error message, only Reason: Awaiting Reconciliation and I found this error in the logs of the kro controller:
ERROR dynamic-controller Error syncing item, requeuing with rate limit {"item": {"name":"api-kro-instance","namespace":"demo-test"}, "error": "failed to add resource to applyset: object {apps/v1, Kind=Deployment /api-kro} is not json marshallable: json: error calling MarshalJSON for type applyset.ApplyableObject: json: unsupported type: map[ref.Val]ref.Val"}
I also confirmed that it is a valid CEL Expression in a CEL-Playground that allows heterogeneous aggregates
According to the Kubernetes doc k8s itself is configured to not allow heterogeneous aggregates, but since kro handles CEL Expressions differently than k8s, I could imagine there being a difference.
So at the end of the day I am wondering, whether this is a bug or not the intended use of CEL Expressions with kro.
Location:
https://kro.run/docs/concepts/rgd/cel-expressions#available-cel-libraries
Current State:
For the complete CEL language reference, see the CEL language definitions.
Suggested Changes:
Some information about HomogeneousAggregateLiterals: Whether and how to use them with kro.
Additional Context:
This is where the conversion to the go native types is in the code, that then are used for marshalling (I think), which seems right to me, but my experience with go is very limited: kro/pkg/cel/conversions.go
Documentation Issue
Quick disclaimer: I am unsure whether this is about missing documentation, a bug or a mistake on my end.
While getting to know kro I stumbled upon its use of CEL Expressions and I am wondering, how powerful they make kro. Especially whether you could use
.map(x,t)to create mixed type list and map literal values.I tried using a list of strings of keys of a secret that is already deployed on my cluster to provide those secrets to a deployment:
However this results in the following error in the logs of the kro operator:
I was able to apply a RGD that contains the provided snippet and as far as I understand, it passed RGD validation, since it had
State: Active.However the instance had
State: ERRORandReady:Unknownwithout a clear error message, onlyReason: Awaiting Reconciliationand I found this error in the logs of the kro controller:I also confirmed that it is a valid CEL Expression in a CEL-Playground that allows heterogeneous aggregates
According to the Kubernetes doc k8s itself is configured to not allow heterogeneous aggregates, but since kro handles CEL Expressions differently than k8s, I could imagine there being a difference.
So at the end of the day I am wondering, whether this is a bug or not the intended use of CEL Expressions with kro.
Location:
https://kro.run/docs/concepts/rgd/cel-expressions#available-cel-libraries
Current State:
For the complete CEL language reference, see the CEL language definitions.
Suggested Changes:
Some information about HomogeneousAggregateLiterals: Whether and how to use them with kro.
Additional Context:
This is where the conversion to the go native types is in the code, that then are used for marshalling (I think), which seems right to me, but my experience with go is very limited: kro/pkg/cel/conversions.go