Skip to content

Commit ccb0932

Browse files
committed
fix logging issue
1 parent 5530bb8 commit ccb0932

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cmd/project-workspace-operator/app/init.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
ctrlutils "github.com/openmcp-project/controller-utils/pkg/controller"
1616
crdutil "github.com/openmcp-project/controller-utils/pkg/crds"
1717
"github.com/openmcp-project/controller-utils/pkg/init/webhooks"
18+
"github.com/openmcp-project/controller-utils/pkg/logging"
1819
clustersv1alpha1 "github.com/openmcp-project/openmcp-operator/api/clusters/v1alpha1"
1920
openmcpconst "github.com/openmcp-project/openmcp-operator/api/constants"
2021
"github.com/openmcp-project/openmcp-operator/lib/clusteraccess"
@@ -74,6 +75,7 @@ func (o *InitOptions) Run(ctx context.Context) error {
7475
}
7576

7677
log := o.Log.WithName("main")
78+
ctx = logging.NewContext(ctx, log)
7779
log.Info("Environment", "value", o.Environment)
7880
log.Info("ProviderName", "value", o.ProviderName)
7981

internal/dns/dns.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func NewReconciler() *Reconciler {
6060
// It returns the full hostname for the given instance that can be used for DNS records.
6161
// If the default gateway is not found, it will requeue after a predefined interval.
6262
func (r *Reconciler) ReconcileGateway(ctx context.Context, instance *Instance, targetCluster *clusters.Cluster) (GatewayReconcileResult, error) {
63-
log := logging.FromContextOrPanic(ctx)
63+
log := logging.FromContextOrDiscard(ctx)
6464

6565
var err error
6666

@@ -164,7 +164,7 @@ func (r *Reconciler) ReconcileTLSRoute(ctx context.Context, instance *Instance,
164164

165165
// IsTLSRouteReady checks if the TLSRoute for the given instance is accepted by the default gateway.
166166
func (r *Reconciler) IsTLSRouteReady(ctx context.Context, instance *Instance, targetCluster *clusters.Cluster) (bool, error) {
167-
log := logging.FromContextOrPanic(ctx)
167+
log := logging.FromContextOrDiscard(ctx)
168168

169169
var err error
170170

@@ -192,7 +192,7 @@ func (r *Reconciler) IsTLSRouteReady(ctx context.Context, instance *Instance, ta
192192

193193
// DeleteTLSRoute deletes the TLSRoute for the given instance.
194194
func (r *Reconciler) DeleteTLSRoute(ctx context.Context, instance *Instance, targetCluster *clusters.Cluster) error {
195-
log := logging.FromContextOrPanic(ctx)
195+
log := logging.FromContextOrDiscard(ctx)
196196

197197
tlsRoute := &gatewayv1alpha2.TLSRoute{}
198198
tlsRoute.SetName(instance.Name)

0 commit comments

Comments
 (0)