在部署了一个新的马拉松应用程序组,其层次结构如下(注意,为了可读性,显示为yaml而不是json):
id: root_id
groups:
- id: data_center_id
groups:
- id: category_id
groups:
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
我现在想在类别级别添加一个额外的子组,所以现在看起来是这样的:
id: root_id
groups:
- id: data_center_id
groups:
- id: category_id
groups:
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
# this is the new subgroup to add
- id: category_id
groups:
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
- id: app_or_svc_type_id
apps
- id: app_id
....
- id: app_id
....
- id: app_id
....
当我尝试通过使用marathonrestapi的put执行此操作时,现有的组将被销毁,新的子组将被创建。也许我在这里遗漏了一些东西,但是要添加新的微服务(例如,向现有的应用程序组层次结构添加新的微服务),这个功能是至关重要的。
感谢您的帮助
2条答案
按热度按时间tcomlyy61#
我不太清楚你到底做了什么。告诉我们您的确切http请求可能会有所帮助。
您的问题可能是您的组和应用程序的ID不正确。有时,这会导致忽略组/应用程序而没有任何明显的错误:https://github.com/mesosphere/marathon/issues/1890
下面的http请求对我有效。
创建具有一个子组的初始组:
使用包含其他子组的新定义更新组:
已存在的应用程序/组保持不变。
或者,您也可以使用
PUT
请求到/v2/groups/group/subgroup2
只有那个小组的定义。prdp8dxp2#
要添加子组,只需
PUT
或者POST
在您的例子中,完全指定了其id的子组/root_id/data_center_id/category_id
.