mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-08-11 21:14:34 +00:00
Merge pull request #245 from knightXun/multus
refactor k8sclient: rename some val
This commit is contained in:
commit
ec9dff343c
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user