milvus/tests/python_client/customize/config_parser.py
yanliang567 3fe5a66ace
[skip ci]Add test steps to config framework (#10073)
Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2021-10-18 11:38:36 +08:00

36 lines
1.1 KiB
Python

from benedict import benedict
from common.common_func import gen_unique_str
from utils.util_log import test_log as log
def update_configs(yaml):
if not isinstance(yaml, dict):
log.error("customize configurations must be in dict type")
return None
template_yaml = 'template/default.yaml'
_configs = benedict.from_yaml(template_yaml)
for key in yaml.keys():
_configs[key] = yaml[key]
filename = gen_unique_str('cus_config')
customized_yaml = f'template/{filename}.yaml'
customized_yaml = _configs.to_yaml(filepath=customized_yaml)
return customized_yaml
if __name__ == '__main__':
cus_configs = {'spec.components.image': 'milvusdb/milvus-dev:master-latest',
'metadata.namespace': 'qa-milvus',
'spec.components.dataNode.replicas': 2,
'spec.components.queryNode.replicas': 2,
'spec.components.queryNode.resources.limits.memory': '2048Mi'
}
# create_custom_resource(template_config, cus_configs)
# upgrade_custom_resource(cus_configs)
# delete_custom_resource(release_name)
update_configs(cus_configs)