karmada icon indicating copy to clipboard operation
karmada copied to clipboard

add plaintext object overrider

Open Patrick0308 opened this issue 1 year ago • 19 comments

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.

Patrick0308 avatar Aug 08 '24 12:08 Patrick0308

[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 avatar Aug 08 '24 12:08 karmada-bot

/assign

chaunceyjiang avatar Aug 09 '24 03:08 chaunceyjiang

:warning: 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 :warning:

:exclamation: 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%) :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 13 '24 03:08 codecov-commenter

@chaunceyjiang PTAL

Patrick0308 avatar Aug 13 '24 07:08 Patrick0308

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

liangyuanpeng avatar Aug 13 '24 07:08 liangyuanpeng

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

How to add a release note?

Patrick0308 avatar Aug 14 '24 03:08 Patrick0308

How to add a release note?

Update in here will be ok:

image

XiShanYongYe-Chang avatar Aug 14 '24 03:08 XiShanYongYe-Chang

@chaunceyjiang PTAL

Patrick0308 avatar Aug 14 '24 09:08 Patrick0308

@liangyuanpeng @XiShanYongYe-Chang PTAL

Patrick0308 avatar Aug 15 '24 03:08 Patrick0308

Kindly ping @chaunceyjiang

XiShanYongYe-Chang avatar Aug 15 '24 08:08 XiShanYongYe-Chang

Hi @Patrick0308 thanks for your contribution!

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

/kind feature

XiShanYongYe-Chang avatar Aug 15 '24 08:08 XiShanYongYe-Chang

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

Patrick0308 avatar Aug 15 '24 08:08 Patrick0308

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.

XiShanYongYe-Chang avatar Aug 15 '24 09:08 XiShanYongYe-Chang

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?

XiShanYongYe-Chang avatar Aug 19 '24 04:08 XiShanYongYe-Chang

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?

Patrick0308 avatar Aug 22 '24 10:08 Patrick0308

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 avatar Aug 22 '24 12:08 XiShanYongYe-Chang

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

XiShanYongYe-Chang avatar Aug 27 '24 03:08 XiShanYongYe-Chang

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.

Patrick0308 avatar Aug 27 '24 05:08 Patrick0308

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.

XiShanYongYe-Chang avatar Aug 27 '24 06:08 XiShanYongYe-Chang

Close By #5591

Patrick0308 avatar Oct 09 '24 07:10 Patrick0308