Skip to content

Commit

Permalink
use ctx in agent
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinAbro321 committed Jun 3, 2024
1 parent 310dcc1 commit 0ba27b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/internal/agent/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ import (
)

// NewAdmissionServer creates a http.Server for the mutating webhook admission handler.
func NewAdmissionServer(port string) *http.Server {
func NewAdmissionServer(ctx context.Context, port string) *http.Server {
message.Debugf("http.NewAdmissionServer(%s)", port)

c, err := cluster.NewCluster()
if err != nil {
message.Fatalf(err, err.Error())
}

ctx := context.Background()

// Instances hooks
podsMutation := hooks.NewPodMutationHook(ctx, c)
fluxGitRepositoryMutation := hooks.NewGitRepositoryMutationHook(ctx, c)
Expand Down
2 changes: 1 addition & 1 deletion src/internal/agent/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
// StartWebhook launches the Zarf agent mutating webhook in the cluster.
func StartWebhook(ctx context.Context) error {
message.Debug("agent.StartWebhook()")
return startServer(ctx, agentHttp.NewAdmissionServer(httpPort))
return startServer(ctx, agentHttp.NewAdmissionServer(ctx, httpPort))
}

// StartHTTPProxy launches the zarf agent proxy in the cluster.
Expand Down

0 comments on commit 0ba27b9

Please sign in to comment.