Skip to content

Commit

Permalink
Merge pull request #1179 from cnlkl/issue_1172
Browse files Browse the repository at this point in the history
feat: 忽略扩缩容分析任务Deployment时409错误 #1172
  • Loading branch information
owenlxu authored Sep 18, 2023
2 parents 0705b3f + 5952f3e commit 50c8e81
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class KubernetesDeploymentDispatcher(
if (e.code != HttpStatus.NOT_FOUND.value()) {
throw e
}
logger.info("delete deployment[$deploymentName] success")
logger.warn("delete deployment[$deploymentName], not found")
}
}
}
Expand Down Expand Up @@ -118,14 +118,21 @@ class KubernetesDeploymentDispatcher(
"from ${deployment.spec!!.replicas} to $targetReplicas"
)
deployment.spec!!.replicas = targetReplicas
// 更新Deployment
api!!.replaceNamespacedDeployment(
deployment.metadata!!.name!!,
deployment.metadata!!.namespace!!,
deployment,
null, null, null
)
logger.info("scale deployment[${deployment.metadata!!.name}] success")
try {
// 更新Deployment
api!!.replaceNamespacedDeployment(
deployment.metadata!!.name!!,
deployment.metadata!!.namespace!!,
deployment,
null, null, null
)
logger.info("scale deployment[${deployment.metadata!!.name}] success")
} catch (e: ApiException) {
if (e.code != HttpStatus.CONFLICT.value()) {
throw e
}
logger.warn("scale deployment[${deployment.metadata!!.name}] conflict, targetReplicas[$targetReplicas]")
}
}
}

Expand Down

0 comments on commit 50c8e81

Please sign in to comment.