Skip to content

Commit

Permalink
Replace panics with proper calls to a logger (#290)
Browse files Browse the repository at this point in the history
* Replace panics with proper calls to a logger

* Fix misspell
  • Loading branch information
markusthoemmes authored Oct 30, 2020
1 parent e8f789d commit 2da6dce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions pkg/reconciler/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,28 @@ const (
)

func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
logger := logging.FromContext(ctx)

kubernetesClient := kubeclient.Get(ctx)
knativeClient := knativeclient.Get(ctx)
logger := logging.FromContext(ctx)
ingressInformer := ingressinformer.Get(ctx)
endpointsInformer := endpointsinformer.Get(ctx)
serviceInformer := serviceinformer.Get(ctx)
podInformer := podinformer.Get(ctx)

extAuthZConfig := envoy.GetExternalAuthzConfig()

// Get the current list of ingresses that are ready, and pass it to the cache so we can
// know when it has been synced.
ingressesToSync, err := getReadyIngresses(ctx, knativeClient.NetworkingV1alpha1())
if err != nil {
panic(err)
logger.Fatalw("Failed to get initial set of ready ingresses", zap.Error(err))
}

// Create a new Cache, with the Readiness endpoint enabled, and the list of current Ingresses.
caches, err := generator.NewCaches(ctx, logger.Named("caches"), kubernetesClient, extAuthZConfig.Enabled, ingressesToSync)
if err != nil {
panic(err)
logger.Fatalw("Failed create new caches", zap.Error(err))
}

r := &Reconciler{
Expand Down
2 changes: 1 addition & 1 deletion test/extauthz/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func ExtAuthzScenario(t *testing.T) {

kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error())
t.Fatal(err.Error())
}

servingNetworkClient, err := KnativeServingNetworkClient(kubeconfig)
Expand Down

0 comments on commit 2da6dce

Please sign in to comment.