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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a merge strategy extension point for the YAML config #1218

Open
wants to merge 20 commits into
base: master
from

Conversation

@LinuxSuRen
Copy link
Member

LinuxSuRen commented Dec 6, 2019

Your checklist for this pull request

fix #1194

馃毃 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.
Copy link
Member

casz left a comment

Instead of CasCGlobalConfig, should it not be SelfConfigurator?

LinuxSuRen added 2 commits Dec 6, 2019
@timja

This comment has been minimized.

Copy link
Member

timja commented Dec 6, 2019

Looks great!

@LinuxSuRen

This comment has been minimized.

Copy link
Member Author

LinuxSuRen commented Dec 10, 2019

Any more feedbacks are appreciated.

Copy link
Member

timja left a comment

Could you add a test for each merge strategy please? I think we鈥檙e good to go after that

@casz

This comment has been minimized.

Copy link
Member

casz commented Dec 10, 2019

without test case I have no idea how to change merge strategy 馃
Instead of system property I think it should be apart of the configuration context ie. self configurator.
This way it is declarative.

@timja timja dismissed their stale review Dec 10, 2019

didn't mean to approve, was on phone

@LinuxSuRen

This comment has been minimized.

Copy link
Member Author

LinuxSuRen commented Dec 10, 2019

Instead of system property I think it should be apart of the configuration context ie. self configurator.
This way it is declarative.

@casz Good advice. I do my best to try with this solution.

@timja timja changed the title Add a merge stragtegy extension point for the YAML config Add a merge strategy extension point for the YAML config Dec 10, 2019
@timja timja added the feature label Dec 10, 2019
@LinuxSuRen

This comment has been minimized.

Copy link
Member Author

LinuxSuRen commented Dec 10, 2019

The merge strategy should be set before starting to parse the YAML config file. I didn't find out how can I set ConfigurationContext at that point. @casz Please give me some tips if you know it. Thanks.

@timja
timja approved these changes Dec 10, 2019
@casz

This comment has been minimized.

Copy link
Member

casz commented Dec 10, 2019

@LinuxSuRen in the ConfigurationContext class you would add the merge strategy field

public class ConfigurationContext implements ConfiguratorRegistry {

This will be the first component configured thanks to:

@Extension(ordinal = Double.MAX_VALUE)
@Restricted(NoExternalUse.class)
public class SelfConfigurator extends BaseConfigurator<ConfigurationContext> implements RootElementConfigurator<ConfigurationContext> {

configuration-as-code:
  mergeStrategy: order
  deprecated: warn
@LinuxSuRen

This comment has been minimized.

Copy link
Member Author

LinuxSuRen commented Dec 11, 2019

@casz If there're two config files which all contain mergeStrategy, it'll cause the conflicts.

@casz

This comment has been minimized.

Copy link
Member

casz commented Dec 11, 2019

@LinuxSuRen then they are also asking for trouble, let's assume that people won't conflict on it.

import java.util.Iterator;

@Extension
public class DefaultMergeStrategy implements MergeStrategy {

This comment has been minimized.

Copy link
@casz

casz Dec 11, 2019

Member

I think Default is a terrible name it does not describe the merge behavior.

This comment has been minimized.

Copy link
@timja

timja Dec 11, 2019

Member

StrategicMerge? It鈥檚 the name kustomize used for 鈥榮mart鈥 merge

This comment has been minimized.

Copy link
@LinuxSuRen

LinuxSuRen Dec 11, 2019

Author Member

It just throws an exception when there's conflict exists.
What about IrreconcilableMergeStrategy?

@LinuxSuRen

This comment has been minimized.

Copy link
Member Author

LinuxSuRen commented Dec 11, 2019

Another problem is that it looks like I can get the right value of mergeStrategy before all the config files were loaded if I put mergeStrategy into ConfigurationContext.

@oleg-nenashev oleg-nenashev self-requested a review Dec 13, 2019
LinuxSuRen added 10 commits Dec 23, 2019
Add configs about deploy into alauda update-center
Fix the potential issues from a static field
Add support to backup and restore automatically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.