nodes.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def create_policy_pod(hostname, owner, token):
    def _create_pod():
        if db.session.query(Pod).filter_by(
                name=KUBERDOCK_POLICY_POD_NAME, owner=owner).first():
            return True

        try:
            policy_conf = get_policy_agent_config(MASTER_IP, token)
            check_internal_pod_data(policy_conf, owner)
            policy_pod = PodCollection(owner).add(policy_conf, skip_check=True)
            PodCollection(owner).update(policy_pod['id'],
                                        {'command': 'synchronous_start'})
            return True
        except (IntegrityError, APIError):
            # Either pod already exists or an error occurred during it's
            # creation - log and retry
            current_app.logger.exception(
                'During "{}" node creation tried to create a Network Policy '
                'service pod but got an error.'.format(hostname))

    return retry(_create_pod, 1, 5, exc=APIError('Could not create Network '
                                                 'Policy service POD'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号