-
Notifications
You must be signed in to change notification settings - Fork 41
NETOBSERV-2225 - Deploy static plugin at operator startup #1345
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
Conversation
// force reconcile at startup | ||
go r.InitReconcile(ctx) | ||
|
||
return nil | ||
} | ||
|
||
func (r *FlowCollectorReconciler) InitReconcile(ctx context.Context) error { | ||
log := log.FromContext(ctx) | ||
log.Info("Initializing resources...") | ||
|
||
var err error | ||
for attempt := range initReconcileAttempts { | ||
// delay the reconcile calls to let some time to the cache to load | ||
time.Sleep(5 * time.Second) | ||
_, err = r.Reconcile(ctx, reconcile.Request{}) | ||
if err != nil { | ||
log.Error(err, "Error while doing initial reconcile", "attempt", attempt) | ||
} else { | ||
break | ||
} | ||
} | ||
return err | ||
} |
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 wonder if there is an out of box mechanism to trigger the loop after the cache loaded. That's why I'm using a sleep here and this will may work in all situations.
https://redhat-internal.slack.com/archives/C02939DP5L5/p1743518264445429
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.
If I remember correctly, when a reconcile loop is failing, you can also return a time value to reschedule the reconciliation.
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.
Yeah I gave a try with that without success.
I'm refactoring the code again to move the static content to another controller wich will be cleaner I guess. I will give another try with the reschedule time on the new controller 👍
c4c57e1
to
dbc4cbf
Compare
// force reconcile at startup | ||
go r.InitReconcile(ctx) | ||
|
||
return ctrl.NewControllerManagedBy(mgr). | ||
For(&flowslatest.FlowCollector{}, reconcilers.IgnoreStatusChange). | ||
Named("staticPlugin"). | ||
Complete(&r) | ||
} | ||
|
||
func (r *Reconciler) InitReconcile(ctx context.Context) { | ||
log := log.FromContext(ctx) | ||
log.Info("Initializing resources...") | ||
|
||
for attempt := range initReconcileAttempts { | ||
// delay the reconcile calls to let some time to the cache to load | ||
time.Sleep(5 * time.Second) | ||
_, err := r.Reconcile(ctx, ctrl.Request{}) | ||
if err != nil { | ||
log.Error(err, "Error while doing initial reconcile", "attempt", attempt) | ||
} else { | ||
return | ||
} | ||
} | ||
} |
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.
@OlivierCazade I modified the PR to be in a dedicated controller.
As you can see, I force the Reconcile
call during the Start
function so OLM can't interpret the result containing Requeue / RequeueAfter here.
Since we don't create a dedicated CR for static plugin, I don't think we can rely on these here.
WDYT ?
Rebased without changes |
/ok-to-test |
New images:
They will expire after two weeks. To deploy this build: # Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:cdd8f5a make deploy
# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-sha-cdd8f5a 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-sha-cdd8f5a
displayName: NetObserv development catalog
publisher: Me
updateStrategy:
registryPoll:
interval: 1m |
@jpinsonneau Here's quick feedback from my initial review of the form view:
[1] ![]() at the end it generated empty yaml [2] , I was trying with 4.20 OCP version ![]() I'll add more feedback as I test more. |
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace |
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.
@jpinsonneau - can we append this env var instead of adding it in middle so that index # for the existing vars doesn't change? We have several scripts and CI steps where we patch csv which happens based on index of env var.
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.
Sure, I cant put it in the end of the list if it help 😸
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.
Sure I can add some notes and recommendations on top of the current descriptions. These are coming from the API so maybe we can also improve it. About the options 1 / 2 and the advanced config, we need to decide what to expose and what to skip as these needs extra tweaking to make it work. If we decide to not expose these, I will simply hide these fields. |
You can directly click on the left menu to navigate to the last step. Isn't it enough ?
Sure, good idea !
Indeed. Would you prefer to have a scrollbar on the status list or a scrollbar on the entire page ?
Indeed I should rely on the
I can see if I can skip some refreshs here to avoid that. Thanks for your feedback ! |
ah, it wasn't clear me, that I could jump that way.
I think scrollbar on status list make sense to me.
I think these are much advanced config which can be handled directly in yaml. of all the advancedConfig, IMHO secondaryNetworks may probably be more utilized than others, may be it make a case to move it out of advanced config in API for it. |
/label needs-changes |
@memodi: The label(s) In response to this:
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-sigs/prow repository. |
/needs-changes |
@memodi coming back on the notes, that's what we have today: I would suggest to update the CRD first and then in the forms if we are not satisfied with those texts |
sure, np, though it would be nice to have a way to override API docs text |
/ok-to-test |
New images:
They will expire after two weeks. To deploy this build: # Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:02a5af9 make deploy
# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-sha-02a5af9 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-sha-02a5af9
displayName: NetObserv development catalog
publisher: Me
updateStrategy:
registryPoll:
interval: 1m |
@jpinsonneau: The following test failed, say
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-sigs/prow repository. I understand the commands that are listed here. |
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
another round of testing will be done post-merge; merging now! |
Description
Create the console plugin when FlowCollector doesn't exists to expose the new forms.
Suggested alternatives: #1346 & #1374See netobserv/network-observability-console-plugin#763 for the forms implementations
Dependencies
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.