mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
add setup hook capabilities for rke2
Signed-off-by: Brian Downs <brian.downs@gmail.com>
This commit is contained in:
parent
5859f83d05
commit
a4b2953017
@ -1,6 +1,7 @@
|
|||||||
package cmds
|
package cmds
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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 +55,7 @@ type Server struct {
|
|||||||
ClusterInit bool
|
ClusterInit bool
|
||||||
ClusterReset bool
|
ClusterReset bool
|
||||||
EncryptSecrets bool
|
EncryptSecrets bool
|
||||||
|
SetupHooks []func(config.Control) error
|
||||||
}
|
}
|
||||||
|
|
||||||
var ServerConfig Server
|
var ServerConfig Server
|
||||||
|
@ -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.SetupHooks = append(serverConfig.SetupHooks, cfg.SetupHooks...)
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -60,6 +60,10 @@ 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.SetupHooks {
|
||||||
|
hook(config.ControlConfig)
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
@ -10,4 +10,5 @@ type Config struct {
|
|||||||
ControlConfig config.Control
|
ControlConfig config.Control
|
||||||
Rootless bool
|
Rootless bool
|
||||||
SupervisorPort int
|
SupervisorPort int
|
||||||
|
SetupHooks []func(config.Control) error
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user