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
2b938b98
Commit
2b938b98
authored
Oct 18, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use const GroupName instead of hard-code.
parent
75b9fb28
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
11 deletions
+11
-11
server_others.go
cmd/kube-proxy/app/server_others.go
+1
-1
server_test.go
cmd/kube-proxy/app/server_test.go
+5
-5
server_windows.go
cmd/kube-proxy/app/server_windows.go
+1
-1
register.go
pkg/proxy/apis/proxyconfig/register.go
+1
-1
scheme.go
pkg/proxy/apis/proxyconfig/scheme/scheme.go
+2
-2
register.go
pkg/proxy/apis/proxyconfig/v1alpha1/register.go
+1
-1
No files found.
cmd/kube-proxy/app/server_others.go
View file @
2b938b98
...
@@ -58,7 +58,7 @@ func NewProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
...
@@ -58,7 +58,7 @@ func NewProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
return
nil
,
errors
.
New
(
"config is required"
)
return
nil
,
errors
.
New
(
"config is required"
)
}
}
if
c
,
err
:=
configz
.
New
(
"proxyconfig"
);
err
==
nil
{
if
c
,
err
:=
configz
.
New
(
proxyconfigapi
.
GroupName
);
err
==
nil
{
c
.
Set
(
config
)
c
.
Set
(
config
)
}
else
{
}
else
{
return
nil
,
fmt
.
Errorf
(
"unable to register configz: %s"
,
err
)
return
nil
,
fmt
.
Errorf
(
"unable to register configz: %s"
,
err
)
...
...
cmd/kube-proxy/app/server_test.go
View file @
2b938b98
...
@@ -149,7 +149,7 @@ func TestNewOptionsFailures(t *testing.T) {
...
@@ -149,7 +149,7 @@ func TestNewOptionsFailures(t *testing.T) {
simulatedErrorTest
:=
func
(
target
string
)
{
simulatedErrorTest
:=
func
(
target
string
)
{
var
addToScheme
*
func
(
s
*
k8sRuntime
.
Scheme
)
error
var
addToScheme
*
func
(
s
*
k8sRuntime
.
Scheme
)
error
if
target
==
"proxyconfig"
{
if
target
==
proxyconfig
.
GroupName
{
addToScheme
=
&
proxyconfig
.
AddToScheme
addToScheme
=
&
proxyconfig
.
AddToScheme
}
else
{
}
else
{
addToScheme
=
&
v1alpha1
.
AddToScheme
addToScheme
=
&
v1alpha1
.
AddToScheme
...
@@ -165,7 +165,7 @@ func TestNewOptionsFailures(t *testing.T) {
...
@@ -165,7 +165,7 @@ func TestNewOptionsFailures(t *testing.T) {
}
}
// Simulate errors in calls to AddToScheme()
// Simulate errors in calls to AddToScheme()
faultTargets
:=
[]
string
{
"proxyconfig"
,
"v1alpha1"
}
faultTargets
:=
[]
string
{
proxyconfig
.
GroupName
,
"v1alpha1"
}
for
_
,
target
:=
range
faultTargets
{
for
_
,
target
:=
range
faultTargets
{
simulatedErrorTest
(
target
)
simulatedErrorTest
(
target
)
}
}
...
@@ -197,7 +197,7 @@ func TestProxyServerWithCleanupAndExit(t *testing.T) {
...
@@ -197,7 +197,7 @@ func TestProxyServerWithCleanupAndExit(t *testing.T) {
assert
.
True
(
t
,
proxyserver
.
CleanupAndExit
,
"false CleanupAndExit, addr: %s"
,
addr
)
assert
.
True
(
t
,
proxyserver
.
CleanupAndExit
,
"false CleanupAndExit, addr: %s"
,
addr
)
// Clean up config for next test case
// Clean up config for next test case
configz
.
Delete
(
"proxyconfig"
)
configz
.
Delete
(
proxyconfig
.
GroupName
)
}
}
}
}
...
@@ -262,7 +262,7 @@ func TestGetConntrackMax(t *testing.T) {
...
@@ -262,7 +262,7 @@ func TestGetConntrackMax(t *testing.T) {
// TestLoadConfig tests proper operation of loadConfig()
// TestLoadConfig tests proper operation of loadConfig()
func
TestLoadConfig
(
t
*
testing
.
T
)
{
func
TestLoadConfig
(
t
*
testing
.
T
)
{
yamlTemplate
:=
`apiVersion:
proxyconfig
/v1alpha1
yamlTemplate
:=
`apiVersion:
kubeproxy.k8s.io
/v1alpha1
bindAddress: %s
bindAddress: %s
clientConnection:
clientConnection:
acceptContentTypes: "abc"
acceptContentTypes: "abc"
...
@@ -447,7 +447,7 @@ func TestLoadConfigFailures(t *testing.T) {
...
@@ -447,7 +447,7 @@ func TestLoadConfigFailures(t *testing.T) {
expErr
:
"mapping values are not allowed in this context"
,
expErr
:
"mapping values are not allowed in this context"
,
},
},
}
}
version
:=
"apiVersion:
proxyconfig
/v1alpha1"
version
:=
"apiVersion:
kubeproxy.k8s.io
/v1alpha1"
for
_
,
tc
:=
range
testCases
{
for
_
,
tc
:=
range
testCases
{
options
,
_
:=
NewOptions
()
options
,
_
:=
NewOptions
()
config
:=
fmt
.
Sprintf
(
"%s
\n
%s"
,
version
,
tc
.
config
)
config
:=
fmt
.
Sprintf
(
"%s
\n
%s"
,
version
,
tc
.
config
)
...
...
cmd/kube-proxy/app/server_windows.go
View file @
2b938b98
...
@@ -51,7 +51,7 @@ func NewProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
...
@@ -51,7 +51,7 @@ func NewProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
return
nil
,
errors
.
New
(
"config is required"
)
return
nil
,
errors
.
New
(
"config is required"
)
}
}
if
c
,
err
:=
configz
.
New
(
"proxyconfig"
);
err
==
nil
{
if
c
,
err
:=
configz
.
New
(
proxyconfigapi
.
GroupName
);
err
==
nil
{
c
.
Set
(
config
)
c
.
Set
(
config
)
}
else
{
}
else
{
return
nil
,
fmt
.
Errorf
(
"unable to register configz: %s"
,
err
)
return
nil
,
fmt
.
Errorf
(
"unable to register configz: %s"
,
err
)
...
...
pkg/proxy/apis/proxyconfig/register.go
View file @
2b938b98
...
@@ -27,7 +27,7 @@ var (
...
@@ -27,7 +27,7 @@ var (
)
)
// GroupName is the group name use in this package
// GroupName is the group name use in this package
const
GroupName
=
"
proxyconfig
"
const
GroupName
=
"
kubeproxy.k8s.io
"
// SchemeGroupVersion is group version used to register these objects
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
runtime
.
APIVersionInternal
}
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
runtime
.
APIVersionInternal
}
...
...
pkg/proxy/apis/proxyconfig/scheme/scheme.go
View file @
2b938b98
...
@@ -23,10 +23,10 @@ import (
...
@@ -23,10 +23,10 @@ import (
"k8s.io/kubernetes/pkg/proxy/apis/proxyconfig/v1alpha1"
"k8s.io/kubernetes/pkg/proxy/apis/proxyconfig/v1alpha1"
)
)
// Utility functions for the Kube-proxy's
proxyconfig
API group
// Utility functions for the Kube-proxy's
"kubeproxy.k8s.io"
API group
// NewSchemeAndCodecs is a utility funciton that returns a Scheme and CodecFactory
// NewSchemeAndCodecs is a utility funciton that returns a Scheme and CodecFactory
// that understand the types in the
proxyconfig
API group.
// that understand the types in the
"kubeproxy.k8s.io"
API group.
func
NewSchemeAndCodecs
()
(
*
runtime
.
Scheme
,
*
serializer
.
CodecFactory
,
error
)
{
func
NewSchemeAndCodecs
()
(
*
runtime
.
Scheme
,
*
serializer
.
CodecFactory
,
error
)
{
scheme
:=
runtime
.
NewScheme
()
scheme
:=
runtime
.
NewScheme
()
if
err
:=
proxyconfig
.
AddToScheme
(
scheme
);
err
!=
nil
{
if
err
:=
proxyconfig
.
AddToScheme
(
scheme
);
err
!=
nil
{
...
...
pkg/proxy/apis/proxyconfig/v1alpha1/register.go
View file @
2b938b98
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
)
)
// GroupName is the group name use in this package
// GroupName is the group name use in this package
const
GroupName
=
"
proxyconfig
"
const
GroupName
=
"
kubeproxy.k8s.io
"
// SchemeGroupVersion is group version used to register these objects
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1alpha1"
}
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1alpha1"
}
...
...
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