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

Overriding values inside JSON and YAML #5449

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

sophiefeifeifeiya
Copy link
Contributor

@sophiefeifeifeiya sophiefeifeifeiya commented Aug 28, 2024

What type of PR is this?

/kind design
/kind documentation

What this PR does / why we need it:
Overriding values inside JSON and 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 `FieldOverrider ` for overriding values in YAML or JSON.

@karmada-bot karmada-bot added kind/design Categorizes issue or PR as related to design. kind/documentation Categorizes issue or PR as related to documentation. labels Aug 28, 2024
@karmada-bot
Copy link
Collaborator

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

@karmada-bot karmada-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 28, 2024
@sophiefeifeifeiya sophiefeifeifeiya force-pushed the self-master branch 2 times, most recently from a88c656 to bcefab3 Compare August 28, 2024 17:15
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

⚠️ 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 ✅

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

❗ 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%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sophiefeifeifeiya sophiefeifeifeiya force-pushed the self-master branch 2 times, most recently from bc905de to 4ef6cf9 Compare August 30, 2024 08:32
@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 3, 2024
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 3, 2024
@sophiefeifeifeiya sophiefeifeifeiya changed the title proposal for overriding values inside structured data files Overriding values inside Configurations of Different Data Formats Sep 6, 2024
@sophiefeifeifeiya
Copy link
Contributor Author

sophiefeifeifeiya commented Sep 11, 2024

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

@XiShanYongYe-Chang
Copy link
Member

At the same time cc @RainbowMango

@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 22, 2024
@sophiefeifeifeiya sophiefeifeifeiya changed the title Overriding values inside Configurations of Different Data Formats Overriding values inside JSON and YAML Sep 23, 2024
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some nits, otherwise LGTM.

@chaunceyjiang @Patrick0308 Please take another look, if no further comments I guess we can move it forward then.

Copy link
Member

@chaunceyjiang chaunceyjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karmada-bot
Copy link
Collaborator

@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.

Copy link

@Patrick0308 Patrick0308 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nit hits. LGTM

docs/proposals/structured-configuration/README.md Outdated Show resolved Hide resolved
docs/proposals/structured-configuration/README.md Outdated Show resolved Hide resolved
docs/proposals/structured-configuration/README.md Outdated Show resolved Hide resolved
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@chaunceyjiang @Patrick0308 Do you have any further comments?

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2024
Copy link
Member

@chaunceyjiang chaunceyjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@karmada-bot
Copy link
Collaborator

[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 karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 24, 2024
@karmada-bot karmada-bot merged commit 004de43 into karmada-io:master Sep 24, 2024
12 checks passed
@sophiefeifeifeiya sophiefeifeifeiya deleted the self-master branch September 25, 2024 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/design Categorizes issue or PR as related to design. kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: Planning
Development

Successfully merging this pull request may close these issues.

Support json or yaml plaintext field overriding
7 participants