查询条件修改
This commit is contained in:
parent
f09c82d7ab
commit
eeaefa0eb6
1
go.mod
1
go.mod
|
@ -2,7 +2,6 @@ module gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes
|
|||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.4
|
||||
|
||||
require (
|
||||
github.com/prometheus/client_golang v1.17.0
|
||||
|
|
|
@ -112,12 +112,12 @@ func apply(cloud *pcmCore.CloudInfo, svc *svc.ServiceContext) {
|
|||
|
||||
func DeploymentHandler(cloudInfo *pcmCore.CloudInfo, svc *svc.ServiceContext) {
|
||||
// 遍历core端任务列表信息
|
||||
deploymentList, err := svc.ClientSet.AppsV1().Deployments("").List(context.Background(), metav1.ListOptions{})
|
||||
deploymentList, err := svc.ClientSet.AppsV1().Deployments(cloudInfo.Namespace).List(context.Background(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, deployment := range deploymentList.Items {
|
||||
if deployment.Namespace == cloudInfo.Namespace && deployment.Name == cloudInfo.Name {
|
||||
if deployment.Name == cloudInfo.Name {
|
||||
cloudInfo.StartTime = tool.TimeRemoveZone(deployment.Status.Conditions[0].LastTransitionTime.Time).String()
|
||||
// 判断状态
|
||||
if deployment.Status.Replicas == 0 && deployment.Status.ReadyReplicas != 0 {
|
||||
|
@ -133,13 +133,13 @@ func DeploymentHandler(cloudInfo *pcmCore.CloudInfo, svc *svc.ServiceContext) {
|
|||
|
||||
func StatefulSetHandler(cloudInfo *pcmCore.CloudInfo, svc *svc.ServiceContext) {
|
||||
// 遍历core端任务列表信息
|
||||
stsList, err := svc.ClientSet.AppsV1().StatefulSets("").List(context.Background(), metav1.ListOptions{})
|
||||
stsList, err := svc.ClientSet.AppsV1().StatefulSets(cloudInfo.Namespace).List(context.Background(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, sts := range stsList.Items {
|
||||
if sts.Namespace == cloudInfo.Namespace && sts.Name == cloudInfo.Name {
|
||||
cloudInfo.StartTime = tool.TimeRemoveZone(sts.Status.Conditions[0].LastTransitionTime.Time).String()
|
||||
if sts.Name == cloudInfo.Name {
|
||||
cloudInfo.StartTime = tool.TimeRemoveZone(sts.CreationTimestamp.Time).String()
|
||||
// 判断状态
|
||||
if sts.Status.Replicas == 0 && sts.Status.ReadyReplicas != 0 {
|
||||
cloudInfo.Status = "Updating"
|
||||
|
|
Loading…
Reference in New Issue