Provide resource version in error if available

This commit is contained in:
Ted Yu 2019-07-06 00:59:20 -07:00 committed by Ted Yu
parent f978c4cab5
commit 6459b61bca

View File

@ -124,6 +124,11 @@ func (s *store) Get(ctx context.Context, key string, resourceVersion string, out
if ignoreNotFound { if ignoreNotFound {
return runtime.SetZeroValue(out) return runtime.SetZeroValue(out)
} }
if len(resourceVersion) > 0 {
if rv, err := s.versioner.ParseResourceVersion(resourceVersion); err == nil {
return storage.NewKeyNotFoundError(key, int64(rv))
}
}
return storage.NewKeyNotFoundError(key, 0) return storage.NewKeyNotFoundError(key, 0)
} }
kv := getResp.Kvs[0] kv := getResp.Kvs[0]