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
324bb559
Commit
324bb559
authored
Aug 19, 2020
by
Brian Downs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ctx to hook, handle hook errors
Signed-off-by:
Brian Downs
<
brian.downs@gmail.com
>
parent
fa2c1422
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
server.go
pkg/cli/cmds/server.go
+3
-1
server.go
pkg/server/server.go
+3
-1
types.go
pkg/server/types.go
+3
-1
No files found.
pkg/cli/cmds/server.go
View file @
324bb559
package
cmds
package
cmds
import
(
import
(
"context"
"github.com/rancher/k3s/pkg/daemons/config"
"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"
...
@@ -55,7 +57,7 @@ type Server struct {
...
@@ -55,7 +57,7 @@ type Server struct {
ClusterInit
bool
ClusterInit
bool
ClusterReset
bool
ClusterReset
bool
EncryptSecrets
bool
EncryptSecrets
bool
StartupHooks
[]
func
(
config
.
Control
)
error
StartupHooks
[]
func
(
con
text
.
Context
,
con
fig
.
Control
)
error
}
}
var
ServerConfig
Server
var
ServerConfig
Server
...
...
pkg/server/server.go
View file @
324bb559
...
@@ -61,7 +61,9 @@ func StartServer(ctx context.Context, config *Config) error {
...
@@ -61,7 +61,9 @@ func StartServer(ctx context.Context, config *Config) error {
}
}
for
_
,
hook
:=
range
config
.
StartupHooks
{
for
_
,
hook
:=
range
config
.
StartupHooks
{
hook
(
config
.
ControlConfig
)
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
)
...
...
pkg/server/types.go
View file @
324bb559
package
server
package
server
import
(
import
(
"context"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/daemons/config"
)
)
...
@@ -10,5 +12,5 @@ type Config struct {
...
@@ -10,5 +12,5 @@ type Config struct {
ControlConfig
config
.
Control
ControlConfig
config
.
Control
Rootless
bool
Rootless
bool
SupervisorPort
int
SupervisorPort
int
StartupHooks
[]
func
(
config
.
Control
)
error
StartupHooks
[]
func
(
con
text
.
Context
,
con
fig
.
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