diff options
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java | 7 | ||||
-rw-r--r-- | cps-service/src/test/groovy/org/onap/cps/cache/HazelcastCacheConfigSpec.groovy | 15 | ||||
-rw-r--r-- | docs/admin-guide.rst | 12 | ||||
-rw-r--r-- | docs/deployment.rst | 3 |
4 files changed, 37 insertions, 0 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java b/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java index 0efabfd3b0..660176d5e4 100644 --- a/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java +++ b/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java @@ -24,6 +24,7 @@ import com.hazelcast.config.Config; import com.hazelcast.config.MapConfig; import com.hazelcast.config.NamedConfig; import com.hazelcast.config.QueueConfig; +import com.hazelcast.config.RestEndpointGroup; import com.hazelcast.config.SetConfig; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; @@ -64,6 +65,7 @@ public class HazelcastCacheConfig { config.setClusterName(clusterName); config.setClassLoader(org.onap.cps.spi.model.Dataspace.class.getClassLoader()); + exposeClusterInformation(config); updateDiscoveryMode(config); return config; } @@ -97,4 +99,9 @@ public class HazelcastCacheConfig { } } + protected void exposeClusterInformation(final Config config) { + config.getNetworkConfig().getRestApiConfig().setEnabled(true) + .enableGroups(RestEndpointGroup.HEALTH_CHECK, RestEndpointGroup.CLUSTER_READ); + } + } diff --git a/cps-service/src/test/groovy/org/onap/cps/cache/HazelcastCacheConfigSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/cache/HazelcastCacheConfigSpec.groovy index 415e9fd496..022cd74ea6 100644 --- a/cps-service/src/test/groovy/org/onap/cps/cache/HazelcastCacheConfigSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/cache/HazelcastCacheConfigSpec.groovy @@ -20,6 +20,8 @@ package org.onap.cps.cache +import com.hazelcast.config.Config +import com.hazelcast.config.RestEndpointGroup import spock.lang.Specification class HazelcastCacheConfigSpec extends Specification { @@ -58,4 +60,17 @@ class HazelcastCacheConfigSpec extends Specification { 'Set Config' | HazelcastCacheConfig.createSetConfig('my set config') || false | false | true } + def 'Verify Hazelcast Cluster Information'() { + given: 'a test configuration' + def testConfig = new Config() + when: 'cluster information is exposed' + objectUnderTest.exposeClusterInformation(testConfig) + then: 'REST api configs are enabled' + assert testConfig.networkConfig.restApiConfig.enabled + and: 'only health check and cluster read are enabled' + def enabledGroups = testConfig.networkConfig.restApiConfig.enabledGroups + assert enabledGroups.size() == 2 + assert enabledGroups.containsAll([RestEndpointGroup.CLUSTER_READ, RestEndpointGroup.HEALTH_CHECK]) + } + } diff --git a/docs/admin-guide.rst b/docs/admin-guide.rst index b58e740339..1c4d7455f0 100644 --- a/docs/admin-guide.rst +++ b/docs/admin-guide.rst @@ -192,6 +192,18 @@ Prometheus Metrics can be checked at the following endpoint http://<cps-component-service-name>:8080/actuator/prometheus +Hazelcast +--------- + +Hazelcast cluster state and health check can be seen using the below endpoints + +.. code:: + + http://<cps-component-service-name>:<member-port>/hazelcast/health + http://<cps-component-service-name>:<member-port>/hazelcast/rest/management/cluster/state + +See also : :ref:`cps_common_distributed_datastructures` + Naming Validation ----------------- diff --git a/docs/deployment.rst b/docs/deployment.rst index 59e2adafed..eb5804e5bf 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -296,6 +296,9 @@ CPS-Core Docker Installation CPS-Core can also be installed in a docker environment. Latest `docker-compose <https://github.com/onap/cps/blob/master/docker-compose/docker-compose.yml>`_ is included in the repo to start all the relevant services. The latest instructions are covered in the `README <https://github.com/onap/cps/blob/master/docker-compose/README.md>`_. +.. Below Label is used by documentation for other CPS components to link here, do not remove even if it gives a warning +.. _cps_common_distributed_datastructures: + CPS-Core and NCMP Distributed Datastructures ============================================ |