Skip to content

Commit 36eb090

Browse files
author
Rafał Leszko
authored
Adapt OpenShift Code Sample to Hazelcast 4.0 (#411)
* Adapt OpenShift Code Sample to Hazelcast 4.0
1 parent dbcc29d commit 36eb090

File tree

8 files changed

+70
-92
lines changed

8 files changed

+70
-92
lines changed

hazelcast-integration/openshift/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Log in as Username: "developer", Password: "developer".
5656

5757
## Step 2: Start Hazelcast cluster
5858

59-
Note that, in case of Hazelcast Enterprise OpenShift (both [Centos](hazelcast-cluster/hazelcast-enterprise-openshift-centos/) and [RHEL](hazelcast-cluster/hazelcast-enterprise-openshift-rhel/), you will need a valid Hazelcast license key. If you don't have one, you can either use [Hazelcast OpenShift Origin](hazelcast-cluster/hazelcast-openshift-origin/) instead or get a trial key from [this link](https://hazelcast.com/hazelcast-enterprise-download/trial/).
59+
Note that, in case of Hazelcast Enterprise (and Hazelcast Enterprise RHEL), you will need a valid Hazelcast license key. If you don't have one, you can either use [Hazelcast OpenShift Origin](hazelcast-cluster/hazelcast/) instead or get a trial key from [this link](https://hazelcast.com/hazelcast-enterprise-download/trial/).
6060

6161
**1) Create Project**
6262

@@ -73,11 +73,11 @@ Then, you can create a new project.
7373
$ oc new-project hazelcast
7474
```
7575

76-
Note that, in case of [Hazelcast Enterprise OpenShift RHEL](hazelcast-cluster/hazelcast-enterprise-openshift-rhel/), you will need to authenticate to Red Hat Container Catalog as described [here](#authenticate-to-red-hat-container-catalog).
76+
Note that, in case of [Hazelcast Enterprise RHEL](hazelcast-cluster/hazelcast-enterprise-rhel/), you will need to authenticate to Red Hat Container Catalog as described [here](#authenticate-to-red-hat-container-catalog).
7777

7878
**2) Start Hazelcast cluster**
7979

80-
Change the directory to Hazelcast Enterprise (`$ cd hazelcast-cluster/hazelcast-enterprise-openshift-centos`), Hazelcast Enterprise RHEL (`$ cd hazelcast-cluster/hazelcast-enterprise-openshift-rhel`) or Hazelcast (`$ cd hazelcast-cluster/hazelcast-openshift-origin`).
80+
Change the directory to Hazelcast Enterprise (`$ cd hazelcast-cluster/hazelcast-enterprise`), Hazelcast Enterprise RHEL (`$ cd hazelcast-cluster/hazelcast-enterprise-rhel`) or Hazelcast (`$ cd hazelcast-cluster/hazelcast`).
8181

8282
Then, start the cluster with the following command.
8383

@@ -89,7 +89,7 @@ $ oc new-app -f hazelcast.yaml \
8989

9090
Used parameters:
9191
* `NAMESPACE`: must be the same as the OpenShift project's name
92-
* `ENTERPRISE_LICENSE_KEY`: Hazelcast Enterprise License (not needed for [Hazelcast OpenShift Origin](hazelcast-cluster/hazelcast-openshift-origin/))
92+
* `ENTERPRISE_LICENSE_KEY`: Hazelcast Enterprise License (not needed for [Hazelcast OpenShift Origin](hazelcast-cluster/hazelcast/))
9393

9494
**3) Check that Hazelcast is running**
9595

@@ -264,7 +264,7 @@ You can check that the application really works together with the Hazelcast clus
264264

265265
If you want to play with "Entry Processor" from the code sample, you need to place the Entry Processor JAR into the `/data` directory of Hazelcast. Currently, you use ConfigMap with `hazelcast.xml` as the volume mounted to `/data`. However, if we want to copy the custom JAR, you need to change it and use OpenShift Persistent Volume.
266266

267-
Let's first change the directory to Hazelcast Enterprise (`$ cd hazelcast-cluster/hazelcast-enterprise-openshift-centos`), Hazelcast Enterprise RHEL (`$ cd hazelcast-cluster/hazelcast-enterprise-openshift-rhel`) or Hazelcast (`$ cd hazelcast-cluster/hazelcast-openshift-origin`).
267+
Let's first change the directory to Hazelcast Enterprise (`$ cd hazelcast-cluster/hazelcast-enterprise`), Hazelcast Enterprise RHEL (`$ cd hazelcast-cluster/hazelcast-enterprise-rhel`) or Hazelcast (`$ cd hazelcast-cluster/hazelcast`).
268268

269269
Then, replace ConfigMap with the Persistent Storage.
270270

hazelcast-integration/openshift/client-apps/ocp-demo-frontend/src/main/resources/hazelcast-client.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
hazelcast-client:
2+
network:
3+
kubernetes:
4+
enabled: true
5+
service-dns: hazelcast-service.hazelcast.svc.cluster.local

hazelcast-integration/openshift/hazelcast-cluster/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
This repository contains the following folders:
44

5-
* [Hazelcast Enterprise OpenShift RHEL](hazelcast-enterprise-openshift-rhel/): provides the template to deploy Hazelcast IMDG Enterprise RHEL onto OpenShift Container Platform
6-
* [Hazelcast Enterprise OpenShift Centos](hazelcast-enterprise-openshift-centos/): provides the template to deploy Hazelcast IMDG Enterprise onto OpenShift Container Platform
7-
* [Hazelcast OpenShift Origin](hazelcast-openshift-origin/): provides the template to deploy Hazelcast IMDG onto OpenShift
5+
* [Hazelcast Enterprise RHEL](hazelcast-enterprise-rhel/): provides the template to deploy Hazelcast IMDG Enterprise RHEL onto OpenShift Container Platform
6+
* [Hazelcast Enterprise](hazelcast-enterprise/): provides the template to deploy Hazelcast IMDG Enterprise onto OpenShift Container Platform
7+
* [Hazelcast](hazelcast/): provides the template to deploy Hazelcast IMDG onto OpenShift
88

99
# Quick start
1010

hazelcast-integration/openshift/hazelcast-cluster/hazelcast-enterprise-openshift-rhel/hazelcast.yaml renamed to hazelcast-integration/openshift/hazelcast-cluster/hazelcast-enterprise-rhel/hazelcast.yaml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ labels:
1212
parameters:
1313
- name: HAZELCAST_IMAGE
1414
description: "Defines the location of Hazelcast image"
15-
value: registry.connect.redhat.com/hazelcast/hazelcast-3-rhel7:3.12
15+
value: registry.connect.redhat.com/hazelcast/hazelcast-4-rhel8:4.0
1616
required: true
1717
- name: SERVICE_NAME
1818
description: "Defines the service name of the POD to lookup of Kubernetes"
@@ -30,7 +30,7 @@ parameters:
3030
required": true
3131
- name: MANAGEMENT_CENTER_IMAGE
3232
description: "Defines the location of Hazelcast Management Center image"
33-
value: registry.connect.redhat.com/hazelcast/management-center-3-rhel7:3.12
33+
value: registry.connect.redhat.com/hazelcast/management-center-4-rhel8:4.0
3434
required: true
3535
- name: MANAGEMENT_CENTER_SERVICE_NAME
3636
description: "Defines the service name of Management Center"
@@ -43,19 +43,19 @@ objects:
4343
metadata:
4444
name: hazelcast-configuration
4545
data:
46-
hazelcast.xml: |-
47-
<?xml version="1.0" encoding="UTF-8"?>
48-
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.11.xsd"
49-
xmlns="http://www.hazelcast.com/schema/config"
50-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
51-
<network>
52-
<join>
53-
<multicast enabled="false"/>
54-
<kubernetes enabled="true"/>
55-
</join>
56-
</network>
57-
<management-center enabled="true">http://management-center-service.${namespace}.svc:8080/hazelcast-mancenter</management-center>
58-
</hazelcast>
46+
hazelcast.yaml: |-
47+
hazelcast:
48+
network:
49+
join:
50+
multicast:
51+
enabled: false
52+
kubernetes:
53+
enabled: true
54+
rest-api:
55+
enabled: true
56+
endpoint-groups:
57+
HEALTH_CHECK:
58+
enabled: true
5959
6060
- apiVersion: apps/v1
6161
kind: StatefulSet
@@ -110,7 +110,7 @@ objects:
110110
- name: HZ_DATA
111111
value: /data/hazelcast
112112
- name: JAVA_OPTS
113-
value: "-Dnamespace=${NAMESPACE}"
113+
value: "-Dhazelcast.config=/data/hazelcast/hazelcast.yaml -Dnamespace=${NAMESPACE}"
114114
volumes:
115115
- name: hazelcast-storage
116116
configMap:
@@ -170,7 +170,7 @@ objects:
170170
containerPort: 8080
171171
livenessProbe:
172172
httpGet:
173-
path: /hazelcast-mancenter
173+
path: /health
174174
port: 8080
175175
initialDelaySeconds: 30
176176
periodSeconds: 10
@@ -179,7 +179,7 @@ objects:
179179
failureThreshold: 10
180180
readinessProbe:
181181
httpGet:
182-
path: /hazelcast-mancenter
182+
path: /health
183183
port: 8080
184184
initialDelaySeconds: 30
185185
periodSeconds: 10
@@ -189,6 +189,9 @@ objects:
189189
volumeMounts:
190190
- name: mancenter-storage
191191
mountPath: /data
192+
env:
193+
- name: MC_INIT_CMD
194+
value: "./mc-conf.sh cluster add -H /data -cn dev -ma ${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local"
192195
volumes:
193196
- name: mancenter-storage
194197
persistentVolumeClaim:

hazelcast-integration/openshift/hazelcast-cluster/hazelcast-enterprise-openshift-centos/hazelcast.yaml renamed to hazelcast-integration/openshift/hazelcast-cluster/hazelcast-enterprise/hazelcast.yaml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ labels:
1212
parameters:
1313
- name: HAZELCAST_IMAGE
1414
description: "Defines the location of Hazelcast image"
15-
value: hazelcast/hazelcast-enterprise:3.12
15+
value: hazelcast/hazelcast-enterprise:4.0
1616
required: true
1717
- name: SERVICE_NAME
1818
description: "Defines the service name of the POD to lookup of Kubernetes"
@@ -30,7 +30,7 @@ parameters:
3030
required": true
3131
- name: MANAGEMENT_CENTER_IMAGE
3232
description: "Defines the location of Hazelcast Management Center image"
33-
value: hazelcast/management-center:3.12
33+
value: hazelcast/management-center:4.0
3434
required: true
3535
- name: MANAGEMENT_CENTER_SERVICE_NAME
3636
description: "Defines the service name of Management Center"
@@ -43,19 +43,19 @@ objects:
4343
metadata:
4444
name: hazelcast-configuration
4545
data:
46-
hazelcast.xml: |-
47-
<?xml version="1.0" encoding="UTF-8"?>
48-
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.11.xsd"
49-
xmlns="http://www.hazelcast.com/schema/config"
50-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
51-
<network>
52-
<join>
53-
<multicast enabled="false"/>
54-
<kubernetes enabled="true"/>
55-
</join>
56-
</network>
57-
<management-center enabled="true">http://management-center-service.${namespace}.svc:8080/hazelcast-mancenter</management-center>
58-
</hazelcast>
46+
hazelcast.yaml: |-
47+
hazelcast:
48+
network:
49+
join:
50+
multicast:
51+
enabled: false
52+
kubernetes:
53+
enabled: true
54+
rest-api:
55+
enabled: true
56+
endpoint-groups:
57+
HEALTH_CHECK:
58+
enabled: true
5959
6060
- apiVersion: apps/v1
6161
kind: StatefulSet
@@ -108,7 +108,7 @@ objects:
108108
- name: HZ_LICENSE_KEY
109109
value: ${ENTERPRISE_LICENSE_KEY}
110110
- name: JAVA_OPTS
111-
value: "-Dhazelcast.rest.enabled=true -Dhazelcast.config=/data/hazelcast/hazelcast.xml -Dnamespace=${NAMESPACE}"
111+
value: "-Dhazelcast.config=/data/hazelcast/hazelcast.yaml -Dnamespace=${NAMESPACE}"
112112
volumes:
113113
- name: hazelcast-storage
114114
configMap:
@@ -168,7 +168,7 @@ objects:
168168
containerPort: 8080
169169
livenessProbe:
170170
httpGet:
171-
path: /hazelcast-mancenter
171+
path: /health
172172
port: 8080
173173
initialDelaySeconds: 30
174174
periodSeconds: 10
@@ -177,7 +177,7 @@ objects:
177177
failureThreshold: 10
178178
readinessProbe:
179179
httpGet:
180-
path: /hazelcast-mancenter
180+
path: /health
181181
port: 8080
182182
initialDelaySeconds: 30
183183
periodSeconds: 10
@@ -187,6 +187,9 @@ objects:
187187
volumeMounts:
188188
- name: mancenter-storage
189189
mountPath: /data
190+
env:
191+
- name: MC_INIT_CMD
192+
value: "./mc-conf.sh cluster add -H /data -cn dev -ma ${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local"
190193
volumes:
191194
- name: mancenter-storage
192195
persistentVolumeClaim:

hazelcast-integration/openshift/hazelcast-cluster/hazelcast-openshift-origin/hazelcast.yaml renamed to hazelcast-integration/openshift/hazelcast-cluster/hazelcast/hazelcast.yaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ labels:
1212
parameters:
1313
- name: HAZELCAST_IMAGE
1414
description: "Defines the location of Hazelcast image"
15-
value: hazelcast/hazelcast:3.12
15+
value: hazelcast/hazelcast:4.0
1616
required: true
1717
- name: SERVICE_NAME
1818
description: "Defines the service name of the POD to lookup of Kubernetes"
@@ -32,18 +32,19 @@ objects:
3232
metadata:
3333
name: hazelcast-configuration
3434
data:
35-
hazelcast.xml: |-
36-
<?xml version="1.0" encoding="UTF-8"?>
37-
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.10.xsd"
38-
xmlns="http://www.hazelcast.com/schema/config"
39-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
40-
<network>
41-
<join>
42-
<multicast enabled="false"/>
43-
<kubernetes enabled="true"/>
44-
</join>
45-
</network>
46-
</hazelcast>
35+
hazelcast.yaml: |-
36+
hazelcast:
37+
network:
38+
join:
39+
multicast:
40+
enabled: false
41+
kubernetes:
42+
enabled: true
43+
rest-api:
44+
enabled: true
45+
endpoint-groups:
46+
HEALTH_CHECK:
47+
enabled: true
4748
4849
- apiVersion: apps/v1
4950
kind: StatefulSet
@@ -92,7 +93,7 @@ objects:
9293
- name: HAZELCAST_KUBERNETES_SERVICE_DNS
9394
value: ${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local
9495
- name: JAVA_OPTS
95-
value: "-Dhazelcast.rest.enabled=true -Dhazelcast.config=/data/hazelcast/hazelcast.xml"
96+
value: "-Dhazelcast.config=/data/hazelcast/hazelcast.yaml"
9697
volumes:
9798
- name: hazelcast-storage
9899
configMap:

hazelcast-integration/openshift/hazelcast-configuration/hazelcast.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)