本文整理汇总了Python中kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig.cluster_nested_underlay_policy_fq_name方法的典型用法代码示例。如果您正苦于以下问题:Python VncKubernetesConfig.cluster_nested_underlay_policy_fq_name方法的具体用法?Python VncKubernetesConfig.cluster_nested_underlay_policy_fq_name怎么用?Python VncKubernetesConfig.cluster_nested_underlay_policy_fq_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig
的用法示例。
在下文中一共展示了VncKubernetesConfig.cluster_nested_underlay_policy_fq_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_attach_policy
# 需要导入模块: from kube_manager.vnc.vnc_kubernetes_config import VncKubernetesConfig [as 别名]
# 或者: from kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig import cluster_nested_underlay_policy_fq_name [as 别名]
def _create_attach_policy(self, ns_name, proj_obj,
ip_fabric_vn_obj, pod_vn_obj, service_vn_obj):
if not self._cluster_service_policy:
cluster_service_np_fq_name = \
vnc_kube_config.cluster_default_service_network_policy_fq_name()
try:
cluster_service_policy = self._vnc_lib. \
network_policy_read(fq_name=cluster_service_np_fq_name)
except NoIdError:
return
self._cluster_service_policy = cluster_service_policy
if not self._ip_fabric_policy:
cluster_ip_fabric_np_fq_name = \
vnc_kube_config.cluster_ip_fabric_policy_fq_name()
try:
cluster_ip_fabric_policy = self._vnc_lib. \
network_policy_read(fq_name=cluster_ip_fabric_np_fq_name)
except NoIdError:
return
self._ip_fabric_policy = cluster_ip_fabric_policy
self._nested_underlay_policy = None
if DBBaseKM.is_nested() and not self._nested_underlay_policy:
try:
name = vnc_kube_config.cluster_nested_underlay_policy_fq_name()
self._nested_underlay_policy = \
self._vnc_lib.network_policy_read(fq_name=name)
except NoIdError:
return
policy_name = "-".join([vnc_kube_config.cluster_name(), ns_name, 'pod-service-np'])
#policy_name = '%s-default' %ns_name
ns_default_policy = self._create_vn_vn_policy(policy_name, proj_obj,
pod_vn_obj, service_vn_obj)
self._attach_policy(pod_vn_obj, ns_default_policy,
self._ip_fabric_policy, self._cluster_service_policy,
self._nested_underlay_policy)
self._attach_policy(service_vn_obj, ns_default_policy,
self._ip_fabric_policy, self._nested_underlay_policy)