-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Can an entire resource be a valid binding value? #1897
Comments
Not sure I understand the question. The You can either use a script with an |
OK, thank you for clarifying, I wasn't sure if this was valid or not.
Should I be able to assert directly against the binding?
I could not find any docs or description or even code for the I will give So now the question has become: how do I assert against the values of an object that is assigned to a binding? |
You are missing my point,
Yeah, our docs for functions are not good, i would love to do better and should try to push that to the jp lib. |
Unfortunately i have no experience with crossplane but let me know if i can help with the syntax. |
Aha, I think this is the assumption that was tripping me up. On the binding side, this is where spec:
steps:
- bindings:
- name: boundResource
value: (x_k8s_get(...))
try:
- description: Assert that two different resources are in the same namespace.
assert:
resource:
apiVersion: something/v1
kind: Something
metadata:
(namespace == $boundResource.namespace): true
Thanks! I will try and play with |
I just created PR #1915 which adds an example using |
Describe your question
Hello, and thank you for Chainsaw! It's powerful and has loads of potential.
I've been starting to use it for some assertions, to make sure that our Crossplane resources pass muster.
Question: Is it possible/viable to bind an entire resource, for later reference in an assertion?
These are the relevant lines from my
chainsaw-test.yaml
file:When I add
xrd
in thebindings
list and give thevalue
as aresource
object, Chainsaw doesn't seem to have any issues with that syntax.I could absolutely see this part being a gap in the implementation, though.
If I uncomment the last assertion on the bottom line, I get the below error:
chainsaw version Version
v0.2.8
Additional context
I would like to be able to check the
.spec.compositeTypeRef.apiVersion
field of all relevantComposition
-type resources.I want the version on the end of the
apiVersion
string field to match the version from the XRD that hasreferenceable: true
set.There is #1034 about a
lookup
operation and I thought this could be similar, or maybe the existingget
operation can cover off this use case, and wanted to ask for clarity's sake.More generally, being able to bind (or
lookup
orget
) one or more specific resources and refer to them in assertions against other resources would be fantastic.The text was updated successfully, but these errors were encountered: