crossplane-contrib / x-generation

generate compositions from crossplane provider crds
Apache License 2.0
44 stars 18 forks source link

overrideFieldsInClaim: patches not transported to composition if field type is object #33

Open birapjr opened 4 months ago

birapjr commented 4 months ago

What happened?

1- When using overrideFieldsInClaim, with claimPath and managedPath, for fields of type object, the patches section is not been transported to the generated composition. 2- In the generated composition are created patches from the claimPath property to the claimPath property, not respectining the managedPath.

How can we reproduce it?

Use the generate.yaml located at: https://github.com/birapjr/crossplane-issues-examples/tree/main/x-generation-overrideFieldsInClaim-patches-prop-object

The following patches are not transported to the generated composition:

1st. issue:

      patches:
        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.key
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.passwordSecretRef.key
          type: FromCompositeFieldPat
        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.name
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.passwordSecretRef.name
          type: FromCompositeFieldPat
        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.namespace
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.passwordSecretRef.namespace
          type: FromCompositeFieldPat

2nd. issue, not correct patches:

        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.key
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.masterUserPasswordSecretRef.key
          type: FromCompositeFieldPath
        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.name
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.masterUserPasswordSecretRef.name
          type: FromCompositeFieldPath
        - fromFieldPath: spec.forProvider.masterUserPasswordSecretRef.namespace
          policy:
            fromFieldPath: Optional
          toFieldPath: spec.forProvider.masterUserPasswordSecretRef.namespace
          type: FromCompositeFieldPath

What environment did it happen in?

Crossplane version: 1.6.0 x-generation version: 0.10.0