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
a2471a1f
Unverified
Commit
a2471a1f
authored
Aug 19, 2020
by
Brian Downs
Committed by
GitHub
Aug 19, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2146 from briandowns/add_hook_for_rke2
add setup hook capabilities for rke2
parents
5859f83d
324bb559
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
server.go
pkg/cli/cmds/server.go
+4
-0
server.go
pkg/cli/server/server.go
+2
-0
server.go
pkg/server/server.go
+6
-0
types.go
pkg/server/types.go
+3
-0
No files found.
pkg/cli/cmds/server.go
View file @
a2471a1f
package
cmds
package
cmds
import
(
import
(
"context"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/version"
"github.com/rancher/k3s/pkg/version"
"github.com/rancher/spur/cli"
"github.com/rancher/spur/cli"
"github.com/rancher/spur/cli/altsrc"
"github.com/rancher/spur/cli/altsrc"
...
@@ -54,6 +57,7 @@ type Server struct {
...
@@ -54,6 +57,7 @@ type Server struct {
ClusterInit
bool
ClusterInit
bool
ClusterReset
bool
ClusterReset
bool
EncryptSecrets
bool
EncryptSecrets
bool
StartupHooks
[]
func
(
context
.
Context
,
config
.
Control
)
error
}
}
var
ServerConfig
Server
var
ServerConfig
Server
...
...
pkg/cli/server/server.go
View file @
a2471a1f
...
@@ -193,6 +193,8 @@ func run(app *cli.Context, cfg *cmds.Server) error {
...
@@ -193,6 +193,8 @@ func run(app *cli.Context, cfg *cmds.Server) error {
return
errors
.
Wrap
(
err
,
"Invalid tls-min-version"
)
return
errors
.
Wrap
(
err
,
"Invalid tls-min-version"
)
}
}
serverConfig
.
StartupHooks
=
append
(
serverConfig
.
StartupHooks
,
cfg
.
StartupHooks
...
)
// TLS config based on mozilla ssl-config generator
// TLS config based on mozilla ssl-config generator
// https://ssl-config.mozilla.org/#server=golang&version=1.13.6&config=intermediate&guideline=5.4
// https://ssl-config.mozilla.org/#server=golang&version=1.13.6&config=intermediate&guideline=5.4
// Need to disable the TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 Cipher for TLS1.2
// Need to disable the TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 Cipher for TLS1.2
...
...
pkg/server/server.go
View file @
a2471a1f
...
@@ -60,6 +60,12 @@ func StartServer(ctx context.Context, config *Config) error {
...
@@ -60,6 +60,12 @@ func StartServer(ctx context.Context, config *Config) error {
return
errors
.
Wrap
(
err
,
"starting tls server"
)
return
errors
.
Wrap
(
err
,
"starting tls server"
)
}
}
for
_
,
hook
:=
range
config
.
StartupHooks
{
if
err
:=
hook
(
ctx
,
config
.
ControlConfig
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"startup hook"
)
}
}
ip
:=
net2
.
ParseIP
(
config
.
ControlConfig
.
BindAddress
)
ip
:=
net2
.
ParseIP
(
config
.
ControlConfig
.
BindAddress
)
if
ip
==
nil
{
if
ip
==
nil
{
hostIP
,
err
:=
net
.
ChooseHostInterface
()
hostIP
,
err
:=
net
.
ChooseHostInterface
()
...
...
pkg/server/types.go
View file @
a2471a1f
package
server
package
server
import
(
import
(
"context"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/daemons/config"
)
)
...
@@ -10,4 +12,5 @@ type Config struct {
...
@@ -10,4 +12,5 @@ type Config struct {
ControlConfig
config
.
Control
ControlConfig
config
.
Control
Rootless
bool
Rootless
bool
SupervisorPort
int
SupervisorPort
int
StartupHooks
[]
func
(
context
.
Context
,
config
.
Control
)
error
}
}
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