Skip to content

Commit

Permalink
Fixed various Logging issues
Browse files Browse the repository at this point in the history
Signed-off-by: Achyut Madhusudan <amadhusu@redhat.com>
  • Loading branch information
Achyut Madhusudan committed Jul 30, 2024
1 parent 9ed5754 commit 2079607
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions controllers/dspipeline_fake_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package controllers

import (
"context"
"log/slog"

"k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

Expand Down Expand Up @@ -54,7 +54,7 @@ func NewFakeController() *DSPAReconciler {
// Generate DSPAReconciler using Fake Client
r := &DSPAReconciler{
Client: FakeClient,
Log: ctrl.Log.WithName("controllers").WithName("ds-pipelines-controller"),
Log: slog.Logger{},
Scheme: FakeScheme,
TemplatesPath: "../config/internal/",
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/mlmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *DSPAReconciler) ReconcileMLMD(dsp *dspav1alpha1.DataSciencePipelinesApp
log := slog.With("namespace", dsp.Namespace).With("dspa_name", dsp.Name)

if (params.MLMD == nil || !params.MLMD.Deploy) && (dsp.Spec.MLMD == nil || !dsp.Spec.MLMD.Deploy) {
r.Log.Info("Skipping Application of ML-Metadata (MLMD) Resources")
log.Info("Skipping Application of ML-Metadata (MLMD) Resources")
return nil
}

Expand Down
17 changes: 9 additions & 8 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ package controllers

import (
"context"
"github.com/go-logr/logr"
"log/slog"
"os"
"path/filepath"
"testing"
"time"

dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
buildv1 "github.com/openshift/api/build/v1"
imagev1 "github.com/openshift/api/image/v1"
Expand All @@ -31,13 +36,9 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"os"
"path/filepath"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"testing"
"time"

"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (s *ControllerSuite) SetupTest() {
logf.Log.Info("Overriding the Database and Object Store live connection functions with trivial stubs")
ConnectAndQueryDatabase = func(
host string,
log logr.Logger,
log *slog.Logger,
port, username, password, dbname, tls string,
dbConnectionTimeout time.Duration,
pemCerts [][]byte,
Expand All @@ -82,7 +83,7 @@ func (s *ControllerSuite) SetupTest() {
}
ConnectAndQueryObjStore = func(
ctx context.Context,
log logr.Logger,
log *slog.Logger,
endpoint, bucket string,
accesskey, secretkey []byte,
secure bool,
Expand Down Expand Up @@ -138,7 +139,7 @@ func (s *ControllerSuite) SetupSuite() {

err = (&DSPAReconciler{
Client: k8sClient,
Log: ctrl.Log.WithName("controllers").WithName("ds-pipelines-controller"),
Log: slog.Logger{},
Scheme: scheme.Scheme,
TemplatesPath: "../config/internal/",
}).SetupWithManager(mgr)
Expand Down

0 comments on commit 2079607

Please sign in to comment.