@@ -321,7 +321,7 @@ func (r *runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
321321 continue
322322 }
323323
324- podID := podInfo .PodInfo .Spec .Labels ["UID" ]
324+ podID := podInfo .PodInfo .Spec .Labels [KEY_API_POD_UID ]
325325 podName , podNamespace , err := kubecontainer .ParsePodFullName (podInfo .PodName )
326326 if err != nil {
327327 glog .V (5 ).Infof ("Hyper: pod %s is not managed by kubelet" , podInfo .PodName )
@@ -599,9 +599,15 @@ func (r *runtime) buildHyperPod(pod *api.Pod, restartCount int, pullSecrets []ap
599599 specMap [KEY_RESOURCE ] = podResource
600600 glog .V (5 ).Infof ("Hyper: pod limit vcpu=%v mem=%vMiB" , podResource [KEY_VCPU ], podResource [KEY_MEMORY ])
601601
602+ // Setup labels
603+ podLabels := map [string ]string {KEY_API_POD_UID : string (pod .UID )}
604+ for k , v := range pod .Labels {
605+ podLabels [k ] = v
606+ }
607+ specMap [KEY_LABELS ] = podLabels
608+
602609 // other params required
603610 specMap [KEY_ID ] = kubecontainer .BuildPodFullName (pod .Name , pod .Namespace )
604- specMap [KEY_LABELS ] = map [string ]string {"UID" : string (pod .UID )}
605611 specMap [KEY_TTY ] = false
606612
607613 // Cap hostname at 63 chars (specification is 64bytes which is 63 chars and the null terminating char).
@@ -655,7 +661,7 @@ func (r *runtime) getPodSpec(podFullName string) (string, error) {
655661 return string (spec ), nil
656662}
657663
658- func (r * runtime ) GetPodStartCount (podID string ) (int , error ) {
664+ func (r * runtime ) GetPodRestartCount (podID string ) (int , error ) {
659665 containers , err := r .hyperClient .ListContainers ()
660666 if err != nil {
661667 return 0 , err
@@ -829,7 +835,7 @@ func (r *runtime) SyncPod(pod *api.Pod, podStatus api.PodStatus, internalPodStat
829835 podID , err := r .hyperClient .GetPodIDByName (podFullName )
830836 if err == nil && len (podID ) > 0 {
831837 // Update pod restart count
832- restartCount , err = r .GetPodStartCount (podID )
838+ restartCount , err = r .GetPodRestartCount (podID )
833839 if err != nil {
834840 glog .Errorf ("Hyper: get pod startcount failed: %v" , err )
835841 return err
0 commit comments