当前位置: 首页>>代码示例>>Python>>正文


Python client.VersionApi方法代码示例

本文整理汇总了Python中kubernetes.client.VersionApi方法的典型用法代码示例。如果您正苦于以下问题:Python client.VersionApi方法的具体用法?Python client.VersionApi怎么用?Python client.VersionApi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kubernetes.client的用法示例。


在下文中一共展示了client.VersionApi方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from kubernetes import client [as 别名]
# 或者: from kubernetes.client import VersionApi [as 别名]
def __init__(self, **kwargs):
        """
        Set cluster and prepare clients for all used resource types.

        Args:
            **kwargs: Keyword arguments (cluster is required)
        """
        # load configuration
        try:
            self.cluster = kwargs['cluster']
        except KeyError:
            raise ValueError('Missing parameter cluster')

        logger.debug('Initialized KubernetesAPI for {}'.format(self.cluster))

        # set apis
        api_client = self.get_api_client()

        self.api_corev1 = client.CoreV1Api(api_client=api_client)
        self.api_storagev1 = client.StorageV1Api(api_client=api_client)
        self.api_extensionsv1beta1 = client.ExtensionsV1beta1Api(api_client=api_client)
        self.api_version = client.VersionApi(api_client=api_client) 
开发者ID:Mirantis,项目名称:kqueen,代码行数:24,代码来源:kubeapi.py

示例2: _handler_provision

# 需要导入模块: from kubernetes import client [as 别名]
# 或者: from kubernetes.client import VersionApi [as 别名]
def _handler_provision(command, resources, priority_evaluator, use_kubeconfig, sync_mode, show_logs):
    kubeconfig_namespace = None

    if priority_evaluator.environment_deprecated():
        log.warning("K8S_HOST and K8S_CA environment variables support is deprecated "
                    "and will be discontinued in the future. Use K8S_MASTER_URI and K8S_CA_BASE64 instead.")

    # INFO rvadim: https://github.com/kubernetes-client/python/issues/430#issuecomment-359483997
    if use_kubeconfig:
        try:
            load_kube_config()
            kubeconfig_namespace = list_kube_config_contexts()[1].get('context').get('namespace')
        except Exception as e:
            raise RuntimeError(e)
    else:
        client.Configuration.set_default(priority_evaluator.k8s_client_configuration())

    settings.K8S_NAMESPACE = priority_evaluator.k8s_namespace_default(kubeconfig_namespace)
    log.info('Default namespace "{}"'.format(settings.K8S_NAMESPACE))

    if not settings.K8S_NAMESPACE:
        log.info("Default namespace is not set. "
                 "This may lead to provisioning error, if namespace is not set for each resource.")

    try:
        deprecation_checker = ApiDeprecationChecker(client.VersionApi().get_code().git_version[1:])
        available_checker = ResourceAvailabilityChecker(make_resource_getters_list())

        for resource in resources:
            deprecation_checker.run(resource)
            available_checker.run(resource)
    except client.api_client.ApiException:
        log.warning("Error while getting API version, deprecation check will be skipped.")

    provisioner = Provisioner(command, sync_mode, show_logs)

    for resource in resources:
        provisioner.run(resource) 
开发者ID:2gis,项目名称:k8s-handle,代码行数:40,代码来源:__init__.py

示例3: version_api_client_from_config

# 需要导入模块: from kubernetes import client [as 别名]
# 或者: from kubernetes.client import VersionApi [as 别名]
def version_api_client_from_config(config):
    if config is None:
        k8sconfig.load_incluster_config()
        return k8sclient.VersionApi()
    else:
        client = k8sclient.ApiClient(configuration=config)
        return k8sclient.VersionApi(api_client=client) 
开发者ID:intel,项目名称:CPU-Manager-for-Kubernetes,代码行数:9,代码来源:k8s.py

示例4: k8s_version_api

# 需要导入模块: from kubernetes import client [as 别名]
# 或者: from kubernetes.client import VersionApi [as 别名]
def k8s_version_api(self):
        if not self._k8s_version_api:
            self._k8s_version_api = client.VersionApi(self.api_client)
        return self._k8s_version_api 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:6,代码来源:manager.py

示例5: create_version_api

# 需要导入模块: from kubernetes import client [as 别名]
# 或者: from kubernetes.client import VersionApi [as 别名]
def create_version_api(self):
        cfg = self.get_kubecfg()
        return client.VersionApi(cfg) 
开发者ID:gardener,项目名称:cc-utils,代码行数:5,代码来源:ctx.py


注:本文中的kubernetes.client.VersionApi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。