Skip to content
Open
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
4 changes: 2 additions & 2 deletions cmd/auth_proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
"k8s.io/utils/ptr"
cmdbroker "knative.dev/eventing/cmd/broker"
"knative.dev/eventing/pkg/apis/feature"
"knative.dev/eventing/pkg/auth"
eventingclient "knative.dev/eventing/pkg/client/clientset/versioned"
eventinginformers "knative.dev/eventing/pkg/client/informers/externalversions"
eventingv1alpha1listers "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1"
"knative.dev/eventing/pkg/eventingtls"
"knative.dev/eventing/pkg/kncloudevents"
"knative.dev/eventing/pkg/utils"
"knative.dev/pkg/apis"
kubeclient "knative.dev/pkg/client/injection/kube/client"
filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
Expand Down Expand Up @@ -189,7 +189,7 @@ func setupInformers(ctx context.Context) (context.Context, []controller.Informer

// setupLogging initializes logging configuration and returns the logger
func setupLogging(ctx context.Context, cmw *configmap.InformedWatcher) *zap.SugaredLogger {
loggingConfig, err := cmdbroker.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
loggingConfig, err := utils.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
if err != nil {
log.Fatal("Error loading/parsing logging configuration:", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/broker/filter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"knative.dev/pkg/signals"
"knative.dev/pkg/system"

"knative.dev/eventing/cmd/broker"
"knative.dev/eventing/pkg/apis/feature"
"knative.dev/eventing/pkg/auth"
"knative.dev/eventing/pkg/broker/filter"
Expand All @@ -50,6 +49,7 @@ import (
"knative.dev/eventing/pkg/eventingtls"
"knative.dev/eventing/pkg/eventtype"
o11yconfigmap "knative.dev/eventing/pkg/observability/configmap"
"knative.dev/eventing/pkg/utils"
)

const (
Expand Down Expand Up @@ -90,7 +90,7 @@ func main() {
ctx = injection.WithConfig(ctx, cfg)
kubeClient := kubeclient.Get(ctx)

loggingConfig, err := broker.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
loggingConfig, err := utils.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
if err != nil {
log.Fatal("Error loading/parsing logging configuration:", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/broker/ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"knative.dev/pkg/signals"
"knative.dev/pkg/system"

cmdbroker "knative.dev/eventing/cmd/broker"
"knative.dev/eventing/pkg/apis/feature"
"knative.dev/eventing/pkg/auth"
"knative.dev/eventing/pkg/broker"
Expand All @@ -51,6 +50,7 @@ import (
"knative.dev/eventing/pkg/eventtype"
o11yconfigmap "knative.dev/eventing/pkg/observability/configmap"
"knative.dev/eventing/pkg/observability/otel"
"knative.dev/eventing/pkg/utils"
)

// TODO make these constants configurable (either as env variables, config map, or part of broker spec).
Expand Down Expand Up @@ -104,7 +104,7 @@ func main() {

ctx, informers := injection.Default.SetupInformers(ctx, cfg)
ctx = injection.WithConfig(ctx, cfg)
loggingConfig, err := cmdbroker.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
loggingConfig, err := utils.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
if err != nil {
log.Fatal("Error loading/parsing logging configuration:", err)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/jobsink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import (

"knative.dev/pkg/signals"

cmdbroker "knative.dev/eventing/cmd/broker"
"knative.dev/eventing/pkg/apis/feature"
"knative.dev/eventing/pkg/apis/sinks"
sinksv "knative.dev/eventing/pkg/apis/sinks/v1alpha1"
Expand Down Expand Up @@ -93,7 +92,7 @@ func main() {
ctx, informers := injection.Default.SetupInformers(ctx, cfg)
ctx = injection.WithConfig(ctx, cfg)

loggingConfig, err := cmdbroker.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
loggingConfig, err := utils.GetLoggingConfig(ctx, system.Namespace(), logging.ConfigMapName())
if err != nil {
log.Fatal("Error loading/parsing logging configuration:", err)
}
Expand Down
6 changes: 4 additions & 2 deletions cmd/broker/config.go → pkg/utils/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package broker
package utils

import (
"context"
Expand All @@ -26,7 +26,9 @@ import (
"knative.dev/pkg/logging"
)

// GetLoggingConfig will get config from a specific namespace
// GetLoggingConfig fetches the logging ConfigMap from the given namespace and
// parses it into a *logging.Config. If the ConfigMap is not found, it returns
// the default logging config.
func GetLoggingConfig(ctx context.Context, namespace, loggingConfigMapName string) (*logging.Config, error) {
loggingConfigMap, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(namespace).Get(ctx, loggingConfigMapName, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
Expand Down
Loading