Skip to content

Code cleanup / refactoring to minimize dependencies in api#2498

Merged
jotak merged 1 commit intonetobserv:mainfrom
jotak:clean-deps-api
Mar 2, 2026
Merged

Code cleanup / refactoring to minimize dependencies in api#2498
jotak merged 1 commit intonetobserv:mainfrom
jotak:clean-deps-api

Conversation

@jotak
Copy link
Member

@jotak jotak commented Feb 25, 2026

Description

The api package should keep minimal dependencies, as it is typically the kind of package that other integrating tools may want to import

The dependency on
github.com/netobserv/network-observability-operator/internal/pkg/cluster was problematic as it pulls a lot transitively, including kube clients. So it's removed, and cluster.Info is replaced in the webhook with an interface clusterInfo.

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labeled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

The api package should keep minimal dependencies, as it is typically the
kind of package that other integrating tools may want to import

The dependency on
github.com/netobserv/network-observability-operator/internal/pkg/cluster
was problematic because it pulls a lot of things transitively, including
kube clients. So it's removed, and cluster.Info is replaced in the
webhook with an interface clusterInfo.

The remaining other dependencies have more limited impact.
@openshift-ci
Copy link

openshift-ci bot commented Feb 25, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign memodi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.64%. Comparing base (e3056de) to head (8c82162).

Files with missing lines Patch % Lines
...lector/v1beta2/flowcollector_validation_webhook.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2498      +/-   ##
==========================================
- Coverage   72.71%   72.64%   -0.08%     
==========================================
  Files         104      104              
  Lines       10615    10615              
==========================================
- Hits         7719     7711       -8     
- Misses       2425     2428       +3     
- Partials      471      476       +5     
Flag Coverage Δ
unittests 72.64% <92.30%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/controller/networkpolicy/np_objects.go 96.57% <100.00%> (ø)
internal/pkg/cluster/cluster.go 84.37% <100.00%> (-1.79%) ⬇️
...lector/v1beta2/flowcollector_validation_webhook.go 73.70% <50.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@OlivierCazade OlivierCazade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci openshift-ci bot added the lgtm label Mar 2, 2026
@jotak jotak merged commit 65f3d96 into netobserv:main Mar 2, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants