refactor k8sclient: rename some val

This commit is contained in:
knight 2019-01-25 09:54:53 +08:00
parent ac3f0d155e
commit 66595e8172

View File

@ -88,20 +88,20 @@ func SetNetworkStatus(k *clientInfo, netStatus []*types.NetworkStatus) error {
return logging.Errorf("SetNetworkStatus: failed to query the pod %v in out of cluster comm: %v", k.Podname, err) return logging.Errorf("SetNetworkStatus: failed to query the pod %v in out of cluster comm: %v", k.Podname, err)
} }
var ns string var networkStatuses string
if netStatus != nil { if netStatus != nil {
var networkStatus []string var networkStatus []string
for _, nets := range netStatus { for _, status := range netStatus {
data, err := json.MarshalIndent(nets, "", " ") data, err := json.MarshalIndent(status, "", " ")
if err != nil { if err != nil {
return logging.Errorf("SetNetworkStatus: error with Marshal Indent: %v", err) return logging.Errorf("SetNetworkStatus: error with Marshal Indent: %v", err)
} }
networkStatus = append(networkStatus, string(data)) networkStatus = append(networkStatus, string(data))
} }
ns = fmt.Sprintf("[%s]", strings.Join(networkStatus, ",")) networkStatuses = fmt.Sprintf("[%s]", strings.Join(networkStatus, ","))
} }
_, err = setPodNetworkAnnotation(k.Client, k.Podnamespace, pod, ns) _, err = setPodNetworkAnnotation(k.Client, k.Podnamespace, pod, networkStatuses)
if err != nil { if err != nil {
return logging.Errorf("SetNetworkStatus: failed to update the pod %v in out of cluster comm: %v", k.Podname, err) return logging.Errorf("SetNetworkStatus: failed to update the pod %v in out of cluster comm: %v", k.Podname, err)
} }