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
1cfaf2bd
Unverified
Commit
1cfaf2bd
authored
Feb 23, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74454 from bart0sh/PR0064-kubeadm-1419-fix-ValidateURLs
kubeadm: fix url validation code
parents
0133d141
f8d235be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
validation.go
cmd/kubeadm/app/apis/kubeadm/validation/validation.go
+8
-4
No files found.
cmd/kubeadm/app/apis/kubeadm/validation/validation.go
View file @
1cfaf2bd
...
@@ -321,12 +321,16 @@ func ValidateURLs(urls []string, requireHTTPS bool, fldPath *field.Path) field.E
...
@@ -321,12 +321,16 @@ func ValidateURLs(urls []string, requireHTTPS bool, fldPath *field.Path) field.E
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
for
_
,
urlstr
:=
range
urls
{
for
_
,
urlstr
:=
range
urls
{
u
,
err
:=
url
.
Parse
(
urlstr
)
u
,
err
:=
url
.
Parse
(
urlstr
)
if
err
!=
nil
||
u
.
Scheme
==
""
{
if
err
!=
nil
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
urlstr
,
"not a valid URL"
))
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
urlstr
,
fmt
.
Sprintf
(
"URL parse error: %v"
,
err
)))
continue
}
}
if
requireHTTPS
&&
u
.
Scheme
!=
"https"
{
if
requireHTTPS
&&
u
.
Scheme
!=
"https"
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
urlstr
,
"the URL must be using the HTTPS scheme"
))
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
urlstr
,
"the URL must be using the HTTPS scheme"
))
}
}
if
u
.
Scheme
==
""
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
urlstr
,
"the URL without scheme is not allowed"
))
}
}
}
return
allErrs
return
allErrs
}
}
...
@@ -476,7 +480,7 @@ func ValidateSocketPath(socket string, fldPath *field.Path) field.ErrorList {
...
@@ -476,7 +480,7 @@ func ValidateSocketPath(socket string, fldPath *field.Path) field.ErrorList {
u
,
err
:=
url
.
Parse
(
socket
)
u
,
err
:=
url
.
Parse
(
socket
)
if
err
!=
nil
{
if
err
!=
nil
{
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"
url
parsing error: %v"
,
err
)))
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"
URL
parsing error: %v"
,
err
)))
}
}
if
u
.
Scheme
==
""
{
if
u
.
Scheme
==
""
{
...
@@ -484,7 +488,7 @@ func ValidateSocketPath(socket string, fldPath *field.Path) field.ErrorList {
...
@@ -484,7 +488,7 @@ func ValidateSocketPath(socket string, fldPath *field.Path) field.ErrorList {
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"path is not absolute: %s"
,
socket
)))
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"path is not absolute: %s"
,
socket
)))
}
}
}
else
if
u
.
Scheme
!=
kubeadmapiv1beta1
.
DefaultUrlScheme
{
}
else
if
u
.
Scheme
!=
kubeadmapiv1beta1
.
DefaultUrlScheme
{
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"
url
scheme %s is not supported"
,
u
.
Scheme
)))
return
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
socket
,
fmt
.
Sprintf
(
"
URL
scheme %s is not supported"
,
u
.
Scheme
)))
}
}
return
allErrs
return
allErrs
...
...
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