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

add plaintext object overrider #5329

Closed

Conversation

Patrick0308
Copy link

@Patrick0308 Patrick0308 commented Aug 8, 2024

What type of PR is this?

What this PR does / why we need it:
Add plaintextObjectOverrider to support modify a json or yaml field value.

For example:

apiVersion: v1
kind: ConfigMap
metadata:
  name: myconfigmap
  #...
data:
  test.json:  |
   {"key": {"test": "value"}, {"key1": "value"}}

The plaintextObjectOverrider to update the value of key's test field to "value1"

apiVersion: policy.karmada.io/v1alpha1
kind: OverridePolicy
metadata:
  name: example
spec:
  #...
  overrideRules:
    - overriders:
        plaintextObjectOverrider:
          - path: /data/test.json 
            plaintext: 
            - path: /key/test
               operator: replace
               value: value1

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

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

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

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevin-wangzefeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 8, 2024
@Patrick0308 Patrick0308 force-pushed the feat-object-overrider branch from e563556 to b3e85ef Compare August 8, 2024 12:16
@chaunceyjiang
Copy link
Member

/assign

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2024

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

Codecov Report

Attention: Patch coverage is 43.47826% with 26 lines in your changes missing coverage. Please review.

Project coverage is 29.43%. Comparing base (d18afa1) to head (ef5d10f).
Report is 10 commits behind head on master.

Files Patch % Lines
pkg/util/overridemanager/overridemanager.go 43.47% 16 Missing and 10 partials ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5329      +/-   ##
==========================================
+ Coverage   29.36%   29.43%   +0.07%     
==========================================
  Files         632      632              
  Lines       43862    43881      +19     
==========================================
+ Hits        12878    12918      +40     
+ Misses      30050    30014      -36     
- Partials      934      949      +15     
Flag Coverage Δ
unittests 29.43% <43.47%> (+0.07%) ⬆️

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.

@Patrick0308 Patrick0308 force-pushed the feat-object-overrider branch from 4a89e1c to 2ab8aed Compare August 13, 2024 07:06
@Patrick0308
Copy link
Author

@chaunceyjiang PTAL

@liangyuanpeng
Copy link
Contributor

I think it's need to add a release-note for it.

@Patrick0308 Patrick0308 force-pushed the feat-object-overrider branch from 6d1af21 to 6600018 Compare August 13, 2024 08:55
@Patrick0308
Copy link
Author

I think it's need to add a release-note for it.

How to add a release note?

@XiShanYongYe-Chang
Copy link
Member

How to add a release note?

Update in here will be ok:

image

@Patrick0308
Copy link
Author

@chaunceyjiang PTAL

@Patrick0308
Copy link
Author

@liangyuanpeng @XiShanYongYe-Chang PTAL

@Patrick0308 Patrick0308 force-pushed the feat-object-overrider branch from 6600018 to d11c4a4 Compare August 15, 2024 06:19
@XiShanYongYe-Chang
Copy link
Member

Kindly ping @chaunceyjiang

@XiShanYongYe-Chang
Copy link
Member

Hi @Patrick0308 thanks for your contribution!

Can you post the results? And by the way, can you help me squash the commit?

/kind feature

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 15, 2024
@Patrick0308
Copy link
Author

Can you post the results? And by the way, can you help me squash the commit?

GitHub can automatically squash commits.

https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests

@XiShanYongYe-Chang
Copy link
Member

Thanks for pointing out the documentation reference. The karmada repository is not currently set up that way. Sometimes it is necessary to keep multiple commits.

@Patrick0308 Patrick0308 force-pushed the feat-object-overrider branch from d11c4a4 to ef5d10f Compare August 16, 2024 06:06
@XiShanYongYe-Chang
Copy link
Member

Hi @Patrick0308, @chaunceyjiang may be busy with kubeCon China 2024 in Hong Kong recently.
I see that this feature change also involves the addition of APIs to the OP. Can you share this topic at the next community meeting?

@Patrick0308
Copy link
Author

Hi @Patrick0308, @chaunceyjiang may be busy with kubeCon China 2024 in Hong Kong recently. I see that this feature change also involves the addition of APIs to the OP. Can you share this topic at the next community meeting?

Sure, what should I prepare for this? Maybe demonstrate a demo?

@XiShanYongYe-Chang
Copy link
Member

Sure, what should I prepare for this? Maybe demonstrate a demo?

That would be best. I hope you can also describe the background of the requirement, similar to a user story.

@XiShanYongYe-Chang
Copy link
Member

Hi @Patrick0308 would you like to sign up for a community meeting topic? There is a community meeting in Chinese today.
https://docs.google.com/document/d/1y6YLVC-v7cmVAdbjedoyR5WL0-q45DBRXTvz5_I7bkA/edit#heading=h.1inx4hjf6903

@Patrick0308
Copy link
Author

Hi @Patrick0308 would you like to sign up for a community meeting topic? There is a community meeting in Chinese today. https://docs.google.com/document/d/1y6YLVC-v7cmVAdbjedoyR5WL0-q45DBRXTvz5_I7bkA/edit#heading=h.1inx4hjf6903

Ok, I requested the doc edit access.

@XiShanYongYe-Chang
Copy link
Member

XiShanYongYe-Chang commented Aug 27, 2024

Ok, I requested the doc edit access.

When you add such the mail group, will automatically get the document editing rights:

image

I have added an agenda for you.

@Patrick0308
Copy link
Author

Close By #5591

@Patrick0308 Patrick0308 closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support json or yaml plaintext field overriding
6 participants