Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 408dad1

Browse files
fix: connect kubernetes logger (#945)
1 parent 064464b commit 408dad1

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ NOTE: all releases may include dependency updates, not specifically mentioned
88

99
- feat: integrate try-as library [#912](https://github.com/hypermodeinc/modus/pull/912)
1010
- fix: sentry source context [#940](https://github.com/hypermodeinc/modus/pull/940)
11+
- fix: connect kubernetes logger [#945](https://github.com/hypermodeinc/modus/pull/945)
1112

1213
## 2025-07-09 - Runtime v0.18.4
1314

runtime/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ require (
1616
github.com/docker/go-connections v0.5.0
1717
github.com/fatih/color v1.18.0
1818
github.com/getsentry/sentry-go v0.34.1
19+
github.com/go-logr/zerologr v1.2.3
1920
github.com/go-sql-driver/mysql v1.9.3
2021
github.com/go-viper/mapstructure/v2 v2.3.0
2122
github.com/goccy/go-json v0.10.5

runtime/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
309309
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
310310
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
311311
github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg=
312+
github.com/go-logr/zerologr v1.2.3 h1:up5N9vcH9Xck3jJkXzgyOxozT14R47IyDODz8LM1KSs=
313+
github.com/go-logr/zerologr v1.2.3/go.mod h1:BxwGo7y5zgSHYR1BjbnHPyF/5ZjVKfKxAZANVu6E8Ho=
312314
github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic=
313315
github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk=
314316
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=

runtime/secrets/kubernetes.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"strings"
1212

13+
"github.com/go-logr/zerologr"
1314
"github.com/hypermodeinc/modus/lib/manifest"
1415
"github.com/hypermodeinc/modus/runtime/app"
1516
"github.com/hypermodeinc/modus/runtime/logger"
@@ -52,7 +53,7 @@ func (sp *kubernetesSecretsProvider) initialize(ctx context.Context) {
5253
sp.secretNamespace = parts[0]
5354
sp.secretName = parts[1]
5455

55-
cli, cache, err := newK8sClientForSecret(sp.secretNamespace, sp.secretName)
56+
cli, cache, err := newK8sClientForSecret(ctx, sp.secretNamespace, sp.secretName)
5657
if err != nil {
5758
const msg = "Failed to initialize Kubernetes client."
5859
sentryutils.CaptureError(ctx, err, msg,
@@ -157,12 +158,14 @@ func (sp *kubernetesSecretsProvider) hasSecret(ctx context.Context, name string)
157158

158159
// newK8sClientForSecret creates a new Kubernetes client that watches
159160
// only a single secret `name` in namespace `ns`.
160-
func newK8sClientForSecret(ns, name string) (client.Client, pkgcache.Cache, error) {
161+
func newK8sClientForSecret(ctx context.Context, ns, name string) (client.Client, pkgcache.Cache, error) {
161162
scheme := runtime.NewScheme()
162163
if err := clientgoscheme.AddToScheme(scheme); err != nil {
163164
return nil, nil, err
164165
}
165166

167+
ctrl.SetLogger(zerologr.New(logger.Get(ctx)))
168+
166169
cl, err := cluster.New(ctrl.GetConfigOrDie(), func(clusterOptions *cluster.Options) {
167170
clusterOptions.Scheme = scheme
168171
clusterOptions.Cache.DefaultNamespaces = make(map[string]pkgcache.Config)

0 commit comments

Comments
 (0)