Skip to content

Commit

Permalink
refactor: use root ctx in agent (#2578)
Browse files Browse the repository at this point in the history
## Description
Updates the agent to use ctx from the root

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
AustinAbro321 committed Jun 3, 2024
1 parent 310dcc1 commit e6ac3d5
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 e6ac3d5

Please sign in to comment.