appmanager适配更新

This commit is contained in:
sreworks 2022-03-22 16:33:57 +08:00
parent 9f9bd97eac
commit 88e76a5637
4 changed files with 13 additions and 7 deletions

View File

@ -74,8 +74,8 @@ def init_cluster():
items = requests.get("%s/clusters" % ENDPOINT, headers=HEADERS).json().get('data', {}).get('items', [])
for item in items:
cluster_mapping[item['clusterId']] = {
'masterUrl': item['clusterConfig']['masterUrl'],
'oauthToken': item['clusterConfig']['oauthToken'],
'masterUrl': item.get('clusterConfig',{}).get('masterUrl'),
'oauthToken': item.get('clusterConfig',{}).get('oauthToken'),
}
# 获取当前的 masterUrl 和 oauthToken 信息
@ -88,7 +88,7 @@ def init_cluster():
for cluster in clusters:
if not cluster_mapping.get(cluster):
_insert_cluster(cluster, master_url, oauth_token)
elif cluster_mapping[cluster]['masterUrl'] != master_url or cluster_mapping[cluster]['oauthToken'] != oauth_token:
elif cluster_mapping[cluster].get('masterUrl') != master_url or cluster_mapping[cluster].get('oauthToken') != oauth_token:
_update_cluster(cluster, master_url, oauth_token)
else:
logger.info('no need to update cluster %s' % cluster)

View File

@ -2,7 +2,7 @@ FROM maven:3.8.3-adoptopenjdk-11 AS build
COPY . /app
RUN mkdir /root/.m2/ && curl https://sreworks.oss-cn-beijing.aliyuncs.com/test/settings.xml -o /root/.m2/settings.xml
WORKDIR /app
RUN mvn -Dmaven.test.skip=true clean package -U -q
RUN mvn -Dmaven.test.skip=true clean package -U
# Release
FROM maven:3.8.3-adoptopenjdk-11 AS release
@ -20,4 +20,4 @@ COPY --from=build /app/${APP_NAME}-start-standalone/target/${APP_NAME}/BOOT-INF/
RUN wget -O /app/helm "https://abm-storage.oss-cn-zhangjiakou.aliyuncs.com/lib/helm" && chmod +x /app/helm
WORKDIR /app
ENTRYPOINT ["/app/sbin/run_sreworks.sh"]
ENTRYPOINT ["/app/sbin/run_sreworks.sh"]

View File

@ -82,6 +82,13 @@ public enum DeployComponentStateEnum {
return FAILURE;
}
break;
case EXCEPTION:
if (DeployComponentEventEnum.OP_RETRY.equals(event)) {
return PROCESSING;
} else if (DeployComponentEventEnum.OP_TERMINATE.equals(event)) {
return FAILURE;
}
break;
default:
return null;
}

View File

@ -125,8 +125,7 @@ public class RunningDeployComponentStateAction implements DeployComponentStateAc
} catch (Exception e) {
response = GetDeployComponentHandlerRes.builder()
.status(DeployComponentStateEnum.WAIT_FOR_OP)
.message(String.format("get component status failed|request=%s|exception=%s",
JSONObject.toJSONString(request), ExceptionUtils.getStackTrace(e)))
.message(String.format("deploy components failed|errorMessage=%s", ExceptionUtils.getStackTrace(e)))
.build();
}
switch (response.getStatus()) {