-
Notifications
You must be signed in to change notification settings - Fork 24
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-1500 : Refactoring of transform network API #580
NETOBSERV-1500 : Refactoring of transform network API #580
Conversation
/hold |
a258367
to
f712b3e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #580 +/- ##
==========================================
+ Coverage 66.97% 67.22% +0.24%
==========================================
Files 104 104
Lines 7446 7459 +13
==========================================
+ Hits 4987 5014 +27
+ Misses 2162 2143 -19
- Partials 297 302 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
164e724
to
a34a925
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet reviewed in deep, but the approach looks good to me
specializing each rule params via their own struct rather than forcing a generic approach looks much better!
I'll have some work that depends on this, for NETOBSERV-1426
KubernetesInfra *K8sInfraRule `yaml:"kubernetes_infra,omitempty" json:"kubernetes_infra,omitempty" doc:"Kubernetes infra rule configuration"` | ||
Kubernetes *K8sRule `yaml:"kubernetes,omitempty" json:"kubernetes,omitempty" doc:"Kubernetes rule configuration"` | ||
AddSubnet *NetworkAddSubnetRule `yaml:"add_subnet,omitempty" json:"add_subnet,omitempty" doc:"Add subnet rule configuration"` | ||
AddLocation *NetworkGenericRule `yaml:"add_location,omitempty" json:"add_location,omitempty" doc:"Add location rule configuration"` | ||
AddIPCategory *NetworkGenericRule `yaml:"add_ip_category,omitempty" json:"add_ip_category,omitempty" doc:"Add ip category rule configuration"` | ||
AddService *NetworkAddServiceRule `yaml:"add_service,omitempty" json:"add_service,omitempty" doc:"Add service rule configuration"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we often have same type of rules applied in a row; on both source & destination for example.
Would it make sense to allow arrays on the objects above ?
Then you will be able to call something like:
api.NetworkTransformRules{{
Type: api.AddKubernetesRuleType,
Kubernetes: []api.K8sRule{
api.K8sRule{
Input: "SrcAddr",
Output: "SrcK8S",
},
api.K8sRule{
Input: "DstAddr",
Output: "DstK8S",
},
},
}}})
We could even get rid of the type by just providing objects 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove the type field but this would change consistency with the rest of the API that is using it.
About allowing an array, this mean we would have two nested level of rules instead of having one flat array of rules. This add complexity and I am not sure to see a value in doing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I don't have a preference regarding Julien's suggestion (having an inner slice in k8s rules) .. it avoids some repetition but makes having an additional nested slice, hard to say which is simpler.
before merging we need to have the operator PR ready for the breaking change
/lgtm |
@OlivierCazade can you edit the description to briefly explain what are the breaking changes, and give an example of how to convert an old config to a new one? This would help users who are hit by the breaking change to quickly figure out how to handle it |
I'm adding no-qe / no-doc as there's no user facing changes - I tested myself along with netobserv/network-observability-operator#562 |
a34a925
to
d688fe3
Compare
/ok-to-test |
New image: It will expire after two weeks. To deploy this build, run from the operator repo, assuming the operator is running: USER=netobserv VERSION=380f2f0 make set-flp-image |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: OlivierCazade 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 |
Description
Created different type for the different transform rules
Previously the
NetworkTransformRule
had all fields at the same level, but they were not all used by all transform network types and theParameter
field was used differently depending on the type.The struct go from this:
To this :
Now every rule type has its own structure.
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.