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-1134: do not unregister plugin #507

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions controllers/consoleplugin/consoleplugin_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ func (r *CPReconciler) checkAutoPatch(ctx context.Context, desired *flowslatest.
if reg && !registered {
console.Spec.Plugins = append(console.Spec.Plugins, constants.PluginName)
return r.Client.Update(ctx, &console)
} else if !reg && registered {
console.Spec.Plugins = helper.RemoveAllStrings(console.Spec.Plugins, constants.PluginName)
return r.Client.Update(ctx, &console)
}
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions controllers/flowcollector_controller_console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func flowCollectorConsolePluginSpecs() {
Enable: ptr.To(true),
Port: 9001,
ImagePullPolicy: "Never",
Register: ptr.To(true),
Register: ptr.To(false),
Autoscaler: flowslatest.FlowCollectorHPA{
Status: flowslatest.HPAStatusEnabled,
MinReplicas: ptr.To(int32(1)),
Expand Down Expand Up @@ -224,20 +224,20 @@ func flowCollectorConsolePluginSpecs() {
})

Context("Registering to the Console CR", func() {
It("Should be registered by default", func() {
It("Should start unregistered", func() {
Eventually(func() interface{} {
cr := operatorsv1.Console{}
if err := k8sClient.Get(ctx, consoleCRKey, &cr); err != nil {
return err
}
return cr.Spec.Plugins
}, timeout, interval).Should(Equal([]string{"netobserv-plugin"}))
}, timeout, interval).Should(BeEmpty())
})

It("Should be unregistered", func() {
jotak marked this conversation as resolved.
Show resolved Hide resolved
By("Update CR to unregister")
jotak marked this conversation as resolved.
Show resolved Hide resolved
updateCR(crKey, func(fc *flowslatest.FlowCollector) {
fc.Spec.ConsolePlugin.Register = ptr.To(false)
fc.Spec.ConsolePlugin.Register = ptr.To(true)
})

By("Expecting the Console CR to not have plugin registered")
Expand All @@ -247,7 +247,7 @@ func flowCollectorConsolePluginSpecs() {
return err
}
return cr.Spec.Plugins
}, timeout, interval).Should(BeEmpty())
}, timeout, interval).Should(Equal([]string{"netobserv-plugin"}))
})
})

Expand Down