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
e15ac9eb
Commit
e15ac9eb
authored
Jul 06, 2018
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kube-apiserver: disallow --secure-port 0
parent
e32f380f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
options_test.go
cmd/kube-apiserver/app/options/options_test.go
+1
-0
serving.go
pkg/kubeapiserver/options/serving.go
+1
-0
serving.go
staging/src/k8s.io/apiserver/pkg/server/options/serving.go
+13
-4
No files found.
cmd/kube-apiserver/app/options/options_test.go
View file @
e15ac9eb
...
...
@@ -166,6 +166,7 @@ func TestAddFlags(t *testing.T) {
PairName
:
"apiserver"
,
},
HTTP2MaxStreamsPerConnection
:
42
,
Required
:
true
,
}),
InsecureServing
:
&
kubeoptions
.
InsecureServingOptions
{
BindAddress
:
net
.
ParseIP
(
"127.0.0.1"
),
...
...
pkg/kubeapiserver/options/serving.go
View file @
e15ac9eb
...
...
@@ -36,6 +36,7 @@ func NewSecureServingOptions() *genericoptions.SecureServingOptionsWithLoopback
return
genericoptions
.
WithLoopback
(
&
genericoptions
.
SecureServingOptions
{
BindAddress
:
net
.
ParseIP
(
"0.0.0.0"
),
BindPort
:
6443
,
Required
:
true
,
ServerCert
:
genericoptions
.
GeneratableKeyCert
{
PairName
:
"apiserver"
,
CertDirectory
:
"/var/run/kubernetes"
,
...
...
staging/src/k8s.io/apiserver/pkg/server/options/serving.go
View file @
e15ac9eb
...
...
@@ -40,6 +40,8 @@ type SecureServingOptions struct {
// BindNetwork is the type of network to bind to - defaults to "tcp", accepts "tcp",
// "tcp4", and "tcp6".
BindNetwork
string
// Required set to true means that BindPort cannot be zero.
Required
bool
// Listener is the secure server network listener.
// either Listener or BindAddress/BindPort/BindNetwork is set,
...
...
@@ -102,7 +104,9 @@ func (s *SecureServingOptions) Validate() []error {
errors
:=
[]
error
{}
if
s
.
BindPort
<
0
||
s
.
BindPort
>
65535
{
if
s
.
Required
&&
s
.
BindPort
<
1
||
s
.
BindPort
>
65535
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"--secure-port %v must be between 1 and 65535, inclusive. It cannot turned off with 0"
,
s
.
BindPort
))
}
else
if
s
.
BindPort
<
0
||
s
.
BindPort
>
65535
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"--secure-port %v must be between 0 and 65535, inclusive. 0 for turning off secure port"
,
s
.
BindPort
))
}
...
...
@@ -118,9 +122,14 @@ func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet) {
"The IP address on which to listen for the --secure-port port. The "
+
"associated interface(s) must be reachable by the rest of the cluster, and by CLI/web "
+
"clients. If blank, all interfaces will be used (0.0.0.0 for all IPv4 interfaces and :: for all IPv6 interfaces)."
)
fs
.
IntVar
(
&
s
.
BindPort
,
"secure-port"
,
s
.
BindPort
,
""
+
"The port on which to serve HTTPS with authentication and authorization. If 0, "
+
"don't serve HTTPS at all."
)
desc
:=
"The port on which to serve HTTPS with authentication and authorization."
if
s
.
Required
{
desc
+=
"It cannot switched off with 0."
}
else
{
desc
+=
"If 0, don't serve HTTPS at all."
}
fs
.
IntVar
(
&
s
.
BindPort
,
"secure-port"
,
s
.
BindPort
,
desc
)
fs
.
StringVar
(
&
s
.
ServerCert
.
CertDirectory
,
"cert-dir"
,
s
.
ServerCert
.
CertDirectory
,
""
+
"The directory where the TLS certs are located. "
+
...
...
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