-
Notifications
You must be signed in to change notification settings - Fork 26
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-1092 Move CRD fields to advanced #467
Conversation
@msherif1234 Should we consider the eBPF cache fields as debug ?
|
I don't think so those knob if user decided to tune will be because resource limitation or excess and will change and stay so they are more of config operation knobs not debug IMHO |
api/v1beta2/flowcollector_types.go
Outdated
@@ -635,37 +591,10 @@ type FlowCollectorLoki struct { | |||
// Set `enable` to `true` to store flows in Loki. It is required for the OpenShift Console plugin installation. | |||
Enable *bool `json:"enable,omitempty"` | |||
|
|||
//+kubebuilder:default:="1s" |
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.
Like for the ebpf agent, I think batchWait and batchSize could be good to keep not in Debug, for performance tuning?
Especially BatchSize is something users need to keep consistent with the msg max size defined on loki server-side.
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.
Well I based that on the Jira you initially wrote 🤔
If you changed your mind I can revert. Just let me know.
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.
On my side I would feel better as a user to have that elsewhere but debug
is a strong word here.
Maybe we could just concider renaming the debug
sections to something more generic such as advanced
?
Just a remark that we should probably take back loki batch settings , other than that LGTM! |
Sure, I moved loki |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #467 +/- ##
==========================================
+ Coverage 56.27% 57.60% +1.32%
==========================================
Files 69 70 +1
Lines 9104 9446 +342
==========================================
+ Hits 5123 5441 +318
- Misses 3648 3668 +20
- Partials 333 337 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
api/v1beta2/flowcollector_types.go
Outdated
//+kubebuilder:default="1s" | ||
// `minBackoff` is the initial backoff time for client connection between retries. | ||
MinBackoff *metav1.Duration `json:"minBackoff,omitempty"` // Warning: keep as pointer, else default is ignored | ||
|
||
//+kubebuilder:default="5s" | ||
// `maxBackoff` is the maximum backoff time for client connection between retries. | ||
MaxBackoff *metav1.Duration `json:"maxBackoff,omitempty"` // Warning: keep as pointer, else default is ignored | ||
|
||
//+kubebuilder:validation:Minimum=0 | ||
//+kubebuilder:default:=2 | ||
// `maxRetries` is the maximum number of retries for client connections. | ||
MaxRetries *int32 `json:"maxRetries,omitempty"` | ||
|
||
//+kubebuilder:default:={"app":"netobserv-flowcollector"} | ||
// +optional | ||
// `staticLabels` is a map of common labels to set on each flow. | ||
StaticLabels map[string]string `json:"staticLabels"` |
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.
I'm fine with your suggestion to move flp-related loki config under processor;
For those 4 fields I guess they should be prefixed with "Loki" like you did for the others
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.
@@ -29,7 +29,6 @@ func TestBeta1ConversionRoundtrip_Loki(t *testing.T) { | |||
Enable: true, | |||
InsecureSkipVerify: true, | |||
}, | |||
BatchSize: 1000, |
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.
For beta1
-> beta2
-> beta1
cycle, we loose BatchSize
value since this field moved from Loki
to Processor
spec.
If we want to manage such, we'll need to manually override Convert_v1beta1_FlowCollector_To_v1beta2_FlowCollector
and Convert_v1beta2_FlowCollector_To_v1beta1_FlowCollector
to copy the fields.
Is it worth the price ? @jotak @msherif1234
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.
I think it's necessary to do it, else we loose the ability to set this field, since the conversions always happen between the served version (like v1beta2) and the stored version (v1beta1) ?
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.
(and same for all the other fields that are moved)
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.
also I tested deploying the sample flowcollector doesn't work, I think it still has all the old fields
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.
Hm, that's annoying since it always runs the conversion webhook, you end with debug
fields in the yaml all the time even if you directly apply v1beta2
sample:
spec:
agent:
ebpf:
...
debug: {}
consolePlugin:
...
debug:
port: 9001
register: true
processor:
...
debug:
port: 2055
lokiMaxRetries: 2
lokiMaxBackoff: 5s
conversationTerminatingTimeout: 5s
conversationEndTimeout: 10s
lokiStaticLabels:
app: netobserv-flowcollector
enableKubeProbes: true
lokiMinBackoff: 1s
healthPort: 8080
dropUnusedFields: true
conversationHeartbeatInterval: 30s
I would prefer to omit these when default.
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.
I agree but I don't see a perfect way to managing that ...
having in-code defaults, and fill these values only when they don't match the default? Not perfect because it would force us to keep defaults defined in two places...
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 would be nice to have a codegen tool like kubebuilder that automatically generates defaults as go consts from the kubebuilder annotations or from the CRD openAPI .... sounds like a hack'n'hustle project?
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.
I found a way to load defaults from CRD and show custom values only when set.
That required a bit of refactoring and creating a new crd helper but it works very well and the user still have autocompletion in the yaml.
For simplicity, I have created getters in flowcollector helper that sets defaults and load custom values in their related config so we can rely on these everywhere in the code and we don't need to check for nils.
|
Found a bug on conversion webhook: 04269b8 |
New images:
They will expire after two weeks. To deploy this build: # Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:8b85581 make deploy
# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-8b85581 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-8b85581
displayName: NetObserv development catalog
publisher: Me
updateStrategy:
registryPoll:
interval: 1m |
[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 |
/test e2e-operator |
read defaults from CRD fix merge Feedback on Debug crd sections - As suggested by Julien, rename Debug to Advanced - Merge back loki fields into Loki section
- Add webhook tests on Advanced sections - Fix loki.advanced not being overwritten from anotations on conversion - StaticLabel isn't a pointer to map anymore, as maps are already nillable - fix alm sample with renamed fields - generalize CRD setup for all suite_tests
- Some loki settings, when provided by a v1beta1 CR, were ignored, such as batchWait/Size - Found a minor day-0 bug in console: when the port setting is changed, console plugin was unreachable because the pod didn't use that port (only service did). It seems nobody ever changed that setting >_<
/ok-to-test |
Description
This PR move unused API fields to debug sections under each component.
See NETOBSERV-1092 for the list of affected fields.
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.