配置管理
本章介绍如何通过IaC代码描述配置信息,支持私有配置和公共配置两种类型。
IaC3.0公共配置集模型与私有配置项绝大部分字段参数一样,具体请参见表1。
|
参数 |
是否必选 |
类型 |
说明 |
格式校验 |
|---|---|---|---|---|
|
name |
是 |
string |
配置集名称
|
建议:^[A-Za-z0-9_]{1,64} |
|
type |
是 |
string |
资源类型
|
- |
|
prefix |
否 |
string |
为虚机订阅坐标,虚机部署按prefix前缀来订阅配置,容器场景下不填。
|
|
|
version |
私有配置必填 公共配置无此字段 |
string |
配置版本 |
满足正则:^[A-Za-z0-9_.,:()-]{1,100} |
|
schema |
否 |
object |
配置项属性,描述配置项类型和作用。 properties属性为key-object格式,key是配置名称,object是配置项各项描述。 |
N/A description:最大长度256。 format当前支持的类型如表2所示。 |
|
records |
是 |
object |
描述配置,key:value格式,key为配置名称,value为配置值。 |
records数组内:
|
format为schema下的一个字段,对配置进行说明,不同的配置项在使用方式上有所不同。
|
类型 |
中文 |
说明 |
|---|---|---|
|
notype |
未分类 |
不提供时配置项默认为未分类的类型。 |
|
sensitive |
敏感配置项 |
标记此配置项为敏感配置项,此类配置项存储的是配置在STS的路径,非配置密文。 |
|
env |
环境 |
- |
|
business |
调优 |
- |
|
thirdparty |
对接三方配置 |
- |
|
system |
业务系统配置项 |
- |
|
middleware |
中间件配置 |
- |
|
internal |
对接内部服务配置 |
- |
|
function |
服务功能调优配置 |
- |
|
oap |
OAP |
- |
私有配置样例:
name: my_config
type: WiseCloud::MicroService::PrivateConfig
properties:
prefix: /app/cloudeye/WiseeyeConfig/v1/rnd
version: v1
schema:
type: object
properties:
keyl:
description:
type: string
format: notype
key2:
description:
type: string
format: sensitive
records:
key1: value1
key2: value2
公共配置样例:
name: test_config_lhq
type: WiseCloud::MicroService::PublicConfig
properties:
prefix: /public/cloudeye/wiseEyeConfigService
schema:
type: object
properties:
key_lhq1:
description: KEY1相关描述
type: string
format: notype
key_lhq2:
description: KEY2相关描述
type: string
format: notype
records:
key_lhq1: value_lhq1
key_lhq2: value_lhq2