Skip to content

🐛 Fix log initialization #1917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: e2e-artifacts
path: /tmp/artifacts/

- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v5.4.0
with:
disable_search: true
files: coverage/e2e.out
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: |
make test-unit

- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v5.4.0
with:
disable_search: true
files: coverage/unit.out
Expand Down
8 changes: 1 addition & 7 deletions cmd/catalogd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"github.com/containers/image/v5/types"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
Expand All @@ -42,7 +41,6 @@ import (
"k8s.io/client-go/metadata"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/klog/v2"
"k8s.io/klog/v2/textlogger"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
Expand Down Expand Up @@ -146,7 +144,7 @@ func init() {

utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(ocv1.AddToScheme(scheme))
ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig()))
ctrl.SetLogger(klog.NewKlogr())
}

func main() {
Expand Down Expand Up @@ -190,10 +188,6 @@ func validateConfig(cfg *config) error {
}

func run(ctx context.Context) error {
if klog.V(4).Enabled() {
logrus.SetLevel(logrus.DebugLevel)
}

authFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%s-%s.json", authFilePrefix, apimachineryrand.String(8)))

protocol := "http://"
Expand Down
11 changes: 2 additions & 9 deletions cmd/operator-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"github.com/containers/image/v5/types"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
apiextensionsv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
Expand All @@ -40,7 +39,6 @@ import (
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/klog/v2"
"k8s.io/klog/v2/textlogger"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
Expand Down Expand Up @@ -148,15 +146,14 @@ func init() {
//adds version sub command
operatorControllerCmd.AddCommand(versionCommand)

klog.InitFlags(flag.CommandLine)

//add klog flags to flagset
klog.InitFlags(flag.CommandLine)
flags.AddGoFlagSet(flag.CommandLine)

//add feature gate flags to flagset
features.OperatorControllerFeatureGate.AddFlag(flags)

ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig()))
ctrl.SetLogger(klog.NewKlogr())
}
func validateMetricsFlags() error {
if (cfg.certFile != "" && cfg.keyFile == "") || (cfg.certFile == "" && cfg.keyFile != "") {
Expand All @@ -179,10 +176,6 @@ func validateMetricsFlags() error {
return nil
}
func run() error {
if klog.V(4).Enabled() {
logrus.SetLevel(logrus.DebugLevel)
}

setupLog.Info("starting up the controller", "version info", version.String())

authFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%s-%s.json", authFilePrefix, apimachineryrand.String(8)))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/operator-framework/helm-operator-plugins v0.8.0
github.com/operator-framework/operator-registry v1.51.0
github.com/prometheus/client_golang v1.22.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.10.0
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7
Expand Down Expand Up @@ -187,6 +186,7 @@ require (
github.com/sigstore/fulcio v1.6.4 // indirect
github.com/sigstore/rekor v1.3.8 // indirect
github.com/sigstore/sigstore v1.8.12 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smallstep/pkcs7 v0.1.1 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
Expand Down
Loading