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
1d589600
Commit
1d589600
authored
Oct 18, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global Scheme for API group.
parent
2b938b98
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
21 deletions
+21
-21
server.go
cmd/kube-proxy/app/server.go
+2
-7
scheme.go
pkg/proxy/apis/proxyconfig/scheme/scheme.go
+19
-14
No files found.
cmd/kube-proxy/app/server.go
View file @
1d589600
...
...
@@ -164,16 +164,11 @@ func AddFlags(options *Options, fs *pflag.FlagSet) {
}
func
NewOptions
()
(
*
Options
,
error
)
{
scheme
,
codecs
,
err
:=
scheme
.
NewSchemeAndCodecs
()
if
err
!=
nil
{
return
nil
,
err
}
o
:=
&
Options
{
config
:
new
(
proxyconfig
.
KubeProxyConfiguration
),
healthzPort
:
ports
.
ProxyHealthzPort
,
scheme
:
scheme
,
codecs
:
*
c
odecs
,
scheme
:
scheme
.
Scheme
,
codecs
:
scheme
.
C
odecs
,
}
return
o
,
nil
...
...
pkg/proxy/apis/proxyconfig/scheme/scheme.go
View file @
1d589600
...
...
@@ -17,24 +17,29 @@ limitations under the License.
package
scheme
import
(
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/proxy/apis/proxyconfig"
"k8s.io/kubernetes/pkg/proxy/apis/proxyconfig/v1alpha1"
)
// Utility functions for the Kube-proxy's "kubeproxy.k8s.io" API group
// NewSchemeAndCodecs is a utility funciton that returns a Scheme and CodecFactory
// that understand the types in the "kubeproxy.k8s.io" API group.
func
NewSchemeAndCodecs
()
(
*
runtime
.
Scheme
,
*
serializer
.
CodecFactory
,
error
)
{
scheme
:=
runtime
.
NewScheme
()
if
err
:=
proxyconfig
.
AddToScheme
(
scheme
);
err
!=
nil
{
return
nil
,
nil
,
err
}
if
err
:=
v1alpha1
.
AddToScheme
(
scheme
);
err
!=
nil
{
return
nil
,
nil
,
err
}
codecs
:=
serializer
.
NewCodecFactory
(
scheme
)
return
scheme
,
&
codecs
,
nil
var
(
// Scheme defines methods for serializing and deserializing API objects.
Scheme
=
runtime
.
NewScheme
()
// Codecs provides methods for retrieving codecs and serializers for specific
// versions and content types.
Codecs
=
serializer
.
NewCodecFactory
(
Scheme
)
)
func
init
()
{
v1
.
AddToGroupVersion
(
Scheme
,
schema
.
GroupVersion
{
Version
:
"v1"
})
AddToScheme
(
Scheme
)
}
// AddToScheme adds the types of this group into the given scheme.
func
AddToScheme
(
scheme
*
runtime
.
Scheme
)
{
v1alpha1
.
AddToScheme
(
scheme
)
proxyconfig
.
AddToScheme
(
scheme
)
}
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