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-924 adapt to new ovn annotation format #404

Merged
merged 2 commits into from
Mar 24, 2023

Conversation

jotak
Copy link
Member

@jotak jotak commented Mar 14, 2023

The format of this annotation has changed between ocp 4.12 and 4.13 This kind of IPs are typically used in host-network traffic

The format of this annotation has changed between ocp 4.12 and 4.13
This kind of IPs are typically used in host-network traffic
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #404 (7a682a5) into main (a0ead7a) will increase coverage by 63.84%.
The diff coverage is 82.75%.

@@            Coverage Diff            @@
##           main     #404       +/-   ##
=========================================
+ Coverage      0   63.84%   +63.84%     
=========================================
  Files         0       92       +92     
  Lines         0     6491     +6491     
=========================================
+ Hits          0     4144     +4144     
- Misses        0     2107     +2107     
- Partials      0      240      +240     
Flag Coverage Δ
unittests 63.84% <82.75%> (?)

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

Impacted Files Coverage Δ
...ipeline/transform/kubernetes/cni/ovn_kubernetes.go 63.04% <82.75%> (ø)

... and 91 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

}
return "", fmt.Errorf("unexpected content for annotation %s: %s", ovnSubnetAnnotation, subnetsJSON)
return fmt.Sprintf("%d.%d.%d.2", ip4[0], ip4[1], ip4[2]), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

what is .2 ? maybe u can use fmt.Sprintf("%s",net.IPv4(ip4))

Copy link
Member Author

@jotak jotak Mar 15, 2023

Choose a reason for hiding this comment

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

The IP here is the first one of the range provided by the subnet that is read above; e.g. we read the subnet 10.128.0.0/23, from that we get first-in-range IP 10.128.0.0 ; then it's a tacit rule with ovn-k that the .2 ip from that subnet is used for the mp0 interface, which is the one we want to track here. So we need somehow to convert 10.128.0.0/23 into 10.128.0.2.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, we can also write ip4[3] = 2 and return just ip4.String(), to not involve fmt.

Copy link

@stleerh stleerh Mar 21, 2023

Choose a reason for hiding this comment

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

That will work only if you can assume the suffix is never greater than 24.  It's better to add 2 or | 2 to ip4[3].

Copy link
Member Author

Choose a reason for hiding this comment

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

From past discussions, this is an assumption that we can make - although there's no guarantee that it won't change.

OlivierCazade
OlivierCazade previously approved these changes Mar 21, 2023
if subnet, ok := subnetsAsString["default"]; ok {
return subnet, nil
}
return "", fmt.Errorf("unexpected content for annotation %s: %s", ovnSubnetAnnotation, annot)
Copy link

Choose a reason for hiding this comment

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

(Minor) Wouldn't it be better to try the new way first and then if it fails, try legacy?

}
return "", fmt.Errorf("unexpected content for annotation %s: %s", ovnSubnetAnnotation, subnetsJSON)
return fmt.Sprintf("%d.%d.%d.2", ip4[0], ip4[1], ip4[2]), nil
Copy link

@stleerh stleerh Mar 21, 2023

Choose a reason for hiding this comment

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

That will work only if you can assume the suffix is never greater than 24.  It's better to add 2 or | 2 to ip4[3].

@memodi
Copy link

memodi commented Mar 23, 2023

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 23, 2023
@github-actions
Copy link

New image: quay.io/netobserv/flowlogs-pipeline:202938e. It will expire after two weeks.

@memodi
Copy link

memodi commented Mar 23, 2023

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved QE has approved this pull request label Mar 23, 2023
@jotak
Copy link
Member Author

jotak commented Mar 23, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 23, 2023

[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

@openshift-ci openshift-ci bot added the lgtm label Mar 24, 2023
@jotak jotak merged commit 1410840 into netobserv:main Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. qe-approved QE has approved this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants