mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-13 00:15:47 +00:00
Today when a node starts, we create dynamic socket permissions based on the configured HTTP ports and transport ports. If no ports are configured, we use the default port ranges. When a tribe node starts, a tribe node creates an internal node client for connecting to each remote cluster. If neither an explicit HTTP port nor transport ports were specified, the default port ranges are large enough for the tribe node and its internal node clients. If an explicit HTTP port or transport port was specified for the tribe node, then socket permissions for those ports will be created, but not for the internal node clients. Whether the internal node clients have explicit ports specified, or attempt to bind within the default range, socket permissions for these will not have been created and the internal node clients will hit a permissions issue when attempting to bind. This commit addresses this issue by also accounting for tribe nodes when creating the dynamic socket permissions. Additionally, we add our first real integration test for tribe nodes.
70 lines
2.8 KiB
Groovy
70 lines
2.8 KiB
Groovy
/*
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import org.elasticsearch.gradle.test.ClusterConfiguration
|
|
import org.elasticsearch.gradle.test.ClusterFormationTasks
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
List<NodeInfo> oneNodes
|
|
|
|
task setupClusterOne(type: DefaultTask) {
|
|
mustRunAfter(precommit)
|
|
ClusterConfiguration configOne = new ClusterConfiguration(project)
|
|
configOne.clusterName = 'one'
|
|
configOne.setting('node.name', 'one')
|
|
oneNodes = ClusterFormationTasks.setup(project, setupClusterOne, configOne)
|
|
}
|
|
|
|
List<NodeInfo> twoNodes
|
|
|
|
task setupClusterTwo(type: DefaultTask) {
|
|
mustRunAfter(precommit)
|
|
ClusterConfiguration configTwo = new ClusterConfiguration(project)
|
|
configTwo.clusterName = 'two'
|
|
configTwo.setting('node.name', 'two')
|
|
twoNodes = ClusterFormationTasks.setup(project, setupClusterTwo, configTwo)
|
|
}
|
|
|
|
integTest {
|
|
dependsOn(setupClusterOne, setupClusterTwo)
|
|
cluster {
|
|
// tribe nodes had a bug where if explicit ports was specified for the tribe node, the dynamic socket permissions that were applied
|
|
// would not account for the fact that the internal node client needed to bind to sockets too; thus, we use explicit port ranges to
|
|
// ensure that the code that fixes this bug is exercised
|
|
setting 'http.port', '40200-40249'
|
|
setting 'transport.tcp.port', '40300-40349'
|
|
setting 'node.name', 'quest'
|
|
setting 'tribe.one.cluster.name', 'one'
|
|
setting 'tribe.one.discovery.zen.ping.unicast.hosts', "'${-> oneNodes.get(0).transportUri()}'"
|
|
setting 'tribe.one.http.enabled', 'true'
|
|
setting 'tribe.one.http.port', '40250-40299'
|
|
setting 'tribe.one.transport.tcp.port', '40350-40399'
|
|
setting 'tribe.two.cluster.name', 'two'
|
|
setting 'tribe.two.discovery.zen.ping.unicast.hosts', "'${-> twoNodes.get(0).transportUri()}'"
|
|
setting 'tribe.two.http.enabled', 'true'
|
|
setting 'tribe.two.http.port', '40250-40299'
|
|
setting 'tribe.two.transport.tcp.port', '40250-40399'
|
|
}
|
|
// need to kill the standalone nodes here
|
|
finalizedBy ':qa:smoke-test-tribe-node:setupClusterOne#stop'
|
|
finalizedBy ':qa:smoke-test-tribe-node:setupClusterTwo#stop'
|
|
}
|