crossplane-contrib / function-patch-and-transform

A patch & transform composition function
https://crossplane.io
Apache License 2.0
23 stars 24 forks source link

Support for `ToEnvironmentFieldPath` patch type in `spec.environment.patches` #123

Closed truongnht closed 3 months ago

truongnht commented 3 months ago

In function-patch-and-transform 0.2.1 we do have support for ToEnvironmentFieldPath, so the following was supported in our composition

        apiVersion: pt.fn.crossplane.io/v1beta1
        kind: Resources
        environment:
          patches:
            - type: ToEnvironmentFieldPath
              fromFieldPath: spec.parameters.serviceAccount.namespace
              toFieldPath: data.serviceAccountNamespace
            - type: ToEnvironmentFieldPath
              fromFieldPath: spec.parameters.serviceAccount.name
              toFieldPath: data.serviceAccountName

However in latest release the ToEnvironmentFieldPath patch type is no longer supported, rather FromCompositeFieldPath. Since our platform supports also customer compositions, it is not easy bringing breaking changes without verifying with all customers. Our ask is to bring back the support for To|FromEnvironmentFieldPath in spec.environment.patches

phisco commented 3 months ago

Aha, I see what happened, when I refactored and properly splitted the patch types I introduced a breaking change inadvertently, as although they should have not been supported, they were actually working before. It could be fine supporting both ways to define those patches, ToEnvironment == FromCompositeFieldPath, FromEnvironment == ToCompositeFieldPath 🤔