Cloud foundry 带有清单和变量替换的cf v3推送
我有一个v3应用程序,我想部署到两个不同的环境。应用程序名称和某些定义因环境而异,但清单的结构是相同的。例如:Cloud foundry 带有清单和变量替换的cf v3推送,cloud-foundry,cf-cli,Cloud Foundry,Cf Cli,我有一个v3应用程序,我想部署到两个不同的环境。应用程序名称和某些定义因环境而异,但清单的结构是相同的。例如: # manifest_test.yml applications: - name: AppTest processes: - type: web command: start-web.sh instances: 1 - type: worker command: start-worker.sh instances: 1
# manifest_test.yml
applications:
- name: AppTest
processes:
- type: web
command: start-web.sh
instances: 1
- type: worker
command: start-worker.sh
instances: 1
# manifest_prod.yml
applications:
- name: AppProd
processes:
- type: web
command: start-web.sh
instances: 3
- type: worker
command: start-worker.sh
instances: 5
我不想在变量中只做微小的更改就保留重复的清单,而是希望使用一个清单。所以我创造了这样的东西:
# manifest.yml
- name: App((env))
processes:
- type: web
command: start-web.sh
instances: ((web_instances))
- type: worker
command: start-worker.sh
instances: ((worker_instances))
然而,cf v3 apply manifest
似乎没有为替换提供变量的选项(正如cf push
所做的那样)
有没有办法解决这个问题,或者我必须为每个环境使用单独的清单?请尝试一个cf v7 cli测试版。我没有测试它,但是
cf7 push-h
的输出有一个使用--vars
和--vars file
的标志。它还应该使用V3API,以便支持滚动部署等功能
值得一提的是,如果您希望使用CAPIv3功能,您可能应该继续使用cf7测试版。这将为您提供对CAPI v3的最新和最大支持
希望有帮助