deploy.py 文件源码

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

项目:devops 作者: closeio 项目源码 文件源码
def render_k8s_resource(file_name, variables):
    """Render k8s resource files using jinga2.

    Args:
        file_name: A filename string for the yaml template
        version: Version string will be used as the jinja version variable
        tag: Image tag string will be used as a jinga imagetag variable

    Returns:
        Rendered resource dict

    """

    with open(file_name, 'r') as deploy_file:
        deploy_string = deploy_file.read()

    deploy_template = jinja2.Template(deploy_string)
    deploy_template.environment.undefined = jinja2.StrictUndefined
    deploy_string = deploy_template.render(variables)

    return yaml.load(deploy_string)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号