crossplane-contrib / function-cue-archived

Cuelang Integration for Crossplane's Composition Function
Apache License 2.0
10 stars 1 forks source link

Would `Export` make sense as the input kind? #49

Open negz opened 1 year ago

negz commented 1 year ago

What problem are you facing?

Looking at the function a little more, I wonder if this would make sense:

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
# Removed for Brevity
spec:
  # Removed for Brevity
  mode: Pipeline
  pipeline:
  - step: cue-export-resources
    functionRef:
      name: function-cue
    input:
      apiVersion: cue.fn.crossplane.io/v1beta1
      kind: Export
      export:
        target: Resources
        value: |
          apiVersion: "s3.aws.upbound.io/v1beta1"
          kind: "Bucket"
          spec: forProvider: {
            region: "us-east-2"
          }

The idea being that the "input" to the CUE function is the export configuration. It seems like the primary field folks are working with is export. This would match function-patch-and-transform where you mostly work with the resources input field, and the kind of the input is Resources in the pt.fn.crossplane.io API group.

This is really just a minor optimization so I could be convinced it's not worth the breaking change.

Mitsuwa commented 1 year ago

I think its a good idea if we eventually move to support other cue commands but I am uncertain when or how much use could be out of supporting something like cue def or cue eval. I feel like eval could be useful for schema validation if/when this project gets that far.