Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
af2cedde
Commit
af2cedde
authored
Feb 28, 2019
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump(k8s.io/kube-openapi): b3a7cee44a305be0a69e1b9ac03018307287e1b0
To get
https://github.com/kubernetes/kube-openapi/pull/149
.
parent
7514c49e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
97 deletions
+34
-97
Godeps.json
Godeps/Godeps.json
+14
-14
openapi-gen.go
vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go
+0
-1
handler.go
vendor/k8s.io/kube-openapi/pkg/handler/handler.go
+20
-82
No files found.
Godeps/Godeps.json
View file @
af2cedde
...
@@ -4231,59 +4231,59 @@
...
@@ -4231,59 +4231,59 @@
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/cmd/openapi-gen"
,
"ImportPath"
:
"k8s.io/kube-openapi/cmd/openapi-gen"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/cmd/openapi-gen/args"
,
"ImportPath"
:
"k8s.io/kube-openapi/cmd/openapi-gen/args"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/aggregator"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/aggregator"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/builder"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/builder"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/common"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/common"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/generators"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/generators"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/generators/rules"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/generators/rules"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/handler"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/handler"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/schemaconv"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/schemaconv"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto/testing"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto/testing"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto/validation"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/proto/validation"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/sets"
,
"ImportPath"
:
"k8s.io/kube-openapi/pkg/util/sets"
,
"Rev"
:
"
d7c86cdc46e3a4fcf892b32dd7bc3aa775e0870e
"
"Rev"
:
"
b3a7cee44a305be0a69e1b9ac03018307287e1b0
"
},
},
{
{
"ImportPath"
:
"k8s.io/repo-infra/kazel"
,
"ImportPath"
:
"k8s.io/repo-infra/kazel"
,
...
...
vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go
View file @
af2cedde
...
@@ -54,5 +54,4 @@ func main() {
...
@@ -54,5 +54,4 @@ func main() {
);
err
!=
nil
{
);
err
!=
nil
{
log
.
Fatalf
(
"OpenAPI code generation error: %v"
,
err
)
log
.
Fatalf
(
"OpenAPI code generation error: %v"
,
err
)
}
}
log
.
Println
(
"Code for OpenAPI definitions generated"
)
}
}
vendor/k8s.io/kube-openapi/pkg/handler/handler.go
View file @
af2cedde
...
@@ -23,19 +23,18 @@ import (
...
@@ -23,19 +23,18 @@ import (
"fmt"
"fmt"
"mime"
"mime"
"net/http"
"net/http"
"strings"
"sync"
"sync"
"time"
"time"
"github.com/NYTimes/gziphandler"
"github.com/NYTimes/gziphandler"
restful
"github.com/emicklei/go-restful"
"github.com/emicklei/go-restful"
"github.com/go-openapi/spec"
"github.com/go-openapi/spec"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
openapi_v2
"github.com/googleapis/gnostic/OpenAPIv2"
"github.com/googleapis/gnostic/OpenAPIv2"
"github.com/googleapis/gnostic/compiler"
"github.com/googleapis/gnostic/compiler"
"github.com/json-iterator/go"
"github.com/json-iterator/go"
"github.com/munnerz/goautoneg"
"github.com/munnerz/goautoneg"
yaml
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v2"
"k8s.io/kube-openapi/pkg/builder"
"k8s.io/kube-openapi/pkg/builder"
"k8s.io/kube-openapi/pkg/common"
"k8s.io/kube-openapi/pkg/common"
...
@@ -86,84 +85,6 @@ func NewOpenAPIService(spec *spec.Swagger) (*OpenAPIService, error) {
...
@@ -86,84 +85,6 @@ func NewOpenAPIService(spec *spec.Swagger) (*OpenAPIService, error) {
return
o
,
nil
return
o
,
nil
}
}
// NOTE: [DEPRECATION] We will announce deprecation for format-separated endpoints for OpenAPI spec,
// and switch to a single /openapi/v2 endpoint in Kubernetes 1.10. The design doc and deprecation process
// are tracked at: https://docs.google.com/document/d/19lEqE9lc4yHJ3WJAJxS_G7TcORIJXGHyq3wpwcH28nU.
//
// BuildAndRegisterOpenAPIService builds the spec and registers a handler to provide access to it.
// Use this method if your OpenAPI spec is static. If you want to update the spec, use BuildOpenAPISpec then RegisterOpenAPIService.
func
BuildAndRegisterOpenAPIService
(
servePath
string
,
webServices
[]
*
restful
.
WebService
,
config
*
common
.
Config
,
handler
common
.
PathHandler
)
(
*
OpenAPIService
,
error
)
{
spec
,
err
:=
builder
.
BuildOpenAPISpec
(
webServices
,
config
)
if
err
!=
nil
{
return
nil
,
err
}
o
,
err
:=
NewOpenAPIService
(
spec
)
if
err
!=
nil
{
return
nil
,
err
}
return
o
,
o
.
RegisterOpenAPIService
(
servePath
,
handler
)
}
// NOTE: [DEPRECATION] We will announce deprecation for format-separated endpoints for OpenAPI spec,
// and switch to a single /openapi/v2 endpoint in Kubernetes 1.10. The design doc and deprecation process
// are tracked at: https://docs.google.com/document/d/19lEqE9lc4yHJ3WJAJxS_G7TcORIJXGHyq3wpwcH28nU.
//
// RegisterOpenAPIService registers a handler to provide access to provided swagger spec.
// Note: servePath should end with ".json" as the RegisterOpenAPIService assume it is serving a
// json file and will also serve .pb and .gz files.
//
// Deprecated: use OpenAPIService.RegisterOpenAPIService instead.
func
RegisterOpenAPIService
(
spec
*
spec
.
Swagger
,
servePath
string
,
handler
common
.
PathHandler
)
(
*
OpenAPIService
,
error
)
{
o
,
err
:=
NewOpenAPIService
(
spec
)
if
err
!=
nil
{
return
nil
,
err
}
return
o
,
o
.
RegisterOpenAPIService
(
servePath
,
handler
)
}
// NOTE: [DEPRECATION] We will announce deprecation for format-separated endpoints for OpenAPI spec,
// and switch to a single /openapi/v2 endpoint in Kubernetes 1.10. The design doc and deprecation process
// are tracked at: https://docs.google.com/document/d/19lEqE9lc4yHJ3WJAJxS_G7TcORIJXGHyq3wpwcH28nU.
//
// RegisterOpenAPIService registers a handler to provide access to provided swagger spec.
// Note: servePath should end with ".json" as the RegisterOpenAPIService assume it is serving a
// json file and will also serve .pb and .gz files.
func
(
o
*
OpenAPIService
)
RegisterOpenAPIService
(
servePath
string
,
handler
common
.
PathHandler
)
error
{
if
!
strings
.
HasSuffix
(
servePath
,
jsonExt
)
{
return
fmt
.
Errorf
(
"serving path must end with
\"
%s
\"
"
,
jsonExt
)
}
servePathBase
:=
strings
.
TrimSuffix
(
servePath
,
jsonExt
)
type
fileInfo
struct
{
ext
string
getDataAndETag
func
()
([]
byte
,
string
,
time
.
Time
)
}
files
:=
[]
fileInfo
{
{
".json"
,
o
.
getSwaggerBytes
},
{
"-2.0.0.json"
,
o
.
getSwaggerBytes
},
{
"-2.0.0.pb-v1"
,
o
.
getSwaggerPbBytes
},
{
"-2.0.0.pb-v1.gz"
,
o
.
getSwaggerPbGzBytes
},
}
for
_
,
file
:=
range
files
{
path
:=
servePathBase
+
file
.
ext
getDataAndETag
:=
file
.
getDataAndETag
handler
.
Handle
(
path
,
gziphandler
.
GzipHandler
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
data
,
etag
,
lastModified
:=
getDataAndETag
()
w
.
Header
()
.
Set
(
"Etag"
,
etag
)
// ServeContent will take care of caching using eTag.
http
.
ServeContent
(
w
,
r
,
path
,
lastModified
,
bytes
.
NewReader
(
data
))
}),
))
}
return
nil
}
func
(
o
*
OpenAPIService
)
getSwaggerBytes
()
([]
byte
,
string
,
time
.
Time
)
{
func
(
o
*
OpenAPIService
)
getSwaggerBytes
()
([]
byte
,
string
,
time
.
Time
)
{
o
.
rwMutex
.
RLock
()
o
.
rwMutex
.
RLock
()
defer
o
.
rwMutex
.
RUnlock
()
defer
o
.
rwMutex
.
RUnlock
()
...
@@ -238,6 +159,23 @@ func jsonToYAMLValue(j interface{}) interface{} {
...
@@ -238,6 +159,23 @@ func jsonToYAMLValue(j interface{}) interface{} {
ret
[
i
]
=
jsonToYAMLValue
(
j
[
i
])
ret
[
i
]
=
jsonToYAMLValue
(
j
[
i
])
}
}
return
ret
return
ret
case
float64
:
// replicate the logic in https://github.com/go-yaml/yaml/blob/51d6538a90f86fe93ac480b35f37b2be17fef232/resolve.go#L151
if
i64
:=
int64
(
j
);
j
==
float64
(
i64
)
{
if
i
:=
int
(
i64
);
i64
==
int64
(
i
)
{
return
i
}
return
i64
}
if
ui64
:=
uint64
(
j
);
j
==
float64
(
ui64
)
{
return
ui64
}
return
j
case
int64
:
if
i
:=
int
(
j
);
j
==
int64
(
i
)
{
return
i
}
return
j
}
}
return
j
return
j
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment