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
5f908c22
Commit
5f908c22
authored
Feb 23, 2018
by
hangaoshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused function negotiate() and writeYAML()
parent
9a75b4d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
50 deletions
+0
-50
config.go
staging/src/k8s.io/apiserver/pkg/admission/config.go
+0
-24
negotiate.go
...apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
+0
-26
No files found.
staging/src/k8s.io/apiserver/pkg/admission/config.go
View file @
5f908c22
...
...
@@ -29,7 +29,6 @@ import (
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/apis/apiserver"
...
...
@@ -177,26 +176,3 @@ func (p configProvider) ConfigFor(pluginName string) (io.Reader, error) {
// there is no registered config that matches on plugin name.
return
nil
,
nil
}
// writeYAML writes the specified object to a byte array as yaml.
func
writeYAML
(
obj
runtime
.
Object
,
scheme
*
runtime
.
Scheme
)
([]
byte
,
error
)
{
gvks
,
_
,
err
:=
scheme
.
ObjectKinds
(
obj
)
if
err
!=
nil
{
return
nil
,
err
}
gvs
:=
[]
schema
.
GroupVersion
{}
for
_
,
gvk
:=
range
gvks
{
gvs
=
append
(
gvs
,
gvk
.
GroupVersion
())
}
codecs
:=
serializer
.
NewCodecFactory
(
scheme
)
json
,
err
:=
runtime
.
Encode
(
codecs
.
LegacyCodec
(
gvs
...
),
obj
)
if
err
!=
nil
{
return
nil
,
err
}
content
,
err
:=
yaml
.
JSONToYAML
(
json
)
if
err
!=
nil
{
return
nil
,
err
}
return
content
,
err
}
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
View file @
5f908c22
...
...
@@ -119,32 +119,6 @@ func isPrettyPrint(req *http.Request) bool {
return
false
}
// negotiate the most appropriate content type given the accept header and a list of
// alternatives.
func
negotiate
(
header
string
,
alternatives
[]
string
)
(
goautoneg
.
Accept
,
bool
)
{
alternates
:=
make
([][]
string
,
0
,
len
(
alternatives
))
for
_
,
alternate
:=
range
alternatives
{
alternates
=
append
(
alternates
,
strings
.
SplitN
(
alternate
,
"/"
,
2
))
}
for
_
,
clause
:=
range
goautoneg
.
ParseAccept
(
header
)
{
for
_
,
alternate
:=
range
alternates
{
if
clause
.
Type
==
alternate
[
0
]
&&
clause
.
SubType
==
alternate
[
1
]
{
return
clause
,
true
}
if
clause
.
Type
==
alternate
[
0
]
&&
clause
.
SubType
==
"*"
{
clause
.
SubType
=
alternate
[
1
]
return
clause
,
true
}
if
clause
.
Type
==
"*"
&&
clause
.
SubType
==
"*"
{
clause
.
Type
=
alternate
[
0
]
clause
.
SubType
=
alternate
[
1
]
return
clause
,
true
}
}
}
return
goautoneg
.
Accept
{},
false
}
// EndpointRestrictions is an interface that allows content-type negotiation
// to verify server support for specific options
type
EndpointRestrictions
interface
{
...
...
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