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
241f3d70
Commit
241f3d70
authored
Nov 15, 2014
by
Deyuan Deng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude service itself when checking conflict.
parent
29b73cc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
validation.go
pkg/api/validation/validation.go
+3
-1
rest.go
pkg/registry/service/rest.go
+0
-1
rest_test.go
pkg/registry/service/rest_test.go
+8
-0
No files found.
pkg/api/validation/validation.go
View file @
241f3d70
...
...
@@ -431,7 +431,9 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context
allErrs
=
append
(
allErrs
,
errs
.
NewInternalError
(
err
))
}
else
{
for
i
:=
range
services
.
Items
{
if
services
.
Items
[
i
]
.
Spec
.
CreateExternalLoadBalancer
&&
services
.
Items
[
i
]
.
Spec
.
Port
==
service
.
Spec
.
Port
{
if
services
.
Items
[
i
]
.
Name
!=
service
.
Name
&&
services
.
Items
[
i
]
.
Spec
.
CreateExternalLoadBalancer
&&
services
.
Items
[
i
]
.
Spec
.
Port
==
service
.
Spec
.
Port
{
allErrs
=
append
(
allErrs
,
errs
.
NewConflict
(
"service"
,
service
.
Name
,
fmt
.
Errorf
(
"Port: %d is already in use"
,
service
.
Spec
.
Port
)))
break
}
...
...
pkg/registry/service/rest.go
View file @
241f3d70
...
...
@@ -82,7 +82,6 @@ func reloadIPsFromStorage(ipa *ipAllocator, registry Registry) {
}
func
(
rs
*
REST
)
Create
(
ctx
api
.
Context
,
obj
runtime
.
Object
)
(
<-
chan
apiserver
.
RESTResult
,
error
)
{
service
:=
obj
.
(
*
api
.
Service
)
if
!
api
.
ValidNamespace
(
ctx
,
&
service
.
ObjectMeta
)
{
return
nil
,
errors
.
NewConflict
(
"service"
,
service
.
Namespace
,
fmt
.
Errorf
(
"Service.Namespace does not match the provided context"
))
...
...
pkg/registry/service/rest_test.go
View file @
241f3d70
...
...
@@ -641,6 +641,14 @@ func TestServiceRegistryIPExternalLoadBalancer(t *testing.T) {
if
created_service
.
Spec
.
ProxyPort
!=
6502
{
t
.
Errorf
(
"Unexpected ProxyPort: %d"
,
created_service
.
Spec
.
ProxyPort
)
}
update
:=
new
(
api
.
Service
)
*
update
=
*
created_service
_
,
err
:=
rest
.
Update
(
ctx
,
update
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error %v"
,
err
)
}
}
func
TestServiceRegistryIPReloadFromStorage
(
t
*
testing
.
T
)
{
...
...
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