File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,7 @@ const (
1313 podItem = "/api/v1/namespaces/%s/pods/%s"
1414 podLog = "/api/v1/namespaces/%s/pods/%s/log"
1515)
16+
17+ var AllowPodStatus = map [string ]bool {
18+ "Running" : true ,
19+ }
Original file line number Diff line number Diff line change @@ -129,6 +129,14 @@ func (i *syncPod) commonCheck(in *v1.Pod) error {
129129 return errors .New ("exclude Suffix " + suffix )
130130 }
131131 }
132+ // 检查状态
133+ if ! AllowPodStatus [string (in .Status .Phase )] {
134+ return errors .New ("pass status " + string (in .Status .Phase ))
135+ }
136+ // 检查容器ip
137+ if strings .TrimSpace (in .Status .PodIP ) == "" {
138+ return errors .New ("pass nil pod ip " )
139+ }
132140 return nil
133141}
134142func (i * syncPod ) add (obj interface {}) {
@@ -147,6 +155,7 @@ func (i *syncPod) add(obj interface{}) {
147155 xlog .String ("step" , "add-print" ),
148156 xlog .String ("zoneCode" , i .zoneCode ),
149157 xlog .String ("podName" , in .Name ),
158+ xlog .String ("status" , string (in .Status .Phase )),
150159 xlog .Any ("lab" , in .Labels ))
151160
152161 err = i .mysqlCreateOrUpdate (i .zoneCode , obj .(* v1.Pod ))
You can’t perform that action at this time.
0 commit comments