From ad085f78fe6e39b0b1a4d743bad82194975786f4 Mon Sep 17 00:00:00 2001 From: Jonathan Wills Date: Fri, 18 Sep 2015 09:51:32 -0400 Subject: [PATCH] If an isolator's request is nil, populate it with the limit and vice versa. The appc spec isn't currently clear about if both fields are required, and before rkt v0.8.1 if either field was nil it would result in a crash. Currently rkt will ignore isolators that don't have both fields set, so I think this is a reasonable approach to making sure isolators are actually used. --- pkg/kubelet/rkt/rkt.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/rkt/rkt.go b/pkg/kubelet/rkt/rkt.go index c1680ebcd1f..a707d9d0688 100644 --- a/pkg/kubelet/rkt/rkt.go +++ b/pkg/kubelet/rkt/rkt.go @@ -214,10 +214,10 @@ func rawValue(value string) *json.RawMessage { // rawValue converts the request, limit to *json.RawMessage func rawRequestLimit(request, limit string) *json.RawMessage { if request == "" { - return rawValue(fmt.Sprintf(`{"limit":%q}`, limit)) + request = limit } if limit == "" { - return rawValue(fmt.Sprintf(`{"request":%q}`, request)) + limit = request } return rawValue(fmt.Sprintf(`{"request":%q,"limit":%q}`, request, limit)) }