Merge "Fix some bugs related Kubernetes MgmtDriver"
This commit is contained in:
commit
0cd9cd8404
|
@ -287,6 +287,7 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
vnf_instance, grant):
|
vnf_instance, grant):
|
||||||
zone_id = ''
|
zone_id = ''
|
||||||
host_compute = ''
|
host_compute = ''
|
||||||
|
srv_grp_phy_res_id_list = []
|
||||||
nest_resources_list = heatclient.resources.list(
|
nest_resources_list = heatclient.resources.list(
|
||||||
stack_id=nest_stack_id)
|
stack_id=nest_stack_id)
|
||||||
for nest_res in nest_resources_list:
|
for nest_res in nest_resources_list:
|
||||||
|
@ -297,8 +298,8 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
srv_grp_policies = pod_affinity_res_info.attributes.get(
|
srv_grp_policies = pod_affinity_res_info.attributes.get(
|
||||||
'policy')
|
'policy')
|
||||||
if srv_grp_policies and srv_grp_policies == 'anti-affinity':
|
if srv_grp_policies and srv_grp_policies == 'anti-affinity':
|
||||||
srv_grp_phy_res_id = pod_affinity_res_info.\
|
srv_grp_phy_res_id_list.append(
|
||||||
physical_resource_id
|
pod_affinity_res_info.physical_resource_id)
|
||||||
lowest_res_list = heatclient.resources.list(stack_id=stack_id)
|
lowest_res_list = heatclient.resources.list(stack_id=stack_id)
|
||||||
for lowest_res in lowest_res_list:
|
for lowest_res in lowest_res_list:
|
||||||
if lowest_res.resource_type == 'OS::Nova::Server':
|
if lowest_res.resource_type == 'OS::Nova::Server':
|
||||||
|
@ -307,7 +308,9 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
stack_id=stack_id, resource_name=lowest_res_name)
|
stack_id=stack_id, resource_name=lowest_res_name)
|
||||||
srv_groups = worker_node_res_info.attributes.get(
|
srv_groups = worker_node_res_info.attributes.get(
|
||||||
'server_groups')
|
'server_groups')
|
||||||
if srv_groups and srv_grp_phy_res_id in srv_groups:
|
srv_grp_phy_res_id = set(
|
||||||
|
srv_grp_phy_res_id_list) & set(srv_groups)
|
||||||
|
if srv_grp_phy_res_id:
|
||||||
host_compute = worker_node_res_info.attributes.get(
|
host_compute = worker_node_res_info.attributes.get(
|
||||||
'OS-EXT-SRV-ATTR:host')
|
'OS-EXT-SRV-ATTR:host')
|
||||||
if self.SET_ZONE_ID_FLAG:
|
if self.SET_ZONE_ID_FLAG:
|
||||||
|
@ -648,7 +651,7 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
self._execute_command(
|
self._execute_command(
|
||||||
commander, ssh_command,
|
commander, ssh_command,
|
||||||
PR_CMD_TIMEOUT, 'common', 0)
|
PR_CMD_TIMEOUT, 'common', 0)
|
||||||
transport.close()
|
break
|
||||||
except paramiko.SSHException as e:
|
except paramiko.SSHException as e:
|
||||||
LOG.debug(e)
|
LOG.debug(e)
|
||||||
retry -= 1
|
retry -= 1
|
||||||
|
@ -657,6 +660,13 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
commander.close_session()
|
commander.close_session()
|
||||||
raise paramiko.SSHException()
|
raise paramiko.SSHException()
|
||||||
time.sleep(SERVER_WAIT_COMPLETE_TIME)
|
time.sleep(SERVER_WAIT_COMPLETE_TIME)
|
||||||
|
except (exceptions.MgmtDriverOtherError,
|
||||||
|
exceptions.MgmtDriverRemoteCommandError) as ex:
|
||||||
|
LOG.error(ex)
|
||||||
|
commander.close_session()
|
||||||
|
raise ex
|
||||||
|
finally:
|
||||||
|
transport.close()
|
||||||
|
|
||||||
# connect to private registries
|
# connect to private registries
|
||||||
for pr_info in pr_connection_info:
|
for pr_info in pr_connection_info:
|
||||||
|
@ -2149,7 +2159,7 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
storage_server_param = vnf_instance.instantiated_vnf_info \
|
storage_server_param = vnf_instance.instantiated_vnf_info \
|
||||||
.additional_params.get('k8s_cluster_installation_param')\
|
.additional_params.get('k8s_cluster_installation_param')\
|
||||||
.get('storage_server', {})
|
.get('storage_server', {})
|
||||||
target_ss_cp_name = storage_server_param.get('ssh_cp_name', None)
|
target_ss_cp_name = storage_server_param.get('nic_cp_name', None)
|
||||||
for vnfc_instance_id in heal_vnf_request.vnfc_instance_id:
|
for vnfc_instance_id in heal_vnf_request.vnfc_instance_id:
|
||||||
instantiated_vnf_info = vnf_instance.instantiated_vnf_info
|
instantiated_vnf_info = vnf_instance.instantiated_vnf_info
|
||||||
vnfc_resource_info = instantiated_vnf_info.vnfc_resource_info
|
vnfc_resource_info = instantiated_vnf_info.vnfc_resource_info
|
||||||
|
@ -2711,9 +2721,19 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
stack_id=stack_id,
|
stack_id=stack_id,
|
||||||
resource_name=ssh_cp_name
|
resource_name=ssh_cp_name
|
||||||
)
|
)
|
||||||
ssh_ip_address = resource_info.attributes \
|
ssh_ip_address = resource_info.attributes.get('floating_ip_address')
|
||||||
.get('fixed_ips')[0].get('ip_address')
|
if ssh_ip_address is None and resource_info.attributes.get(
|
||||||
if not ssh_ip_address:
|
'fixed_ips'):
|
||||||
|
ssh_ip_address = resource_info.attributes.get(
|
||||||
|
'fixed_ips')[0].get('ip_address')
|
||||||
|
|
||||||
|
try:
|
||||||
|
ipaddress.ip_address(ssh_ip_address)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.MgmtDriverOtherError(
|
||||||
|
error_message="The IP address of "
|
||||||
|
"Storage server VM is invalid.")
|
||||||
|
if ssh_ip_address is None:
|
||||||
raise exceptions.MgmtDriverOtherError(
|
raise exceptions.MgmtDriverOtherError(
|
||||||
error_message="Failed to get IP address for "
|
error_message="Failed to get IP address for "
|
||||||
"Storage server VM")
|
"Storage server VM")
|
||||||
|
|
|
@ -33,7 +33,7 @@ resources:
|
||||||
max_size: 5
|
max_size: 5
|
||||||
desired_capacity: 3
|
desired_capacity: 3
|
||||||
resource:
|
resource:
|
||||||
type: master_instance.hot.yaml
|
type: podaffinity_nested_master.yaml
|
||||||
properties:
|
properties:
|
||||||
flavor: { get_param: [ nfv, VDU, masterNode, flavor ] }
|
flavor: { get_param: [ nfv, VDU, masterNode, flavor ] }
|
||||||
image: { get_param: [ nfv, VDU, masterNode, image ] }
|
image: { get_param: [ nfv, VDU, masterNode, image ] }
|
||||||
|
@ -64,7 +64,7 @@ resources:
|
||||||
max_size: 4
|
max_size: 4
|
||||||
desired_capacity: 2
|
desired_capacity: 2
|
||||||
resource:
|
resource:
|
||||||
type: worker_instance.hot.yaml
|
type: podaffinity_nested_worker.yaml
|
||||||
properties:
|
properties:
|
||||||
flavor: { get_param: [ nfv, VDU, workerNode, flavor ] }
|
flavor: { get_param: [ nfv, VDU, workerNode, flavor ] }
|
||||||
image: { get_param: [ nfv, VDU, workerNode, image ] }
|
image: { get_param: [ nfv, VDU, workerNode, image ] }
|
||||||
|
|
|
@ -373,7 +373,7 @@ class KubesprayMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
'ansible_host': master_vm.get('ssh_ip'),
|
'ansible_host': master_vm.get('ssh_ip'),
|
||||||
'ip': master_vm.get('nic_ip'),
|
'ip': master_vm.get('nic_ip'),
|
||||||
'ansible_user': master_node.get('username'),
|
'ansible_user': master_node.get('username'),
|
||||||
'ansible_password': master_node.get('username'),
|
'ansible_password': master_node.get('password'),
|
||||||
}
|
}
|
||||||
hosts_yaml_content['all']['children']['kube_control_plane'][
|
hosts_yaml_content['all']['children']['kube_control_plane'][
|
||||||
'hosts'][key] = None
|
'hosts'][key] = None
|
||||||
|
@ -386,7 +386,7 @@ class KubesprayMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||||
'ansible_host': worker_vm.get('ssh_ip'),
|
'ansible_host': worker_vm.get('ssh_ip'),
|
||||||
'ip': worker_vm.get('nic_ip'),
|
'ip': worker_vm.get('nic_ip'),
|
||||||
'ansible_user': worker_node.get('username'),
|
'ansible_user': worker_node.get('username'),
|
||||||
'ansible_password': worker_node.get('username'),
|
'ansible_password': worker_node.get('password'),
|
||||||
}
|
}
|
||||||
hosts_yaml_content['all']['children']['kube_node'][
|
hosts_yaml_content['all']['children']['kube_node'][
|
||||||
'hosts'][key] = None
|
'hosts'][key] = None
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
import ipaddress
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -69,14 +69,19 @@ class PrivateRegistryMgmtDriver(
|
||||||
# get IP address from heat
|
# get IP address from heat
|
||||||
resource_info = heatclient.resources.get(
|
resource_info = heatclient.resources.get(
|
||||||
stack_id=stack_id, resource_name=cp_name)
|
stack_id=stack_id, resource_name=cp_name)
|
||||||
fixed_ips = resource_info.attributes.get("fixed_ips")
|
cp_ip_address = resource_info.attributes.get('floating_ip_address')
|
||||||
if fixed_ips:
|
if cp_ip_address is None and resource_info.attributes.get('fixed_ips'):
|
||||||
cp_ip_address = fixed_ips[0].get("ip_address")
|
cp_ip_address = resource_info.attributes.get(
|
||||||
else:
|
'fixed_ips')[0].get("ip_address")
|
||||||
cp_ip_address = ""
|
|
||||||
|
|
||||||
# check result
|
# check result
|
||||||
if not cp_ip_address:
|
try:
|
||||||
|
ipaddress.ip_address(cp_ip_address)
|
||||||
|
except ValueError:
|
||||||
|
err_msg = "The IP address of Private registry VM is invalid."
|
||||||
|
LOG.error(err_msg)
|
||||||
|
raise exceptions.MgmtDriverOtherError(error_message=err_msg)
|
||||||
|
if cp_ip_address is None:
|
||||||
err_msg = "Failed to get IP address for Private registry VM"
|
err_msg = "Failed to get IP address for Private registry VM"
|
||||||
LOG.error(err_msg)
|
LOG.error(err_msg)
|
||||||
raise exceptions.MgmtDriverOtherError(error_message=err_msg)
|
raise exceptions.MgmtDriverOtherError(error_message=err_msg)
|
||||||
|
|
Loading…
Reference in New Issue