mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-05 10:58:11 +02:00
zero: add more verbose logging about background control loops
This commit is contained in:
parent
d2b2ad3250
commit
55cce29741
5 changed files with 57 additions and 17 deletions
|
@ -6,10 +6,12 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
"github.com/pomerium/pomerium/internal/zero/bootstrap"
|
||||
"github.com/pomerium/pomerium/internal/zero/reconciler"
|
||||
"github.com/pomerium/pomerium/pkg/cmd/pomerium"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||
sdk "github.com/pomerium/zero-sdk"
|
||||
|
@ -39,7 +41,7 @@ func Run(ctx context.Context, opts ...Option) error {
|
|||
eg.Go(func() error { return run(ctx, "connect", c.runConnect, nil) })
|
||||
eg.Go(func() error { return run(ctx, "zero-bootstrap", c.runBootstrap, nil) })
|
||||
eg.Go(func() error { return run(ctx, "pomerium-core", c.runPomeriumCore, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "zero-reconciler", c.RunReconciler, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "zero-reconciler", c.runReconciler, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "connect-log", c.RunConnectLog, nil) })
|
||||
return eg.Wait()
|
||||
}
|
||||
|
@ -87,6 +89,9 @@ func run(ctx context.Context, name string, runFn func(context.Context) error, wa
|
|||
}
|
||||
|
||||
func (c *controller) runBootstrap(ctx context.Context) error {
|
||||
ctx = log.WithContext(ctx, func(c zerolog.Context) zerolog.Context {
|
||||
return c.Str("service", "zero-bootstrap")
|
||||
})
|
||||
return c.bootstrapConfig.Run(ctx, c.api, c.cfg.bootstrapConfigFileName)
|
||||
}
|
||||
|
||||
|
@ -95,5 +100,20 @@ func (c *controller) runPomeriumCore(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (c *controller) runConnect(ctx context.Context) error {
|
||||
ctx = log.WithContext(ctx, func(c zerolog.Context) zerolog.Context {
|
||||
return c.Str("service", "zero-connect")
|
||||
})
|
||||
|
||||
return c.api.Connect(ctx)
|
||||
}
|
||||
|
||||
func (c *controller) runReconciler(ctx context.Context) error {
|
||||
ctx = log.WithContext(ctx, func(c zerolog.Context) zerolog.Context {
|
||||
return c.Str("service", "zero-reconciler")
|
||||
})
|
||||
|
||||
return reconciler.Run(ctx,
|
||||
reconciler.WithAPI(c.api),
|
||||
reconciler.WithDataBrokerClient(c.GetDataBrokerServiceClient()),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue