Skip to content

Commit

Permalink
Only ignore IsNotFound k8s errors, and return any other error we may get
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike committed Jan 30, 2024
1 parent 41389eb commit 12c3466
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions controllers/humioingesttoken_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ func (r *HumioIngestTokenReconciler) SetupWithManager(mgr ctrl.Manager) error {

func (r *HumioIngestTokenReconciler) finalize(ctx context.Context, config *humioapi.Config, req reconcile.Request, hit *humiov1alpha1.HumioIngestToken) error {
_, err := helpers.NewCluster(ctx, r, hit.Spec.ManagedClusterName, hit.Spec.ExternalClusterName, hit.Namespace, helpers.UseCertManager(), true)
if k8serrors.IsNotFound(err) {
return nil
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
}
return err
}

return r.HumioClient.DeleteIngestToken(config, req, hit)
Expand Down
7 changes: 5 additions & 2 deletions controllers/humioparser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,11 @@ func (r *HumioParserReconciler) SetupWithManager(mgr ctrl.Manager) error {

func (r *HumioParserReconciler) finalize(ctx context.Context, config *humioapi.Config, req reconcile.Request, hp *humiov1alpha1.HumioParser) error {
_, err := helpers.NewCluster(ctx, r, hp.Spec.ManagedClusterName, hp.Spec.ExternalClusterName, hp.Namespace, helpers.UseCertManager(), true)
if k8serrors.IsNotFound(err) {
return nil
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
}
return err
}

return r.HumioClient.DeleteParser(config, req, hp)
Expand Down
7 changes: 5 additions & 2 deletions controllers/humiorepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ func (r *HumioRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error {

func (r *HumioRepositoryReconciler) finalize(ctx context.Context, config *humioapi.Config, req reconcile.Request, hr *humiov1alpha1.HumioRepository) error {
_, err := helpers.NewCluster(ctx, r, hr.Spec.ManagedClusterName, hr.Spec.ExternalClusterName, hr.Namespace, helpers.UseCertManager(), true)
if k8serrors.IsNotFound(err) {
return nil
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
}
return err
}

return r.HumioClient.DeleteRepository(config, req, hr)
Expand Down

0 comments on commit 12c3466

Please sign in to comment.