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

Configure JPA L2 cache coordination between instances on Openshift® / Kubernetes #8982

Merged
merged 13 commits into from
Apr 11, 2018

Conversation

mshaposhnik
Copy link
Contributor

@mshaposhnik mshaposhnik commented Mar 2, 2018

What does this PR do?

Adds JGroups based coordination for EclipseLink L2 caches for multiple master instances on openshift or K8S infra.

What issues does this PR fix or reference?

#8922

Release Notes

Added JGroups based coordination for EclipseLink L2 caches for multiple master instances on openshift or K8S infra.

Docs PR

N/A

@benoitf benoitf added the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Mar 2, 2018
thread_pool.keep_alive_time="30000" />

<kubernetes.KUBE_PING
namespace="${OPENSHIFT_KUBE_PING_NAMESPACE:eclipse-che}"
Copy link
Member

Choose a reason for hiding this comment

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

As far as I understand it is used for Kubernetes and OpenShift infrastructures. So let's rename env var to KUBERNETES_KUBE_PING_NAMESPACE, or maybe even CHE_INFRA_KUBERNETES_KUBE__PING__NAMESPACE to make it clear that it is infrastructure specific configuration property.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Up to you, but I'd define our own documented property into che.properties and che.env.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me it seems we can't use own prop-s here.

Copy link
Member

Choose a reason for hiding this comment

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

Can you describe why we can't? Is not it just name of environment property that should be respected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked the jgroups code. We can use custom system property. But env.variable should be named as in the links above.

@@ -64,6 +68,8 @@ items:
name: http
- containerPort: 8000
name: http-debug
- containerPort: 8888
Copy link
Member

Choose a reason for hiding this comment

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

Is it default value? Is it a different property from TCP_PORT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thats different one needed for KUBE_PING.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks

Choose a reason for hiding this comment

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

@mshaposhnik can you elaborate on how it is used? It is not clear for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Yes, I read the docs. But I mean kubernetes service. Without it there is no access to a port of a pod.

Copy link
Member

Choose a reason for hiding this comment

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

I think there is access if you know IP for a container. I think Kubernetes JGroups discovers pods/containers IPs itself.
If you access by service, actually you don't know which pod are you request if replication is more than 1. So, it's impossible to use service at all.
Maybe I'm wrong somewhere, but I imagine it in this way.

Choose a reason for hiding this comment

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

Yeah, agree about service.

But how the lib accesses k8s/OS API? which token or SA is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Then we need to be sure that this approach works in both kubernetes and openshift before the merge.

@@ -48,6 +48,10 @@ items:
spec:
containers:
- env:
- name: OPENSHIFT_KUBE_PING_NAMESPACE
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't be added the same changes to https://github.com/eclipse/che/blob/master/dockerfiles/init/modules/kubernetes/files/che-kubernetes.yaml?
Also maybe kubernetes helm plugin should be updated accordingly.

@garagatyi @l0rd I assume it may affect minishift addon, should it be updated or the corresponding issue created?

Choose a reason for hiding this comment

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

I can't find where this env var is used. @mshaposhnik @sleshchenko can you guys point me to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Thank you

private void configureMultiUserMode() {
private void configureMultiUserMode(
Map<String, String> persistenceProperties, String infrastructure) {
if (OpenShiftInfrastructure.NAME.equals(infrastructure)

Choose a reason for hiding this comment

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

This hardcoding of infrastructure names makes Che less extensibility friendly. I would recommend using another approach where Che deployment can specify environment variable to configure JGROUPS. @mshaposhnik @skabashnyuk @sleshchenko WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a lot of ohter places where it is configured in a such way. It is not easy to refactor them all. Probably it's another big issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

@garagatyi how do you propose to implement in another way?

Choose a reason for hiding this comment

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

@skabashnyuk having an environment variable that enables what now is enabled by the name of the active infrastructure.

-->
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.1.xsd">

Choose a reason for hiding this comment

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

Can you elaborate on whether there is a way to tweak this configuration in case service delivery team need to change something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can probably move filename into property. Then, changing conf will be as simple as put new xml conf file under classpath and change that property. That's a good point.

Copy link
Contributor Author

@mshaposhnik mshaposhnik Mar 3, 2018

Choose a reason for hiding this comment

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

Or no... that's already module. Need to find out way. Maybe discuss with @riuvshin

Choose a reason for hiding this comment

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

I see, thank you.

@@ -48,6 +48,10 @@ items:
spec:
containers:
- env:
- name: OPENSHIFT_KUBE_PING_NAMESPACE

Choose a reason for hiding this comment

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

I can't find where this env var is used. @mshaposhnik @sleshchenko can you guys point me to it?

@@ -64,6 +68,8 @@ items:
name: http
- containerPort: 8000
name: http-debug
- containerPort: 8888

Choose a reason for hiding this comment

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

@mshaposhnik can you elaborate on how it is used? It is not clear for me.

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

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

@mshaposhnik Is this already tested on a real cluster of it is just a POC?

@@ -64,6 +68,8 @@ items:
name: http
- containerPort: 8000
name: http-debug
- containerPort: 8888

Choose a reason for hiding this comment

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

@mshaposhnik If there is no service for this port how this port can be accessed from other pods?

@@ -48,6 +48,10 @@ items:
spec:
containers:
- env:
- name: OPENSHIFT_KUBE_PING_NAMESPACE

Choose a reason for hiding this comment

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

Thank you

-->
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.1.xsd">

Choose a reason for hiding this comment

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

I see, thank you.

private void configureMultiUserMode() {
private void configureMultiUserMode(
Map<String, String> persistenceProperties, String infrastructure) {
if (OpenShiftInfrastructure.NAME.equals(infrastructure)

Choose a reason for hiding this comment

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

@skabashnyuk having an environment variable that enables what now is enabled by the name of the active infrastructure.

@mshaposhnik
Copy link
Contributor Author

mshaposhnik commented Mar 6, 2018

Checked it works on K8S:

  1. JGroups set connection between pods:
    kubernetes_jgroups
  2. Cache propagation :
    https://drive.google.com/file/d/1aXkfi7LxR0pkYsQhOson6OaCguri_-w6/view?usp=sharing

@benoitf benoitf added the kind/task Internal things, technical debt, and to-do tasks to be performed. label Mar 6, 2018
@garagatyi
Copy link

@mshaposhnik Can you also check on Openshift?

@mshaposhnik
Copy link
Contributor Author

It was developed on Openshift, because it is a primary goal of the issue. Kubernetes is just like an free bonus :)

@garagatyi
Copy link

@mshaposhnik thank you for the clarification!

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM

It would be better to name environment configuration as Infrastructure specific property, but I'm OK to merge it as it is because looks like there is no a way to define custom env variable name for kubernetes-jgroups library.

<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K"/>
<!--RSVP resend_interval="2000" timeout="10000"/-->
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this commented configuration line?

@skabashnyuk skabashnyuk mentioned this pull request Mar 7, 2018
@garagatyi
Copy link

@mshaposhnik I'm sorry but I've merged PR that moves deployment files to another folder. This has affected your PR. I think that the easiest way to adapt your PR is to rebase it against master and then move files that would be left from dockerfiles/init/modules/che-kubernetes-helm to deploy/kubernetes/helm/che. I hope you won't get any rebase conflicts.

@mshaposhnik mshaposhnik requested a review from a user March 28, 2018 09:11
@mshaposhnik mshaposhnik requested a review from l0rd as a code owner March 28, 2018 09:11
@mshaposhnik
Copy link
Contributor Author

ci-test

@mshaposhnik mshaposhnik merged commit 161ff94 into master Apr 11, 2018
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Apr 11, 2018
@benoitf benoitf added this to the 6.4.0 milestone Apr 11, 2018
@mshaposhnik mshaposhnik deleted the jpa_coordination branch April 11, 2018 10:53
@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:8982
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@Hailongli88 Hailongli88 mentioned this pull request Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants