Use dedicated VIPs for Kibana and Grafana
For the 0.x versions of the plugins, the checks continue to use the same VIP addresses as before. Change-Id: Icdf9315239a8fde8b0528f555a89adf0374c408f Implements-blueprint: kibana-grafana-public-ip-access
This commit is contained in:
parent
eb8f6d6fd1
commit
6d7783f641
@ -84,12 +84,6 @@ class PluginApi(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_plugin_vip(self):
|
||||
"""Get the VIP address associated to the plugin (if any).
|
||||
"""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def check_plugin_online(self):
|
||||
"""Check that the plugin works properly.
|
||||
@ -112,14 +106,16 @@ class PluginApi(object):
|
||||
check_availability, timeout=timeout, timeout_msg=msg)
|
||||
|
||||
def check_plugin_failover(self):
|
||||
"""Check that failover for the plugin works.
|
||||
"""Shutdown the node running the VIP and check that it fails over
|
||||
properly.
|
||||
"""
|
||||
vip_name = self.helpers.full_vip_name(self.settings.vip_name)
|
||||
vip_resource = self.helpers.get_vip_resource_name(
|
||||
self.settings.failover_vip)
|
||||
target_node = self.helpers.get_node_with_vip(
|
||||
self.settings.role_name, vip_name)
|
||||
self.settings.role_name, vip_resource)
|
||||
self.helpers.power_off_node(target_node)
|
||||
self.helpers.wait_for_vip_migration(
|
||||
target_node, self.settings.role_name, vip_name)
|
||||
target_node, self.settings.role_name, vip_resource)
|
||||
|
||||
def get_http_protocol(self, tls_parameter='tls_enabled'):
|
||||
"""Return the HTTP protocol configured for the plugin (http or https).
|
||||
|
@ -39,9 +39,6 @@ class CeilometerRedisPluginApi(base_test.PluginApi):
|
||||
endpoint=endpoint, token=lambda: keystone_access.auth_token)
|
||||
return self._ceilometer
|
||||
|
||||
def get_plugin_vip(self):
|
||||
pass
|
||||
|
||||
def get_plugin_settings(self):
|
||||
return plugin_settings
|
||||
|
||||
|
@ -31,7 +31,7 @@ class ElasticsearchPluginApi(base_test.PluginApi):
|
||||
def es(self):
|
||||
if self._es_client is None:
|
||||
self._es_client = elasticsearch.Elasticsearch(
|
||||
[{'host': self.get_plugin_vip(), 'port': 9200}])
|
||||
[{'host': self.get_elasticsearch_vip(), 'port': 9200}])
|
||||
return self._es_client
|
||||
|
||||
@property
|
||||
@ -61,15 +61,23 @@ class ElasticsearchPluginApi(base_test.PluginApi):
|
||||
self.helpers.activate_plugin(
|
||||
self.settings.name, self.settings.version, options)
|
||||
|
||||
def get_plugin_vip(self):
|
||||
return self.helpers.get_plugin_vip(self.settings.vip_name)
|
||||
def get_elasticsearch_vip(self):
|
||||
return self.helpers.get_vip_address('es_vip_mgmt')
|
||||
|
||||
def get_elasticsearch_url(self, path=''):
|
||||
return "http://{}:9200/{}".format(self.get_plugin_vip(), path)
|
||||
return "http://{}:9200/{}".format(self.get_elasticsearch_vip(), path)
|
||||
|
||||
def get_kibana_vip(self):
|
||||
if self.settings.version.startswith("0."):
|
||||
# 0.x versions of the plugin uses the same VIP for Elasticsearch
|
||||
# and Kibana
|
||||
return self.get_elasticsearch_vip()
|
||||
else:
|
||||
return self.helpers.get_vip_address('kibana')
|
||||
|
||||
def get_kibana_url(self):
|
||||
return "{0}://{1}:{2}/".format(
|
||||
self.kibana_protocol, self.get_plugin_vip(), self.kibana_port)
|
||||
self.kibana_protocol, self.get_kibana_vip(), self.kibana_port)
|
||||
|
||||
def check_plugin_online(self):
|
||||
elasticsearch_url = self.get_elasticsearch_url()
|
||||
|
@ -18,7 +18,7 @@ from stacklight_tests import settings
|
||||
|
||||
name = 'elasticsearch_kibana'
|
||||
role_name = ['elasticsearch_kibana']
|
||||
vip_name = 'es_vip_mgmt'
|
||||
failover_vip = 'es_vip_mgmt'
|
||||
plugin_path = settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH
|
||||
version = helpers.get_plugin_version(plugin_path)
|
||||
kibana_username = 'kibanauser'
|
||||
|
@ -196,8 +196,14 @@ class PluginHelper(object):
|
||||
"editable": {name: attributes}
|
||||
})
|
||||
|
||||
def get_plugin_vip(self, vip_name):
|
||||
"""Get plugin IP."""
|
||||
def get_vip_address(self, vip_name):
|
||||
"""Get the virtual IP address.
|
||||
|
||||
:param vip_name: name of the VIP.
|
||||
:type name: str
|
||||
:returns: the VIP address in dotted-decimal notation
|
||||
:rtype: str
|
||||
"""
|
||||
networks = self.nailgun_client.get_networks(self.cluster_id)
|
||||
vip = networks.get('vips').get(vip_name, {}).get('ipaddr', None)
|
||||
asserts.assert_is_not_none(
|
||||
@ -315,7 +321,9 @@ class PluginHelper(object):
|
||||
return node
|
||||
|
||||
@staticmethod
|
||||
def full_vip_name(vip_name):
|
||||
def get_vip_resource_name(vip_name):
|
||||
"""Return the name of the VIP resource.
|
||||
"""
|
||||
return "".join(["vip__", vip_name])
|
||||
|
||||
def get_node_with_vip(self, role_name, vip, exclude_node=None):
|
||||
|
@ -37,7 +37,7 @@ class InfluxdbPluginApi(base_test.PluginApi):
|
||||
self._grafana_port = 443
|
||||
# TODO(pasquier-s): remove this code once all plugins use the
|
||||
# standard ports
|
||||
if self.checkers.check_port(self.get_plugin_vip(), 8000):
|
||||
if self.checkers.check_port(self.get_influxdb_vip(), 8000):
|
||||
self._grafana_port = 8000
|
||||
return self._grafana_port
|
||||
|
||||
@ -59,16 +59,24 @@ class InfluxdbPluginApi(base_test.PluginApi):
|
||||
self.helpers.activate_plugin(
|
||||
self.settings.name, self.settings.version, options)
|
||||
|
||||
def get_plugin_vip(self):
|
||||
return self.helpers.get_plugin_vip(self.settings.vip_name)
|
||||
def get_influxdb_vip(self):
|
||||
return self.helpers.get_vip_address('influxdb')
|
||||
|
||||
def get_grafana_vip(self):
|
||||
if self.settings.version.startswith("0."):
|
||||
# 0.x versions of the plugin uses the same VIP for InfluxDB and
|
||||
# Grafana
|
||||
return self.get_influxdb_vip()
|
||||
else:
|
||||
return self.helpers.get_vip_address('grafana')
|
||||
|
||||
def get_grafana_url(self, path=''):
|
||||
return "{0}://{1}:{2}/{3}".format(self.grafana_protocol,
|
||||
self.get_plugin_vip(),
|
||||
self.get_grafana_vip(),
|
||||
self.grafana_port, path)
|
||||
|
||||
def get_influxdb_url(self, path=''):
|
||||
return "http://{0}:8086/{1}".format(self.get_plugin_vip(), path)
|
||||
return "http://{0}:8086/{1}".format(self.get_influxdb_vip(), path)
|
||||
|
||||
def do_influxdb_query(self,
|
||||
query,
|
||||
|
@ -18,7 +18,7 @@ from stacklight_tests import settings
|
||||
|
||||
name = 'influxdb_grafana'
|
||||
role_name = ['influxdb_grafana']
|
||||
vip_name = 'influxdb'
|
||||
failover_vip = 'influxdb'
|
||||
plugin_path = settings.INFLUXDB_GRAFANA_PLUGIN_PATH
|
||||
version = helpers.get_plugin_version(plugin_path)
|
||||
|
||||
|
@ -31,9 +31,6 @@ class LMACollectorPluginApi(base_test.PluginApi):
|
||||
self.helpers.activate_plugin(
|
||||
self.settings.name, self.settings.version, options)
|
||||
|
||||
def get_plugin_vip(self):
|
||||
pass
|
||||
|
||||
def verify_services(self):
|
||||
"""Check that the correct amount of collector processes are running.
|
||||
|
||||
|
@ -39,7 +39,7 @@ class InfraAlertingPluginApi(base_test.PluginApi):
|
||||
self._nagios_port = 443
|
||||
# TODO(pasquier-s): remove this code once all plugins use the
|
||||
# standard ports
|
||||
if self.checkers.check_port(self.get_plugin_vip(), 8001):
|
||||
if self.checkers.check_port(self.get_nagios_vip(), 8001):
|
||||
self._nagios_port = 8001
|
||||
return self._nagios_port
|
||||
|
||||
@ -61,12 +61,8 @@ class InfraAlertingPluginApi(base_test.PluginApi):
|
||||
self.helpers.activate_plugin(
|
||||
self.settings.name, self.settings.version, options)
|
||||
|
||||
def get_plugin_vip(self):
|
||||
try:
|
||||
return self.helpers.get_plugin_vip(self.settings.vip_name)
|
||||
except Exception:
|
||||
return self.helpers.get_plugin_vip(
|
||||
'infrastructure_alerting_mgmt_vip')
|
||||
def get_nagios_vip(self):
|
||||
return self.helpers.get_vip_address('infrastructure_alerting_ui')
|
||||
|
||||
def check_plugin_online(self):
|
||||
nagios_url = self.get_nagios_url()
|
||||
@ -87,12 +83,12 @@ class InfraAlertingPluginApi(base_test.PluginApi):
|
||||
return "{0}://{1}:{2}@{3}:{4}".format(self.nagios_protocol,
|
||||
self.settings.nagios_user,
|
||||
self.settings.nagios_password,
|
||||
self.get_plugin_vip(),
|
||||
self.get_nagios_vip(),
|
||||
self.nagios_port)
|
||||
|
||||
def get_nagios_url(self):
|
||||
return "{0}://{1}:{2}".format(self.nagios_protocol,
|
||||
self.get_plugin_vip(), self.nagios_port)
|
||||
self.get_nagios_vip(), self.nagios_port)
|
||||
|
||||
def open_nagios_page(self, link_text, anchor):
|
||||
driver = self.ui_tester.get_driver(self.get_authenticated_nagios_url(),
|
||||
|
@ -17,7 +17,7 @@ from stacklight_tests import settings
|
||||
|
||||
name = 'lma_infrastructure_alerting'
|
||||
role_name = ['infrastructure_alerting']
|
||||
vip_name = 'infrastructure_alerting_ui'
|
||||
failover_vip = 'infrastructure_alerting_ui'
|
||||
plugin_path = settings.LMA_INFRA_ALERTING_PLUGIN_PATH
|
||||
version = helpers.get_plugin_version(plugin_path)
|
||||
|
||||
|
@ -122,9 +122,9 @@ class TestToolchainDedicatedEnvironment(api.ToolchainApi):
|
||||
logger.info("Existing cluster id: {}".format(self.helpers.cluster_id))
|
||||
|
||||
# Get the IP addresses for the existing environment
|
||||
elasticsearch_ip = self.ELASTICSEARCH_KIBANA.get_plugin_vip()
|
||||
elasticsearch_ip = self.ELASTICSEARCH_KIBANA.get_elasticsearch_vip()
|
||||
logger.info("Elasticsearch VIP: {}".format(elasticsearch_ip))
|
||||
influxdb_ip = self.INFLUXDB_GRAFANA.get_plugin_vip()
|
||||
influxdb_ip = self.INFLUXDB_GRAFANA.get_influxdb_vip()
|
||||
logger.info("InfluxDB VIP: {}".format(influxdb_ip))
|
||||
|
||||
self.helpers.create_cluster(
|
||||
|
Loading…
Reference in New Issue
Block a user