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
4e39dd4b
Commit
4e39dd4b
authored
Nov 07, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16925 from mikedanese/headless-fix-1
Auto commit by PR queue bot
parents
0abc12ce
09295cd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
validation.go
pkg/api/validation/validation.go
+1
-1
validation_test.go
pkg/api/validation/validation_test.go
+8
-0
No files found.
pkg/api/validation/validation.go
View file @
4e39dd4b
...
...
@@ -1228,7 +1228,7 @@ func ValidateService(service *api.Service) errs.ValidationErrorList {
allErrs
:=
errs
.
ValidationErrorList
{}
allErrs
=
append
(
allErrs
,
ValidateObjectMeta
(
&
service
.
ObjectMeta
,
true
,
ValidateServiceName
)
.
Prefix
(
"metadata"
)
...
)
if
len
(
service
.
Spec
.
Ports
)
==
0
{
if
len
(
service
.
Spec
.
Ports
)
==
0
&&
service
.
Spec
.
ClusterIP
!=
api
.
ClusterIPNone
{
allErrs
=
append
(
allErrs
,
errs
.
NewFieldRequired
(
"spec.ports"
))
}
if
service
.
Spec
.
Type
==
api
.
ServiceTypeLoadBalancer
{
...
...
pkg/api/validation/validation_test.go
View file @
4e39dd4b
...
...
@@ -1798,6 +1798,14 @@ func TestValidateService(t *testing.T) {
numErrs
:
1
,
},
{
name
:
"missing ports but headless"
,
tweakSvc
:
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
=
nil
s
.
Spec
.
ClusterIP
=
api
.
ClusterIPNone
},
numErrs
:
0
,
},
{
name
:
"empty port[0] name"
,
tweakSvc
:
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
[
0
]
.
Name
=
""
...
...
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