upbound / function-cidr

Composition Function that transforms CIDRs
Apache License 2.0
3 stars 3 forks source link

Issue with using function-cidr in a pipeline #32

Open anessi opened 1 month ago

anessi commented 1 month ago

I tried to use this function in a minimalistic pipeline using the following snippet (metadata removed):

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
spec:
  mode: Pipeline
  pipeline:
    # https://github.com/upbound/function-cidr/blob/main/package/input/cidr.fn.crossplane.io_parameters.yaml
    # https://github.com/upbound/function-cidr/blob/main/apis/composition.yaml
    - step: cidr-subnets
      functionRef:
        name: function-cidr
      input:
        apiVersion: cidr.fn.crossplane.io/v1beta1
        kind: Parameters
        cidrFunc: cidrsubnets
        prefix: 10.0.0.0/20
        newBits:
          - 1
          - 1
    - step: ready
      functionRef:
        name: function-auto-ready

However I get the following error:

    message: 'cannot compose resources: pipeline step "cidr-subnets" returned a fatal result: invalid Function input: parameters: Required value: cidrFunc is required'

When I run the examples in the repo locally using make render it works fine with Docker.

I'm using version v0.4.0 of function-cidr with crossplane v1.15.2-up.1.

Do you have any idea what is going wrong here?

anessi commented 1 month ago

This issue has been fixed in the referenced PR. Happy to get feedback on this. The function is available at https://marketplace.upbound.io/account/anessi/function-cidr

willjw1 commented 1 week ago

Would love to have this fix merged in and a new version of function-cidr released where I could use this. I tried to click on the above link and it didn't take me anywhere.

anessi commented 1 week ago

@willjw1 : I guess in that case the above link only works after login (did not realize this, sorry). However, you should be able to use:

apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
  name: function-cidr
spec:
  package: xpkg.upbound.io/anessi/function-cidr:v0.5.4

to pull my version. Will look at the comments on the PR today and hopefully this can be merged soon.