diff --git a/.golangci.yml b/.golangci.yml index 1fd5806..5421bc0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,7 +38,7 @@ linters-settings: - default - prefix(github.com/crossplane/crossplane-runtime) - prefix(github.com/crossplane/function-sdk-go) - - prefix(github.com/crossplane-contrib/function-patch-and-transform) + - prefix(github.com/stevendborrelli/function-conditional-patch-and-transform) - blank - dot diff --git a/README.md b/README.md index 73d1bcf..23b0aeb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -# function-patch-and-transform -[![CI](https://github.com/crossplane-contrib/function-patch-and-transform/actions/workflows/ci.yml/badge.svg)](https://github.com/crossplane-contrib/function-patch-and-transform/actions/workflows/ci.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/release/crossplane-contrib/function-patch-and-transform) +# function-conditional-patch-and-transform +[![CI](https://github.com/stevendborrelli/function-conditional-patch-and-transform/actions/workflows/ci.yml/badge.svg)](https://github.com/stevendborrelli/function-conditional-patch-and-transform/actions/workflows/ci.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/release/crossplane-contrib/function-conditional-patch-and-transform) + +This composition function is a fork of the upstream [function-patch-and-transform](https://github.com/crossplane-contrib/function-patch-and-transform) +that adds support for Conditional invocation of the function and the rendering +of individual resources. This [composition function][docs-functions] does everything Crossplane's built-in [patch & transform][docs-pandt] (P&T) composition does. Instead of @@ -18,7 +22,7 @@ spec: pipeline: - step: patch-and-transform functionRef: - name: function-patch-and-transform + name: function-conditional-patch-and-transform input: apiVersion: pt.fn.crossplane.io/v1beta1 kind: Resources @@ -152,7 +156,7 @@ $ crossplane xpkg build -f package --embed-runtime-image=runtime [docs-composition]: https://docs.crossplane.io/v1.14/getting-started/provider-aws-part-2/#create-a-deployment-template [docs-functions]: https://docs.crossplane.io/v1.14/concepts/composition-functions/ [docs-pandt]: https://docs.crossplane.io/v1.14/concepts/patch-and-transform/ -[fn-go-templating]: https://github.com/crossplane-contrib/function-go-templating +[fn-go-templating]: https://github.com/stevendborrelli/function-go-templating [#4617]: https://github.com/crossplane/crossplane/issues/4617 [#4746]: https://github.com/crossplane/crossplane/issues/4746 [go]: https://go.dev diff --git a/condition.go b/condition.go index a6c5587..e9cb10b 100644 --- a/condition.go +++ b/condition.go @@ -3,10 +3,10 @@ package main import ( "reflect" - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" "github.com/crossplane/crossplane-runtime/pkg/errors" fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" "github.com/google/cel-go/cel" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" ) // NewCELEnvironment sets up the CEL Environment diff --git a/condition_test.go b/condition_test.go index 7fec9e8..21cbb8a 100644 --- a/condition_test.go +++ b/condition_test.go @@ -4,11 +4,11 @@ import ( "strings" "testing" - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" "github.com/crossplane/crossplane-runtime/pkg/errors" fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" "github.com/crossplane/function-sdk-go/resource" "github.com/google/go-cmp/cmp" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/connection.go b/connection.go index 814efbd..aff5f9b 100644 --- a/connection.go +++ b/connection.go @@ -1,11 +1,11 @@ package main import ( - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/fieldpath" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/json" ) diff --git a/example/composition.yaml b/example/composition.yaml index 2c73250..3bd9d2e 100644 --- a/example/composition.yaml +++ b/example/composition.yaml @@ -1,7 +1,7 @@ apiVersion: apiextensions.crossplane.io/v1 kind: Composition metadata: - name: function-patch-and-transform + name: function-conditional-patch-and-transform spec: compositeTypeRef: apiVersion: example.crossplane.io/v1 @@ -10,7 +10,7 @@ spec: pipeline: - step: patch-and-transform functionRef: - name: function-patch-and-transform + name: function-conditional-patch-and-transform input: apiVersion: pt.fn.crossplane.io/v1beta1 kind: Resources diff --git a/package/crossplane.yaml b/package/crossplane.yaml index 866d2d3..48215e0 100644 --- a/package/crossplane.yaml +++ b/package/crossplane.yaml @@ -2,17 +2,17 @@ apiVersion: meta.pkg.crossplane.io/v1beta1 kind: Function metadata: - name: function-patch-and-transform + name: function-conditional-patch-and-transform annotations: meta.crossplane.io/maintainer: Crossplane Maintainers - meta.crossplane.io/source: github.com/crossplane-contrib/function-patch-and-transform + meta.crossplane.io/source: github.com/stevendborrelli/function-conditional-patch-and-transform meta.crossplane.io/license: Apache-2.0 - meta.crossplane.io/description: A patch & transform composition function + meta.crossplane.io/description: A patch & transform composition function that supports conditionals meta.crossplane.io/readme: | - This composition function does everything Crossplane's built-in - [patch & transform](https://docs.crossplane.io/latest/concepts/patch-and-transform/) - composition does. Instead of specifying `spec.resources` in your - Composition, you can use this function. See the - [README](https://github.com/crossplane-contrib/function-patch-and-transform) + This composition function is a fork of the upstream [function-patch-and-transform](https://github.com/crossplane-contrib/function-patch-and-transform) + that adds support for Conditional invocation of the function and the rendering + of individual resources. + See the + [README](https://github.com/stevendborrelli/function-conditional-patch-and-transform) for examples and documentation. spec: {} diff --git a/patches.go b/patches.go index 6ed99d1..e84883a 100644 --- a/patches.go +++ b/patches.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" "github.com/crossplane/crossplane-runtime/pkg/fieldpath" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/pkg/errors" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/ready.go b/ready.go index 53d69bd..90d8ece 100644 --- a/ready.go +++ b/ready.go @@ -3,11 +3,11 @@ package main import ( "context" - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/fieldpath" "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" ) // Error strings diff --git a/render.go b/render.go index 7dcf480..8498d22 100644 --- a/render.go +++ b/render.go @@ -1,9 +1,9 @@ package main import ( - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/validate.go b/validate.go index 0b32e5e..4efd7df 100644 --- a/validate.go +++ b/validate.go @@ -4,7 +4,7 @@ import ( "fmt" "regexp" - "github.com/crossplane-contrib/function-patch-and-transform/input/v1beta1" + "github.com/stevendborrelli/function-conditional-patch-and-transform/input/v1beta1" "k8s.io/apimachinery/pkg/util/validation/field" )