Skip to content

Commit

Permalink
fix: Namespace displayed on startup logs (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: Jayendra Parsai <[email protected]>
Co-authored-by: Jayendra Parsai <[email protected]>
  • Loading branch information
jparsai and Jayendra Parsai authored Sep 23, 2024
1 parent 12d32e9 commit 77d8900
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/informer/application/appinformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ func NewAppInformer(ctx context.Context, client appclientset.Interface, namespac
}

func (i *AppInformer) Start(stopch <-chan struct{}) {
log().Infof("Starting app informer (namespaces: %s)", strings.Join(append([]string{i.options.namespace}, i.options.namespaces...), ","))
ns := ""
if i.options.namespace != "" {
ns = i.options.namespace + ","
}
log().Infof("Starting app informer (namespaces: %s)", strings.TrimSuffix(ns+strings.Join(i.options.namespaces, ","), ","))
i.appInformer.Run(stopch)
log().Infof("App informer has shutdown")
}
Expand Down
8 changes: 7 additions & 1 deletion principal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ func NewServer(ctx context.Context, kubeClient *kube.KubernetesClient, namespace
// error during startup, before the go routines are running, will be returned
// immediately. Errors during the runtime will be propagated via errch.
func (s *Server) Start(ctx context.Context, errch chan error) error {
log().Infof("Starting %s (server) v%s (ns=%s, allowed_namespaces=%v)", s.version.Name(), s.version.Version(), s.namespace, s.options.namespaces)

if s.namespace != "" {
log().Infof("Starting %s (server) v%s (ns=%s, allowed_namespaces=%v)", s.version.Name(), s.version.Version(), s.namespace, s.options.namespaces)
} else {
log().Infof("Starting %s (server) v%s (allowed_namespaces=%v)", s.version.Name(), s.version.Version(), s.options.namespaces)
}

if s.options.serveGRPC {
if err := s.serveGRPC(ctx, errch); err != nil {
return err
Expand Down

0 comments on commit 77d8900

Please sign in to comment.