karmada icon indicating copy to clipboard operation
karmada copied to clipboard

proposal for overriding values inside structured data files

Open sophiefeifeifeiya opened this issue 1 year ago • 3 comments

What type of PR is this?

/kind design /kind documentation

What this PR does / why we need it: Overriding values in structured data files (e.g., JSON, YAML) to simplify modifications.

Which issue(s) this PR fixes: Fixes #5330

Special notes for your reviewer: Related PR: #5329

Does this PR introduce a user-facing change?:

Introduced `PlaintextObjectOverrider`  for overriding values in YAML or JSON plaintext objects.

sophiefeifeifeiya avatar Aug 28 '24 17:08 sophiefeifeifeiya

Welcome @sophiefeifeifeiya! It looks like this is your first PR to karmada-io/karmada 🎉

karmada-bot avatar Aug 28 '24 17:08 karmada-bot

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 34.85%. Comparing base (5f7fc4f) to head (0682184).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5449   +/-   ##
=======================================
  Coverage   34.84%   34.85%           
=======================================
  Files         645      645           
  Lines       44861    44861           
=======================================
+ Hits        15633    15636    +3     
+ Misses      28021    28020    -1     
+ Partials     1207     1205    -2     
Flag Coverage Δ
unittests 34.85% <ø> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 28 '24 17:08 codecov-commenter

Updates

Some updates after testing:

  1. The issue with “Explicit Type Tags” in Plan 1 of the YAML implementation (yaml -> json -> yaml) was identified as follows:

    number: !!int 12345
    string: !!str 6789
    # after transformation
    number: 12345
    string: "6789"
    

In this process, the explicit type tags are removed, and the values are transformed into the data types indicated by the tags. However, this previously identified issue has now been resolved.

  1. After testing Plan2 ytt, it still has the same problem as Plan 1. image As we have to use encapsulate it, and teh grammar of ytt is quite different from JSON, Plan 1 is preferable.

  2. Final API design is in the proposal. Maybe some tiny changes can be made. Feel free to give suggestions.

The proposal is modified again, and you can refer to new modified proposal.

Conclusion

Thus, for the YAML implementation, Plan 1 is preferable. However, it’s important to inform users that: ​1. Dates and times may result in data type loss. ​2. Anchors (&) and aliases (*) used for referencing and reusing values will be hardcoded after transformation.

What do you guys think about? @Patrick0308 @chaunceyjiang @XiShanYongYe-Chang

sophiefeifeifeiya avatar Sep 11 '24 03:09 sophiefeifeifeiya

At the same time cc @RainbowMango

XiShanYongYe-Chang avatar Sep 11 '24 04:09 XiShanYongYe-Chang

@chaunceyjiang: GitHub didn't allow me to request PR reviews from the following users: Patrick0308.

Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

LGTM.

/cc @Patrick0308 @RainbowMango

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karmada-bot avatar Sep 24 '24 07:09 karmada-bot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chaunceyjiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

karmada-bot avatar Sep 24 '24 12:09 karmada-bot