Skip to content

Commit

Permalink
Ignore non existent kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
talsabagport committed May 24, 2023
1 parent ebe0ed6 commit f32f031
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/handlers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ func NewControllersHandler(exporterConfig *config.Config, k8sClient *k8s.Client,
var gvr schema.GroupVersionResource
gvr, err := k8s.GetGVRFromResource(k8sClient.DiscoveryMapper, resource.Kind)
if err != nil {
klog.Fatalf("Error getting GVR for resource '%s': %s", resource.Kind, err.Error())
klog.Errorf("Error getting GVR, skip handling for resource '%s': %s.", resource.Kind, err.Error())
continue
}

informer := informersFactory.ForResource(gvr)
controller := k8s.NewController(resource, portClient, informer)
controllers = append(controllers, controller)
}

if len(controllers) == 0 {
klog.Fatalf("Failed to initiate a controller for all resources, exiting...")
}

controllersHandler := &ControllersHandler{
controllers: controllers,
informersFactory: informersFactory,
Expand Down

0 comments on commit f32f031

Please sign in to comment.