Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition doesn't remove optional properties from mrs when they are removed from xr #5525

Open
jankaacc opened this issue Mar 28, 2024 · 3 comments
Labels
bug Something isn't working composition

Comments

@jankaacc
Copy link

jankaacc commented Mar 28, 2024

What happened?

we did updated to 1.15.0 with server side apply flag, everything works nicley, xrs are well synced but removal of optional property is not synced to underlying composition

How can we reproduce it?

we have our claim with some optional properties. If I have some optional property on claim:

apiVersion: my.api
kind: myKind
...
spec:
 optional: smt
 mandatory: smt

then XR

apiVersion: my.api
kind: xMyKind
...
spec:
 optional: smt
 mandatory: smt

I am removing optional, now after 1.15.0 everything is nicley synced on XR:

apiVersion: my.api
kind: xMyKind
...
spec:
 mandatory: smt

but in my composition lets say I am forwarding spec.optional to some MR:

    - name: my-mr
      base:
        apiVersion: apr.version/v1alpha1
        kind: someMR
        spec:
          forProvider:
            mandatory:  # patched
            optional:  # patched
      patches:
        - fromFieldPath: spec.mandatory
          toFieldPath: spec.mandatory
        - fromFieldPath: spec.optional
          toFieldPath: spec.optional

now If I am removing optional from claim it is reomved from xr but it is not removed from mr .

we have solution for this, just adding default values in the composition:

- name: my-mr
    base:
      apiVersion: apr.version/v1alpha1
      kind: someMR
      spec:
        forProvider:
          mandatory:  # patched
          optional: "default"
    patches:
      - fromFieldPath: spec.mandatory
        toFieldPath: spec.mandatory
      - fromFieldPath: spec.optional
        toFieldPath: spec.optional

so it can be done like this at least in our case but I guess problem exists

What environment did it happen in?

Crossplane version:

Corssplane 1.15.0

@jankaacc jankaacc added the bug Something isn't working label Mar 28, 2024
@negz
Copy link
Member

negz commented Mar 28, 2024

now If I am removing optional from claim it is reomved from xr but it is not removed from mr .

Are you using composition functions, or native P&T, in your Composition?

The --enable-ssa-claims flag causes Crossplane to use SSA to sync claim -> XR.

Crossplane only uses SSA to sync XR -> MRs when you use composition functions. Native P&T doesn't use SSA.

@jankaacc
Copy link
Author

I use native P&T

@negz
Copy link
Member

negz commented Mar 29, 2024

@jankaacc I recommend migrating to https://github.com/crossplane-contrib/function-patch-and-transform/. This will get you end-to-end server-side apply.

We probably won't update native P&T to use server-side apply, because we're likely to deprecate it per #4746.

@negz negz changed the title comosition don't remove optional properties from mrs when they are removed from xr Composition doesn't remove optional properties from mrs when they are removed from xr Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working composition
Projects
None yet
Development

No branches or pull requests

2 participants