Implement Strategic Merge Patch in apiserver

This commit is contained in:
Sam Ghods
2015-03-13 17:43:14 -07:00
parent e912d5204c
commit 2c977db1b3
13 changed files with 1601 additions and 62 deletions

View File

@@ -101,6 +101,7 @@ type Request struct {
path string
subpath string
params url.Values
headers http.Header
// structural elements of the request that are part of the Kubernetes API conventions
namespace string
@@ -343,6 +344,14 @@ func (r *Request) setParam(paramName, value string) *Request {
return r
}
func (r *Request) SetHeader(key, value string) *Request {
if r.headers == nil {
r.headers = http.Header{}
}
r.headers.Set(key, value)
return r
}
// Timeout makes the request use the given duration as a timeout. Sets the "timeout"
// parameter.
func (r *Request) Timeout(d time.Duration) *Request {
@@ -561,6 +570,7 @@ func (r *Request) DoRaw() ([]byte, error) {
if err != nil {
return nil, err
}
r.req.Header = r.headers
r.resp, err = client.Do(r.req)
if err != nil {
return nil, err