| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/usr/bin/env python3
- import yaml
- from pathlib import Path
- repo_root = Path("d:/coding-area/devops/deploy/microservice-helm")
- chart_base = repo_root / "charts"
- # Dubbo services mapping
- dubbo_services = {
- 'shop-recycle-account': 2030,
- 'shop-recycle-data-statistics': 2028,
- 'shop-recycle-dealdata-service': 2032,
- 'shop-recycle-dispatcher': 2033,
- 'shop-recycle-merchant': 2023,
- 'shop-recycle-msg': 2026,
- 'shop-recycle-order-center': 2022,
- 'shop-recycle-order-search': 2034,
- 'shop-recycle-payment': 2027,
- 'shop-recycle-pis': 2025,
- 'shop-recycle-platform': 2021,
- 'shop-recycle-store': 2024,
- 'shop-recycle-wechat': 2031,
- }
- print("为Dubbo服务添加dubbo_port配置...\n")
- for service_name, dubbo_port in dubbo_services.items():
- values_path = chart_base / service_name / "values.yaml"
-
- if not values_path.exists():
- print(f"WARNING: {service_name} values.yaml not found")
- continue
-
- try:
- with open(values_path, 'r', encoding='utf-8') as f:
- values = yaml.safe_load(f)
- except Exception as e:
- print(f"ERROR reading {service_name}: {e}")
- continue
-
- # Add dubbo_port to service section
- if 'service' not in values:
- values['service'] = {}
-
- values['service']['dubbo_port'] = dubbo_port
-
- # Write back
- try:
- with open(values_path, 'w', encoding='utf-8') as f:
- yaml.dump(values, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
- print(f"✓ {service_name}: 添加dubbo_port: {dubbo_port}")
- except Exception as e:
- print(f"ERROR writing {service_name}: {e}")
- print("\n所有Dubbo服务配置完成!")
|