Browse Source

Merge "Fix proxy issue for etcd and k8s" into stable/ussuri

changes/74/744174/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
02446cfc96
4 changed files with 16 additions and 6 deletions
  1. +1
    -0
      magnum/drivers/common/templates/kubernetes/fragments/configure-etcd.sh
  2. +8
    -1
      magnum/drivers/heat/k8s_template_def.py
  3. +5
    -5
      magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
  4. +2
    -0
      magnum/tests/unit/drivers/test_template_definition.py

+ 1
- 0
magnum/drivers/common/templates/kubernetes/fragments/configure-etcd.sh View File

@@ -58,6 +58,7 @@ After=network-online.target
Wants=network-online.target

[Service]
EnvironmentFile=/etc/sysconfig/heat-params
ExecStartPre=mkdir -p /var/lib/etcd
ExecStartPre=-/bin/podman rm etcd
ExecStart=/bin/podman run \\


+ 8
- 1
magnum/drivers/heat/k8s_template_def.py View File

@@ -119,6 +119,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
cluster_attr=None)
self.add_output('kube_masters_private',
cluster_attr=None)
self.default_subnet_cidr = '10.0.0.0/24'

def get_nodegroup_param_maps(self, master_params=None, worker_params=None):
master_params = master_params or dict()
@@ -205,6 +206,12 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
extra_params['fixed_subnet_cidr'] = neutron.get_subnet(
context, subnet_id, "id", "cidr")

if cluster_template.no_proxy:
extra_params["no_proxy"] = (
cluster_template.no_proxy + "," + (
extra_params.get('fixed_subnet_cidr') or
self.default_subnet_cidr))

return extra_params

def get_params(self, context, cluster_template, cluster, **kwargs):
@@ -283,7 +290,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
def _set_master_lb_allowed_cidrs(self, context, cluster, extra_params):
if extra_params.get("master_lb_allowed_cidrs"):
subnet_cidr = (cluster.labels.get("fixed_subnet_cidr") or
"10.0.0.0/24")
self.default_subnet_cidr)
if extra_params.get("fixed_subnet"):
subnet_cidr = neutron.get_subnet(context,
extra_params["fixed_subnet"],


+ 5
- 5
magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py View File

@@ -335,7 +335,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'influx_grafana_dashboard_enabled': 'True',
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy',
'no_proxy': 'no_proxy,20.200.0.0/16',
'username': 'fake_user',
'cluster_uuid': self.cluster_dict['uuid'],
'magnum_url': self.mock_osc.magnum_url.return_value,
@@ -487,7 +487,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'master_flavor': 'master_flavor_id',
'minion_flavor': 'flavor_id',
'network_driver': 'network_driver',
'no_proxy': 'no_proxy',
'no_proxy': 'no_proxy,20.200.0.0/16',
'number_of_masters': 1,
'number_of_minions': 1,
'region_name': 'RegionOne',
@@ -748,7 +748,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'etcd_volume_size': None,
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy',
'no_proxy': 'no_proxy,20.200.0.0/16',
'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26',
'flannel_backend': 'vxlan',
@@ -862,7 +862,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'etcd_volume_size': None,
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy',
'no_proxy': 'no_proxy,20.200.0.0/16',
'nodes_affinity_policy': 'soft-anti-affinity',
'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26',
@@ -1103,7 +1103,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'etcd_volume_type': '',
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy',
'no_proxy': 'no_proxy,20.200.0.0/16',
'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26',
'flannel_backend': 'vxlan',


+ 2
- 0
magnum/tests/unit/drivers/test_template_definition.py View File

@@ -424,6 +424,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
mock_cluster_template.network_driver = 'flannel'
external_network_id = '17e4e301-b7f3-4996-b3dd-97b3a700174b'
mock_cluster_template.external_network_id = external_network_id
mock_cluster_template.no_proxy = ""
mock_cluster = mock.MagicMock()
fixed_network_name = 'fixed_network'
mock_get_fixed_network_name.return_value = fixed_network_name
@@ -956,6 +957,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
mock_cluster_template.network_driver = 'calico'
external_network_id = '17e4e301-b7f3-4996-b3dd-97b3a700174b'
mock_cluster_template.external_network_id = external_network_id
mock_cluster_template.no_proxy = ""
mock_cluster = mock.MagicMock()
fixed_network_name = 'fixed_network'
mock_cluster.fixed_network = fixed_network_name


Loading…
Cancel
Save