Beispiel #1
0
    def _get_helm_chart_location(self, chart_name, repo_name, chart_tarfile):
        """Get the chart location.

        This method returns the download location for a given chart.

        :param chart_name: name of the chart
        :param repo_name: name of the repo that chart uploaded to
        :param chart_tarfile: name of the chart tarfile
        :returns: a URL as location
        """
        if repo_name is None:
            repo_name = common.HELM_REPO_FOR_APPS
        if chart_tarfile is None:
            # TODO: Clean up the assumption
            chart_tarfile = chart_name + '-0.1.0'
        # Set the location based on ip address since
        # http://controller does not resolve in armada container.
        sys_controller_network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_CLUSTER_HOST)
        sys_controller_network_addr_pool = self.dbapi.address_pool_get(sys_controller_network.pool_uuid)
        sc_float_ip = sys_controller_network_addr_pool.floating_address
        if utils.is_valid_ipv6(sc_float_ip):
            sc_float_ip = '[' + sc_float_ip + ']'
        return 'http://{}:{}/helm_charts/{}/{}.tgz'.format(
            sc_float_ip,
            utils.get_http_port(self.dbapi), repo_name, chart_tarfile)
Beispiel #2
0
    def _system_controller_floating_address(self):
        if self.dbapi is None:
            return None

        if not self._distributed_cloud_role():
            return None

        sc_float_ip = self.context.get('_system_controller_floating_address',
                                       None)

        if sc_float_ip is None:
            try:
                sys_controller_network = self.dbapi.network_get_by_type(
                    constants.NETWORK_TYPE_SYSTEM_CONTROLLER)
                sys_controller_network_addr_pool = self.dbapi.address_pool_get(
                    sys_controller_network.pool_uuid)
                sc_float_ip = sys_controller_network_addr_pool.floating_address
            except exception.NetworkTypeNotFound:
                LOG.error("No System Controller Network Type found")
                raise

            if utils.is_valid_ipv6(sc_float_ip):
                sc_float_ip = '[' + sc_float_ip + ']'
            self.context['_system_controller_floating_address'] = sc_float_ip
        return sc_float_ip
Beispiel #3
0
 def test_is_valid_ipv6(self):
     self.assertTrue(utils.is_valid_ipv6("::1"))
     self.assertTrue(utils.is_valid_ipv6(
                         "abcd:ef01:2345:6789:abcd:ef01:192.168.254.254"))
     self.assertTrue(utils.is_valid_ipv6(
                                 "0000:0000:0000:0000:0000:0000:0000:0001"))
     self.assertFalse(utils.is_valid_ipv6("foo"))
     self.assertFalse(utils.is_valid_ipv6("127.0.0.1"))
     self.assertFalse(utils.is_valid_ipv6(""))
     self.assertFalse(utils.is_valid_ipv6(10))