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-1407 - Loki labels for deduper merge #529

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

jpinsonneau
Copy link
Contributor

Description

This PR removes FlowDirection and Duplicate labels when deduper merge mode is enabled.

It also centralize labels array in a single function (K8S_ClusterName was not sent to console plugin).

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

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bf1562e) 57.73% compared to head (894cf30) 57.67%.
Report is 1 commits behind head on main.

❗ Current head 894cf30 differs from pull request most recent head c891c2f. Consider uploading reports for the commit c891c2f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #529      +/-   ##
==========================================
- Coverage   57.73%   57.67%   -0.07%     
==========================================
  Files          70       71       +1     
  Lines        9446     9452       +6     
==========================================
- Hits         5454     5451       -3     
- Misses       3659     3667       +8     
- Partials      333      334       +1     
Flag Coverage Δ
unittests 57.67% <100.00%> (-0.07%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jpinsonneau
Copy link
Contributor Author

Rebased without changes

@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 22, 2024
Copy link

New images:

  • quay.io/netobserv/network-observability-operator:0ed9d9d
  • quay.io/netobserv/network-observability-operator-bundle:v0.0.0-0ed9d9d
  • quay.io/netobserv/network-observability-operator-catalog:v0.0.0-0ed9d9d

They will expire after two weeks.

To deploy this build:

# Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:0ed9d9d make deploy

# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-0ed9d9d

Or as a Catalog Source:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: netobserv-dev
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-0ed9d9d
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@jpinsonneau jpinsonneau marked this pull request as ready for review January 22, 2024 12:08
@jpinsonneau
Copy link
Contributor Author

As a followup, we should try to entirely get rid of FlowDirection and Interface fields:

  • need to rework the way flp NetworkTransformDirectionInfo works to manage FlowDirections array
  • decide what to do with prometheus metrics (keep current filtering or switch to arrays)
  • remove old columns from loki storage / console display

EBPF: flowslatest.FlowCollectorEBPF{
Advanced: &flowslatest.AdvancedAgentConfig{
Env: map[string]string{
"DEDUPER_JUST_MARK": "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't that the default ? why need to set it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the default indeed !

However removing it seems to affect the reconcile loop and makes the test fail. As far as I remember it says the CR failed to update because it's not up to date (probably from status update code). It would require a dummy update in the tests to make it work.

Everything seems to work fine on a real cluster 😸

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this is just test code

indexFields = append(indexFields, constants.ClusterNameLabelName)
}

if helper.UseEBPF(desired) {
Copy link
Contributor

Choose a reason for hiding this comment

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

so you are using justMark bool as indication if dupMerge or not ? why not check dupMerge directly ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/!\ This file only manages loki labels !

For now, I only add / remove FlowDirection and Duplicate labels according to justMark flag:

var LokiDeduperMarkIndexFields = []string{"FlowDirection", "Duplicate"}

For merge flag, we don't need label on related arrays since there is no deduplication on plugin side. That means queries are running straight forward without making any fancy filtering on these 😎

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 24, 2024
@jpinsonneau
Copy link
Contributor Author

While double checking console flags, I figured out that the defaults values were not correctly set in current code when Advanced is nil (I guess it was a rebase issue).

I fixed that in 894cf30 but that doesn't solve the certificates_test issue.

@@ -365,14 +362,10 @@ func (b *builder) setFrontendConfig(fconf *config.FrontendConfig) {
if b.desired.Agent.EBPF.Advanced != nil {
if v, ok := b.desired.Agent.EBPF.Advanced.Env[ebpf.EnvDedupeJustMark]; ok {
dedupJustMark, _ = strconv.ParseBool(v)
} else {
dedupJustMark, _ = strconv.ParseBool(ebpf.DedupeJustMarkDefault)
}

if v, ok := b.desired.Agent.EBPF.Advanced.Env[ebpf.EnvDedupeMerge]; ok {
dedupMerge, _ = strconv.ParseBool(v)
Copy link
Contributor

Choose a reason for hiding this comment

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

not related to recent changes but why we ignore errors from ParseBool ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These booleans are constants from agent_controller.go. We are not supposed to have errors here right ?
If you prefer we can make reconcile loop crash 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

what do u mean ParseBool is what we will get from FC object for the constants u are referring to someone could set the env var to something bad which will trigger
https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/strconv/atob.go;l=17
specially we have no API validation for this envvar try setting to "foo" and see what will happen :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I thought we were talking about defaults values here; that's right, I should manage parse error from Env input !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

openshift-ci bot commented Jan 25, 2024

@jpinsonneau: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-operator c891c2f link false /test e2e-operator

Full PR test history. Your PR dashboard.

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 kubernetes/test-infra repository. I understand the commands that are listed here.

@msherif1234
Copy link
Contributor

/test e2e-operator
/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jan 25, 2024
@jpinsonneau jpinsonneau added no-qe This PR doesn't necessitate QE approval approved labels Jan 25, 2024
Copy link

openshift-ci bot commented Jan 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@openshift-merge-bot openshift-merge-bot bot merged commit fe8ae8c into netobserv:main Jan 25, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm no-qe This PR doesn't necessitate QE approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants