Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETOBSERV-1931: introduce flowcollector validation webhook #817

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

jotak
Copy link
Member

@jotak jotak commented Oct 16, 2024

Description

Start by validating agent features

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 labelled 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).

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Oct 16, 2024

@jotak: This pull request references NETOBSERV-1931 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

Description

Start by validating agent features

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 labelled 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).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jotak
Copy link
Member Author

jotak commented Oct 16, 2024

image

- Filters port validation
- Warn on high logging veerbosity on critical components
- FlowMetrics: warn on cardinality
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 64.37247% with 88 lines in your changes missing coverage. Please review.

Project coverage is 66.30%. Comparing base (eda7559) to head (59cfdab).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...lector/v1beta2/flowcollector_validation_webhook.go 45.87% 49 Missing and 10 partials ⚠️
pkg/cluster/cluster.go 77.46% 9 Missing and 7 partials ⚠️
apis/flowmetrics/v1alpha1/flowmetric_webhook.go 53.84% 5 Missing and 1 partial ⚠️
pkg/manager/manager.go 75.00% 2 Missing and 1 partial ⚠️
controllers/flp/flp_controller.go 60.00% 1 Missing and 1 partial ⚠️
...pis/flowcollector/v1beta2/flowcollector_webhook.go 0.00% 1 Missing ⚠️
controllers/flowcollector_controller.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #817      +/-   ##
==========================================
- Coverage   66.42%   66.30%   -0.13%     
==========================================
  Files          75       75              
  Lines        8810     8950     +140     
==========================================
+ Hits         5852     5934      +82     
- Misses       2535     2581      +46     
- Partials      423      435      +12     
Flag Coverage Δ
unittests 66.30% <64.37%> (-0.13%) ⬇️

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

Files with missing lines Coverage Δ
...pis/flowcollector/v1beta2/zz_generated.deepcopy.go 41.60% <ø> (ø)
controllers/consoleplugin/consoleplugin_objects.go 89.57% <100.00%> (ø)
...trollers/consoleplugin/consoleplugin_reconciler.go 73.33% <100.00%> (+1.48%) ⬆️
controllers/ebpf/agent_controller.go 52.29% <100.00%> (ø)
controllers/ebpf/agent_metrics.go 89.56% <100.00%> (ø)
...ntrollers/ebpf/internal/permissions/permissions.go 76.29% <100.00%> (ø)
controllers/flp/flp_common_objects.go 93.51% <100.00%> (ø)
controllers/flp/flp_monolith_objects.go 89.18% <100.00%> (ø)
controllers/flp/flp_monolith_reconciler.go 62.16% <100.00%> (ø)
controllers/flp/flp_transfo_reconciler.go 62.90% <100.00%> (ø)
... and 12 more

... and 4 files with indirect coverage changes

Copy link
Contributor

@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, 2 minor comments. This comments can be addressed later since this PR is blocking other work.

warnings = append(warnings, "The NetworkEvents feature is only supported with OpenShift")
}
if !fc.Spec.Agent.EBPF.Privileged {
warnings = append(warnings, "The NetworkEvents feature requires eBPF Agent to run in privileged mode")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an error? We know it is not going to work.

Copy link
Member Author

Choose a reason for hiding this comment

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

My rationale is that I'm setting warnings for things that won't work but won't break anything (e.g. a feature that will not be enabled), and errors for things that may break something or produce garbage / unexpected data (e.g. an invalid filter set on a metric will make the metric tell something completely different from the expectation)

}

// MockOpenShiftVersion shouldn't be used except for testing
func (c *Info) MockOpenShiftVersion(v string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in a test file ?
May be not as a method since this is for tests only.

Copy link
Member Author

Choose a reason for hiding this comment

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

it manipulates non-exported data (e.g. apisMap) so it has to be in the cluster package ; and it must be importable from other packages, so not in a *_test.go file ; we can't do that, right?

Copy link
Contributor

@jpinsonneau jpinsonneau left a comment

Choose a reason for hiding this comment

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

LGTM

From the user perspective, where does this warnings shows up in the console ?
It may be good to have these in the Status field 🤔

@jotak
Copy link
Member Author

jotak commented Oct 17, 2024

LGTM

From the user perspective, where does this warnings shows up in the console ?

image

It may be good to have these in the Status field 🤔

yeah I guess we can do that, let me create a follow-up task

@jotak
Copy link
Member Author

jotak commented Oct 17, 2024

/approve

@jotak
Copy link
Member Author

jotak commented Oct 17, 2024

@jotak
Copy link
Member Author

jotak commented Oct 17, 2024

thanks!
/approve

Copy link

openshift-ci bot commented Oct 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jotak

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

The pull request process is described here

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

@jotak jotak merged commit 340ba26 into netobserv:main Oct 17, 2024
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants