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
ea834eb2
Unverified
Commit
ea834eb2
authored
Apr 09, 2019
by
Darren Shepherd
Committed by
GitHub
Apr 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #309 from galal-hussein/generic_flags
Add extra flags for server and agent components
parents
184f6973
7794528a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
96 deletions
+159
-96
config.go
pkg/agent/config/config.go
+3
-0
agent.go
pkg/cli/cmds/agent.go
+14
-0
server.go
pkg/cli/cmds/server.go
+33
-13
server.go
pkg/cli/server/server.go
+3
-0
agent.go
pkg/daemons/agent/agent.go
+38
-37
types.go
pkg/daemons/config/types.go
+19
-0
server.go
pkg/daemons/control/server.go
+49
-46
No files found.
pkg/agent/config/config.go
View file @
ea834eb2
...
@@ -249,6 +249,9 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
...
@@ -249,6 +249,9 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
os
.
Setenv
(
"NODE_NAME"
,
nodeConfig
.
AgentConfig
.
NodeName
)
os
.
Setenv
(
"NODE_NAME"
,
nodeConfig
.
AgentConfig
.
NodeName
)
v1beta1
.
KubeletSocket
=
filepath
.
Join
(
envInfo
.
DataDir
,
"kubelet/device-plugins/kubelet.sock"
)
v1beta1
.
KubeletSocket
=
filepath
.
Join
(
envInfo
.
DataDir
,
"kubelet/device-plugins/kubelet.sock"
)
nodeConfig
.
AgentConfig
.
ExtraKubeletArgs
=
envInfo
.
ExtraKubeletArgs
nodeConfig
.
AgentConfig
.
ExtraKubeProxyArgs
=
envInfo
.
ExtraKubeProxyArgs
return
nodeConfig
,
nil
return
nodeConfig
,
nil
}
}
...
...
pkg/cli/cmds/agent.go
View file @
ea834eb2
...
@@ -21,6 +21,8 @@ type Agent struct {
...
@@ -21,6 +21,8 @@ type Agent struct {
NoFlannel
bool
NoFlannel
bool
Debug
bool
Debug
bool
AgentShared
AgentShared
ExtraKubeletArgs
cli
.
StringSlice
ExtraKubeProxyArgs
cli
.
StringSlice
}
}
type
AgentShared
struct
{
type
AgentShared
struct
{
...
@@ -62,6 +64,16 @@ var (
...
@@ -62,6 +64,16 @@ var (
EnvVar
:
"K3S_RESOLV_CONF"
,
EnvVar
:
"K3S_RESOLV_CONF"
,
Destination
:
&
AgentConfig
.
ResolvConf
,
Destination
:
&
AgentConfig
.
ResolvConf
,
}
}
ExtraKubeletArgs
=
cli
.
StringSliceFlag
{
Name
:
"kubelet-arg"
,
Usage
:
"(agent) Customized flag for kubelet process"
,
Value
:
&
AgentConfig
.
ExtraKubeletArgs
,
}
ExtraKubeProxyArgs
=
cli
.
StringSliceFlag
{
Name
:
"kube-proxy-arg"
,
Usage
:
"(agent) Customized flag for kube-proxy process"
,
Value
:
&
AgentConfig
.
ExtraKubeProxyArgs
,
}
)
)
func
NewAgentCommand
(
action
func
(
ctx
*
cli
.
Context
)
error
)
cli
.
Command
{
func
NewAgentCommand
(
action
func
(
ctx
*
cli
.
Context
)
error
)
cli
.
Command
{
...
@@ -107,6 +119,8 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
...
@@ -107,6 +119,8 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
NodeIPFlag
,
NodeIPFlag
,
CRIEndpointFlag
,
CRIEndpointFlag
,
ResolvConfFlag
,
ResolvConfFlag
,
ExtraKubeletArgs
,
ExtraKubeProxyArgs
,
},
},
}
}
}
}
pkg/cli/cmds/server.go
View file @
ea834eb2
...
@@ -5,19 +5,22 @@ import (
...
@@ -5,19 +5,22 @@ import (
)
)
type
Server
struct
{
type
Server
struct
{
Log
string
Log
string
ClusterCIDR
string
ClusterCIDR
string
ClusterSecret
string
ClusterSecret
string
ServiceCIDR
string
ServiceCIDR
string
ClusterDNS
string
ClusterDNS
string
HTTPSPort
int
HTTPSPort
int
HTTPPort
int
HTTPPort
int
DataDir
string
DataDir
string
DisableAgent
bool
DisableAgent
bool
KubeConfigOutput
string
KubeConfigOutput
string
KubeConfigMode
string
KubeConfigMode
string
KnownIPs
cli
.
StringSlice
KnownIPs
cli
.
StringSlice
BindAddress
string
BindAddress
string
ExtraAPIArgs
cli
.
StringSlice
ExtraSchedulerArgs
cli
.
StringSlice
ExtraControllerArgs
cli
.
StringSlice
}
}
var
ServerConfig
Server
var
ServerConfig
Server
...
@@ -106,12 +109,29 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
...
@@ -106,12 +109,29 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Usage
:
"Add additional hostname or IP as a Subject Alternative Name in the TLS cert"
,
Usage
:
"Add additional hostname or IP as a Subject Alternative Name in the TLS cert"
,
Value
:
&
ServerConfig
.
KnownIPs
,
Value
:
&
ServerConfig
.
KnownIPs
,
},
},
cli
.
StringSliceFlag
{
Name
:
"kube-apiserver-arg"
,
Usage
:
"Customized flag for kube-apiserver process"
,
Value
:
&
ServerConfig
.
ExtraAPIArgs
,
},
cli
.
StringSliceFlag
{
Name
:
"kube-scheduler-arg"
,
Usage
:
"Customized flag for kube-scheduler process"
,
Value
:
&
ServerConfig
.
ExtraSchedulerArgs
,
},
cli
.
StringSliceFlag
{
Name
:
"kube-controller-arg"
,
Usage
:
"Customized flag for kube-controller-manager process"
,
Value
:
&
ServerConfig
.
ExtraControllerArgs
,
},
NodeIPFlag
,
NodeIPFlag
,
NodeNameFlag
,
NodeNameFlag
,
DockerFlag
,
DockerFlag
,
FlannelFlag
,
FlannelFlag
,
CRIEndpointFlag
,
CRIEndpointFlag
,
ResolvConfFlag
,
ResolvConfFlag
,
ExtraKubeletArgs
,
ExtraKubeProxyArgs
,
},
},
}
}
}
}
pkg/cli/server/server.go
View file @
ea834eb2
...
@@ -83,6 +83,9 @@ func run(app *cli.Context, cfg *cmds.Server) error {
...
@@ -83,6 +83,9 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig
.
TLSConfig
.
HTTPPort
=
cfg
.
HTTPPort
serverConfig
.
TLSConfig
.
HTTPPort
=
cfg
.
HTTPPort
serverConfig
.
TLSConfig
.
KnownIPs
=
knownIPs
(
cfg
.
KnownIPs
)
serverConfig
.
TLSConfig
.
KnownIPs
=
knownIPs
(
cfg
.
KnownIPs
)
serverConfig
.
TLSConfig
.
BindAddress
=
cfg
.
BindAddress
serverConfig
.
TLSConfig
.
BindAddress
=
cfg
.
BindAddress
serverConfig
.
ControlConfig
.
ExtraAPIArgs
=
cfg
.
ExtraAPIArgs
serverConfig
.
ControlConfig
.
ExtraControllerArgs
=
cfg
.
ExtraControllerArgs
serverConfig
.
ControlConfig
.
ExtraSchedulerAPIArgs
=
cfg
.
ExtraSchedulerArgs
_
,
serverConfig
.
ControlConfig
.
ClusterIPRange
,
err
=
net2
.
ParseCIDR
(
cfg
.
ClusterCIDR
)
_
,
serverConfig
.
ControlConfig
.
ClusterIPRange
,
err
=
net2
.
ParseCIDR
(
cfg
.
ClusterCIDR
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/daemons/agent/agent.go
View file @
ea834eb2
...
@@ -28,14 +28,14 @@ func Agent(config *config.Agent) error {
...
@@ -28,14 +28,14 @@ func Agent(config *config.Agent) error {
return
nil
return
nil
}
}
func
kubeProxy
(
c
onfi
g
*
config
.
Agent
)
{
func
kubeProxy
(
c
f
g
*
config
.
Agent
)
{
args
:=
[
]
string
{
args
Map
:=
map
[
string
]
string
{
"
--proxy-mode"
,
"iptables"
,
"
proxy-mode"
:
"iptables"
,
"
--healthz-bind-address"
,
"127.0.0.1"
,
"
healthz-bind-address"
:
"127.0.0.1"
,
"
--kubeconfig"
,
confi
g
.
KubeConfig
,
"
kubeconfig"
:
cf
g
.
KubeConfig
,
"
--cluster-cidr"
,
confi
g
.
ClusterCIDR
.
String
(),
"
cluster-cidr"
:
cf
g
.
ClusterCIDR
.
String
(),
}
}
args
=
append
(
args
,
config
.
ExtraKubeletArgs
...
)
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraKubeProxyArgs
)
command
:=
app2
.
NewProxyCommand
()
command
:=
app2
.
NewProxyCommand
()
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
@@ -50,63 +50,64 @@ func kubelet(cfg *config.Agent) {
...
@@ -50,63 +50,64 @@ func kubelet(cfg *config.Agent) {
logs
.
InitLogs
()
logs
.
InitLogs
()
defer
logs
.
FlushLogs
()
defer
logs
.
FlushLogs
()
args
:=
[
]
string
{
args
Map
:=
map
[
string
]
string
{
"
--healthz-bind-address"
,
"127.0.0.1"
,
"
healthz-bind-address"
:
"127.0.0.1"
,
"
--read-only-port"
,
"0"
,
"
read-only-port"
:
"0"
,
"
--allow-privileged=
true"
,
"
allow-privileged"
:
"
true"
,
"
--cluster-domain"
,
"cluster.local"
,
"
cluster-domain"
:
"cluster.local"
,
"
--kubeconfig"
,
cfg
.
KubeConfig
,
"
kubeconfig"
:
cfg
.
KubeConfig
,
"
--eviction-hard"
,
"imagefs.available<5%,nodefs.available<5%"
,
"
eviction-hard"
:
"imagefs.available<5%,nodefs.available<5%"
,
"
--eviction-minimum-reclaim"
,
"imagefs.available=10%,nodefs.available=10%"
,
"
eviction-minimum-reclaim"
:
"imagefs.available=10%,nodefs.available=10%"
,
"
--fail-swap-on=
false"
,
"
fail-swap-on"
:
"
false"
,
//"
--cgroup-root",
"/k3s",
//"
cgroup-root":
"/k3s",
"
--cgroup-driver"
,
"cgroupfs"
,
"
cgroup-driver"
:
"cgroupfs"
,
}
}
if
cfg
.
RootDir
!=
""
{
if
cfg
.
RootDir
!=
""
{
args
=
append
(
args
,
"--root-dir"
,
cfg
.
RootDir
)
args
Map
[
"root-dir"
]
=
cfg
.
RootDir
args
=
append
(
args
,
"--cert-dir"
,
filepath
.
Join
(
cfg
.
RootDir
,
"pki"
)
)
args
Map
[
"cert-dir"
]
=
filepath
.
Join
(
cfg
.
RootDir
,
"pki"
)
args
=
append
(
args
,
"--seccomp-profile-root"
,
filepath
.
Join
(
cfg
.
RootDir
,
"seccomp"
)
)
args
Map
[
"seccomp-profile-root"
]
=
filepath
.
Join
(
cfg
.
RootDir
,
"seccomp"
)
}
}
if
cfg
.
CNIConfDir
!=
""
{
if
cfg
.
CNIConfDir
!=
""
{
args
=
append
(
args
,
"--cni-conf-dir"
,
cfg
.
CNIConfDir
)
args
Map
[
"cni-conf-dir"
]
=
cfg
.
CNIConfDir
}
}
if
cfg
.
CNIBinDir
!=
""
{
if
cfg
.
CNIBinDir
!=
""
{
args
=
append
(
args
,
"--cni-bin-dir"
,
cfg
.
CNIBinDir
)
args
Map
[
"cni-bin-dir"
]
=
cfg
.
CNIBinDir
}
}
if
len
(
cfg
.
ClusterDNS
)
>
0
{
if
len
(
cfg
.
ClusterDNS
)
>
0
{
args
=
append
(
args
,
"--cluster-dns"
,
cfg
.
ClusterDNS
.
String
()
)
args
Map
[
"cluster-dns"
]
=
cfg
.
ClusterDNS
.
String
(
)
}
}
if
cfg
.
ResolvConf
!=
""
{
if
cfg
.
ResolvConf
!=
""
{
args
=
append
(
args
,
"--resolv-conf"
,
cfg
.
ResolvConf
)
args
Map
[
"resolv-conf"
]
=
cfg
.
ResolvConf
}
}
if
cfg
.
RuntimeSocket
!=
""
{
if
cfg
.
RuntimeSocket
!=
""
{
args
=
append
(
args
,
"--container-runtime"
,
"remote"
)
args
Map
[
"container-runtime"
]
=
"remote"
args
=
append
(
args
,
"--container-runtime-endpoint"
,
cfg
.
RuntimeSocket
)
args
Map
[
"container-runtime-endpoint"
]
=
cfg
.
RuntimeSocket
args
=
append
(
args
,
"--serialize-image-pulls=false"
)
args
Map
[
"serialize-image-pulls"
]
=
"false"
}
}
if
cfg
.
ListenAddress
!=
""
{
if
cfg
.
ListenAddress
!=
""
{
args
=
append
(
args
,
"--address"
,
cfg
.
ListenAddress
)
args
Map
[
"address"
]
=
cfg
.
ListenAddress
}
}
if
cfg
.
CACertPath
!=
""
{
if
cfg
.
CACertPath
!=
""
{
args
=
append
(
args
,
"--anonymous-auth=false"
,
"--client-ca-file"
,
cfg
.
CACertPath
)
argsMap
[
"anonymous-auth"
]
=
"false"
argsMap
[
"client-ca-file"
]
=
cfg
.
CACertPath
}
}
if
cfg
.
NodeName
!=
""
{
if
cfg
.
NodeName
!=
""
{
args
=
append
(
args
,
"--hostname-override"
,
cfg
.
NodeName
)
args
Map
[
"hostname-override"
]
=
cfg
.
NodeName
}
}
defaultIP
,
err
:=
net
.
ChooseHostInterface
()
defaultIP
,
err
:=
net
.
ChooseHostInterface
()
if
err
!=
nil
||
defaultIP
.
String
()
!=
cfg
.
NodeIP
{
if
err
!=
nil
||
defaultIP
.
String
()
!=
cfg
.
NodeIP
{
args
=
append
(
args
,
"--node-ip"
,
cfg
.
NodeIP
)
args
Map
[
"node-ip"
]
=
cfg
.
NodeIP
}
}
root
,
hasCFS
:=
checkCgroups
()
root
,
hasCFS
:=
checkCgroups
()
if
!
hasCFS
{
if
!
hasCFS
{
logrus
.
Warn
(
"Disabling CPU quotas due to missing cpu.cfs_period_us"
)
logrus
.
Warn
(
"Disabling CPU quotas due to missing cpu.cfs_period_us"
)
args
=
append
(
args
,
"--cpu-cfs-quota=false"
)
args
Map
[
"cpu-cfs-quota"
]
=
"false"
}
}
if
root
!=
""
{
if
root
!=
""
{
args
=
append
(
args
,
"--runtime-cgroups"
,
root
)
args
Map
[
"runtime-cgroups"
]
=
root
args
=
append
(
args
,
"--kubelet-cgroups"
,
root
)
args
Map
[
"kubelet-cgroups"
]
=
root
}
}
args
=
append
(
args
,
cfg
.
ExtraKubeletArgs
...
)
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraKubeletArgs
)
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
...
pkg/daemons/config/types.go
View file @
ea834eb2
...
@@ -2,6 +2,7 @@ package config
...
@@ -2,6 +2,7 @@ package config
import
(
import
(
"crypto/tls"
"crypto/tls"
"fmt"
"net"
"net"
"net/http"
"net/http"
"strings"
"strings"
...
@@ -106,3 +107,21 @@ func (a ArgString) String() string {
...
@@ -106,3 +107,21 @@ func (a ArgString) String() string {
}
}
return
b
.
String
()
return
b
.
String
()
}
}
func
GetArgsList
(
argsMap
map
[
string
]
string
,
extraArgs
[]
string
)
[]
string
{
// add extra args to args map to override any default option
for
_
,
arg
:=
range
extraArgs
{
splitArg
:=
strings
.
Split
(
arg
,
"="
)
if
len
(
splitArg
)
<
2
{
argsMap
[
splitArg
[
0
]]
=
"true"
continue
}
argsMap
[
splitArg
[
0
]]
=
splitArg
[
1
]
}
var
args
[]
string
for
arg
,
value
:=
range
argsMap
{
cmd
:=
fmt
.
Sprintf
(
"--%s=%s"
,
arg
,
value
)
args
=
append
(
args
,
cmd
)
}
return
args
}
pkg/daemons/control/server.go
View file @
ea834eb2
...
@@ -95,20 +95,22 @@ func Server(ctx context.Context, cfg *config.Control) error {
...
@@ -95,20 +95,22 @@ func Server(ctx context.Context, cfg *config.Control) error {
}
}
func
controllerManager
(
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
{
func
controllerManager
(
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
{
args
:=
[
]
string
{
args
Map
:=
map
[
string
]
string
{
"
--kubeconfig"
,
runtime
.
KubeConfigSystem
,
"
kubeconfig"
:
runtime
.
KubeConfigSystem
,
"
--service-account-private-key-file"
,
runtime
.
ServiceKey
,
"
service-account-private-key-file"
:
runtime
.
ServiceKey
,
"
--allocate-node-cidrs
"
,
"
allocate-node-cidrs"
:
"true
"
,
"
--cluster-cidr"
,
cfg
.
ClusterIPRange
.
String
(),
"
cluster-cidr"
:
cfg
.
ClusterIPRange
.
String
(),
"
--root-ca-file"
,
runtime
.
TokenCA
,
"
root-ca-file"
:
runtime
.
TokenCA
,
"
--port"
,
"10252"
,
"
port"
:
"10252"
,
"
--bind-address"
,
"127.0.0.1"
,
"
bind-address"
:
"127.0.0.1"
,
"
--secure-port"
,
"0"
,
"
secure-port"
:
"0"
,
}
}
if
cfg
.
NoLeaderElect
{
if
cfg
.
NoLeaderElect
{
args
=
append
(
args
,
"--leader-elect=false"
)
args
Map
[
"leader-elect"
]
=
"false"
}
}
args
=
append
(
args
,
cfg
.
ExtraControllerArgs
...
)
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraControllerArgs
)
command
:=
cmapp
.
NewControllerManagerCommand
()
command
:=
cmapp
.
NewControllerManagerCommand
()
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
@@ -119,16 +121,17 @@ func controllerManager(cfg *config.Control, runtime *config.ControlRuntime) {
...
@@ -119,16 +121,17 @@ func controllerManager(cfg *config.Control, runtime *config.ControlRuntime) {
}
}
func
scheduler
(
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
{
func
scheduler
(
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
{
args
:=
[
]
string
{
args
Map
:=
map
[
string
]
string
{
"
--kubeconfig"
,
runtime
.
KubeConfigSystem
,
"
kubeconfig"
:
runtime
.
KubeConfigSystem
,
"
--port"
,
"10251"
,
"
port"
:
"10251"
,
"
--bind-address"
,
"127.0.0.1"
,
"
bind-address"
:
"127.0.0.1"
,
"
--secure-port"
,
"0"
,
"
secure-port"
:
"0"
,
}
}
if
cfg
.
NoLeaderElect
{
if
cfg
.
NoLeaderElect
{
args
=
append
(
args
,
"--leader-elect=false"
)
args
Map
[
"leader-elect"
]
=
"false"
}
}
args
=
append
(
args
,
cfg
.
ExtraSchedulerAPIArgs
...
)
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraSchedulerAPIArgs
)
command
:=
sapp
.
NewSchedulerCommand
()
command
:=
sapp
.
NewSchedulerCommand
()
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
@@ -139,19 +142,18 @@ func scheduler(cfg *config.Control, runtime *config.ControlRuntime) {
...
@@ -139,19 +142,18 @@ func scheduler(cfg *config.Control, runtime *config.ControlRuntime) {
}
}
func
apiServer
(
ctx
context
.
Context
,
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
(
authenticator
.
Request
,
http
.
Handler
,
error
)
{
func
apiServer
(
ctx
context
.
Context
,
cfg
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
(
authenticator
.
Request
,
http
.
Handler
,
error
)
{
var
args
[]
string
argsMap
:=
make
(
map
[
string
]
string
)
if
len
(
cfg
.
ETCDEndpoints
)
>
0
{
if
len
(
cfg
.
ETCDEndpoints
)
>
0
{
args
=
append
(
args
,
"--storage-backend"
,
"etcd3"
)
args
Map
[
"storage-backend"
]
=
"etcd3"
args
=
append
(
args
,
"--etcd-servers"
,
strings
.
Join
(
cfg
.
ETCDEndpoints
,
","
)
)
args
Map
[
"etcd-servers"
]
=
strings
.
Join
(
cfg
.
ETCDEndpoints
,
","
)
if
cfg
.
ETCDKeyFile
!=
""
{
if
cfg
.
ETCDKeyFile
!=
""
{
args
=
append
(
args
,
"--etcd-keyfile"
,
cfg
.
ETCDKeyFile
)
args
Map
[
"etcd-keyfile"
]
=
cfg
.
ETCDKeyFile
}
}
if
cfg
.
ETCDCAFile
!=
""
{
if
cfg
.
ETCDCAFile
!=
""
{
args
=
append
(
args
,
"--etcd-cafile"
,
cfg
.
ETCDCAFile
)
args
Map
[
"etcd-cafile"
]
=
cfg
.
ETCDCAFile
}
}
if
cfg
.
ETCDCertFile
!=
""
{
if
cfg
.
ETCDCertFile
!=
""
{
args
=
append
(
args
,
"--etcd-certfile"
,
cfg
.
ETCDCertFile
)
args
Map
[
"etcd-certfile"
]
=
cfg
.
ETCDCertFile
}
}
}
}
...
@@ -159,27 +161,28 @@ func apiServer(ctx context.Context, cfg *config.Control, runtime *config.Control
...
@@ -159,27 +161,28 @@ func apiServer(ctx context.Context, cfg *config.Control, runtime *config.Control
os
.
MkdirAll
(
certDir
,
0700
)
os
.
MkdirAll
(
certDir
,
0700
)
// TODO: sqlite doesn't need the watch cache, but etcd does, so make this dynamic
// TODO: sqlite doesn't need the watch cache, but etcd does, so make this dynamic
args
=
append
(
args
,
"--watch-cache=false"
)
argsMap
[
"watch-cache"
]
=
"false"
args
=
append
(
args
,
"--cert-dir"
,
certDir
)
argsMap
[
"cert-dir"
]
=
certDir
args
=
append
(
args
,
"--allow-privileged=true"
)
argsMap
[
"allow-privileged"
]
=
"true"
args
=
append
(
args
,
"--authorization-mode"
,
strings
.
Join
([]
string
{
modes
.
ModeNode
,
modes
.
ModeRBAC
},
","
))
argsMap
[
"authorization-mode"
]
=
strings
.
Join
([]
string
{
modes
.
ModeNode
,
modes
.
ModeRBAC
},
","
)
args
=
append
(
args
,
"--service-account-signing-key-file"
,
runtime
.
ServiceKey
)
argsMap
[
"service-account-signing-key-file"
]
=
runtime
.
ServiceKey
args
=
append
(
args
,
"--service-cluster-ip-range"
,
cfg
.
ServiceIPRange
.
String
())
argsMap
[
"service-cluster-ip-range"
]
=
cfg
.
ServiceIPRange
.
String
()
args
=
append
(
args
,
"--advertise-port"
,
strconv
.
Itoa
(
cfg
.
AdvertisePort
))
argsMap
[
"advertise-port"
]
=
strconv
.
Itoa
(
cfg
.
AdvertisePort
)
args
=
append
(
args
,
"--advertise-address"
,
localhostIP
.
String
())
argsMap
[
"advertise-address"
]
=
localhostIP
.
String
()
args
=
append
(
args
,
"--insecure-port"
,
"0"
)
argsMap
[
"insecure-port"
]
=
"0"
args
=
append
(
args
,
"--secure-port"
,
strconv
.
Itoa
(
cfg
.
ListenPort
))
argsMap
[
"secure-port"
]
=
strconv
.
Itoa
(
cfg
.
ListenPort
)
args
=
append
(
args
,
"--bind-address"
,
localhostIP
.
String
())
argsMap
[
"bind-address"
]
=
localhostIP
.
String
()
args
=
append
(
args
,
"--tls-cert-file"
,
runtime
.
TLSCert
)
argsMap
[
"tls-cert-file"
]
=
runtime
.
TLSCert
args
=
append
(
args
,
"--tls-private-key-file"
,
runtime
.
TLSKey
)
argsMap
[
"tls-private-key-file"
]
=
runtime
.
TLSKey
args
=
append
(
args
,
"--service-account-key-file"
,
runtime
.
ServiceKey
)
argsMap
[
"service-account-key-file"
]
=
runtime
.
ServiceKey
args
=
append
(
args
,
"--service-account-issuer"
,
"k3s"
)
argsMap
[
"service-account-issuer"
]
=
"k3s"
args
=
append
(
args
,
"--api-audiences"
,
"unknown"
)
argsMap
[
"api-audiences"
]
=
"unknown"
args
=
append
(
args
,
"--basic-auth-file"
,
runtime
.
PasswdFile
)
argsMap
[
"basic-auth-file"
]
=
runtime
.
PasswdFile
args
=
append
(
args
,
"--kubelet-client-certificate"
,
runtime
.
NodeCert
)
argsMap
[
"kubelet-client-certificate"
]
=
runtime
.
NodeCert
args
=
append
(
args
,
"--kubelet-client-key"
,
runtime
.
NodeKey
)
argsMap
[
"kubelet-client-key"
]
=
runtime
.
NodeKey
args
=
append
(
args
,
cfg
.
ExtraAPIArgs
...
)
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraAPIArgs
)
command
:=
app
.
NewAPIServerCommand
(
ctx
.
Done
())
command
:=
app
.
NewAPIServerCommand
(
ctx
.
Done
())
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
...
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