Merge pull request #245 from knightXun/multus

refactor k8sclient: rename some val
This commit is contained in:
Doug Smith 2019-02-07 10:19:21 -05:00 committed by GitHub
commit ec9dff343c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
} }