向 JUJU 包添加配置选项

向 JUJU 包添加配置选项

你好,我想部署一个捆绑包,它bundle.yaml看起来像这样:

series: trusty
services:
  testcharm:
    charm: "./trusty/testcharm"
    num_units: 1
    to:
      - "0"
  neo4j:
    charm: "./trusty/test_neo4j"
    num_units: 1
    to:
      - "1"
relations:
  - - "neo4j:db"
    - "testcharm:db"
machines:
  "0":
    series: trusty
    constraints: "arch=amd64 cpu-cores=1 cpu-power=100 mem=1740 root-disk=8192"
  "1":
    series: trusty
    constraints: "arch=amd64 cpu-cores=1 cpu-power=100 mem=1740 root-disk=8192"

现在我需要更改我config.yaml的 testcharm,因为我添加的选项在每个模型中都不同。有没有办法在包中添加特定服务的配置选项,以便使用该选项进行部署?

答案1

您可以使用它options:bundle.yaml为特定的魅力添加特定的配置值。

series: trusty
services:
  testcharm:
    charm: "./trusty/testcharm"
    num_units: 1
    to:
      - "0"
    options:
      config-option: "config value"
  neo4j:
    charm: "./trusty/test_neo4j"
    num_units: 1
    to:
      - "1"
    options:
      port: "7474"
relations:
  - - "neo4j:db"
    - "testcharm:db"
machines:
  "0":
    series: trusty
    constraints: "arch=amd64 cpu-cores=1 cpu-power=100 mem=1740 root-disk=8192"
  "1":
    series: trusty
    constraints: "arch=amd64 cpu-cores=1 cpu-power=100 mem=1740 root-disk=8192"

我编辑了。如果您的 neo4j 中bundle.yaml有选项,您可以使用上面包中的选项覆盖该值。portconfig.yaml

相关内容