-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Description
Observed Behavior: In versions 0.6.+ and 0.7.0, getting the type check error --
failed to validate node "rttest": failed to type-check template expression "has(schema.spec.dummytest) ? schema.spec.dummytest.dummya : dummyRef.spec[0].fieldblist" at path "spec.references": ERROR: :1:28: found no matching overload for '?:_' applied to '(bool, list(__type_schema.spec.dummytest.dummya.@idx), list([email protected].@idx))'
In kro version 0.5.1, it works correctly.
Reproduction Steps :
Here is my test RGD
apiVersion: kro.run/v1alpha1
kind: ResourceGraphDefinition
metadata:
name: test-dummy
spec:
schema:
apiVersion: v1
kind: TestApp
spec:
name: string
dummytest:
dummya: '[]Custom'
types:
Custom:
subfieldstr: string
subfieldint: integer
resources:
- id: dummyRef
externalRef:
apiVersion: kro.bug/v1
kind: Dummy
metadata:
name: dummycr
namespace: test
- id: rttest
template:
apiVersion: kro.bug/v1
kind: Resourcetemplate
metadata:
name: test-rt
namespace: test
spec:
references: "${has(schema.spec.dummytest) ?
schema.spec.dummytest.dummya : dummyRef.spec[0].fieldblist}"
Here are the test CRDs
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: dummies.kro.bug
spec:
conversion:
strategy: None
group: kro.bug
names:
kind: Dummy
listKind: DummyList
plural: dummies
shortNames:
- dummy
singular: dummy
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
items:
properties:
name:
description: Name
type: string
fieldaint:
description: Field a
type: integer
fieldblist:
description: Field b
items:
properties:
subfieldstr:
description: Subfield 1
type: string
subfieldint:
description: Subfield 2
type: integer
required:
- subfieldstr
- subfieldint
type: object
type: array
required:
- name
- fieldaint
- fieldblist
type: object
type: array
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: resourcetemplates.kro.bug
spec:
conversion:
strategy: None
group: kro.bug
names:
kind: Resourcetemplate
listKind: ResourcetemplateList
plural: resourcetemplates
shortNames:
- resourcetemplate
singular: resourcetemplate
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
properties:
references:
items:
properties:
subfieldstr:
description: Subfield 1
type: string
subfieldint:
description: Subfield 2
type: integer
required:
- subfieldstr
- subfieldint
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
Here are my test resources
apiVersion: kro.bug/v1
kind: Dummy
metadata:
name: dummycr
namespace: test
spec:
- name: item1
fieldaint: 1
fieldblist:
- subfieldstr: "First entry"
subfieldint: 1
- subfieldstr: "Second entry"
subfieldint: 2
---
apiVersion: kro.run/v1
kind: TestApp
metadata:
name: testapp-cr
namespace: test
spec:
name: "Test Application CR"
Using v0.5.1, the above TestApp resource successfully creates a Resourcetemplate resource, however the RGD breaks in 0.6.3 as well as 0.7.0.
Versions:
- kro version: 0.7.0, 0.6.+
- Kubernetes Version (
kubectl version): 1.33
Involved Controllers:
- Controller URLs and Versions (if applicable):
Error Logs (if applicable)**:
failed to validate node "rttest": failed to type-check template expression "has(schema.spec.dummytest) ? schema.spec.dummytest.dummya : dummyRef.spec[0].fieldblist" at path "spec.references": ERROR: <input>:1:28: found no matching overload for '_?_:_' applied to '(bool, list(__type_schema.spec.dummytest.dummya.@idx), list([email protected].@idx))'
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Which option describes the most your issue?
ResourceGraphDefinition (Create, Update, Deletion)