Skip to content
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

Implement writing to Context #231

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Conversation

ytsarev
Copy link
Contributor

@ytsarev ytsarev commented Jan 16, 2025

Description of your changes

  • Implement writing to Context
  • Support previous Context merging
  • Match with common function layout
  • Add example for render

Testing

  • Unit
go test -v -cover .
...
    --- PASS: TestRunFunctionSimple/MergeContext (0.00s)
...
    --- PASS: TestRunFunctionSimple/SetContext (0.00s)
...
  • Render test
go run . --insecure --debug
...
cd examples/default/context
make
crossplane render --verbose xr.yaml composition.yaml functions.yaml -rc
2025-01-16T16:24:06+01:00	DEBUG	Starting development runtime. Remember to run the function manually.	{"function": "kcl-function", "target": "localhost:9443"}
---
apiVersion: example.crossplane.io/v1beta1
kind: XR
metadata:
  name: example
status:
  conditions:
  - lastTransitionTime: "2024-01-01T00:00:00Z"
    reason: Available
    status: "True"
    type: Ready
---
apiVersion: render.crossplane.io/v1beta1
fields:
  contextField: contextValue <-- Expected context data was properly written
  moreComplexField:
    test: field
kind: Context

Fixes #134

I have:

Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
Copy link
Collaborator

@Peefy Peefy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing Job! LGTM!

@Peefy Peefy merged commit e67112c into crossplane-contrib:main Jan 16, 2025
7 checks passed
@ytsarev ytsarev deleted the write-to-context branch January 17, 2025 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support writing to Context
2 participants