Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit d054268

Browse files
committed
Fix container name parse error
Signed-off-by: feisky <feiskyer@gmail.com>
1 parent 0c49e89 commit d054268

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pkg/kubelet/hyper/hyper.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ func (r *runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
295295

296296
_, _, _, containerName, err := r.parseHyperContainerFullName(cinfo.Name)
297297
if err != nil {
298-
return nil, err
298+
glog.Warningf("Hyper: container %s is not managed by kubelet", cinfo.Name)
299+
continue
299300
}
300301
container.Name = strings.Split(containerName, ".")[0]
301302

@@ -376,7 +377,7 @@ func (r *runtime) buildHyperPod(pod *api.Pod, pullSecrets []api.Secret) ([]byte,
376377

377378
services := r.buildHyperPodServices(pod)
378379
if services == nil {
379-
// Just for fake
380+
// services can't be null for kubernetes, so fake one if it is null
380381
services = []HyperService{
381382
{
382383
ServiceIP: "127.0.0.2",
@@ -773,7 +774,7 @@ func (r *runtime) PullImage(image kubecontainer.ImageSpec, pullSecrets []api.Sec
773774
return fmt.Errorf("Hyper: Failed to pull image: %v", err)
774775
}
775776

776-
if exist, _ = r.hyperClient.IsImagePresent("haproxy", "latest"); !exist {
777+
if exist, _ := r.hyperClient.IsImagePresent("haproxy", "latest"); !exist {
777778
err = r.hyperClient.PullImage("haproxy", credential)
778779
if err != nil {
779780
return fmt.Errorf("Hyper: Failed to pull haproxy image: %v", err)

pkg/proxy/haproxy/proxier.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ func (proxier *Proxier) syncProxyRules() {
350350
continue
351351
}
352352

353-
// Build rules in same namespace
353+
// Build services of same namespace (assume all services within same
354+
// namespace will be consumed)
354355
consumedServices := make([]hyper.HyperService, 0, 1)
355356
for _, svcInfo := range proxier.serviceMap {
356357
if svcInfo.namespace != podNamespace {
@@ -380,7 +381,7 @@ func (proxier *Proxier) syncProxyRules() {
380381

381382
// update existing services
382383
if len(consumedServices) == 0 {
383-
// Just for fake
384+
// services can't be null for kubernetes, so fake one if it is null
384385
consumedServices = append(consumedServices, hyper.HyperService{
385386
ServiceIP: "127.0.0.2",
386387
ServicePort: 65534,

0 commit comments

Comments
 (0)