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
Deploy fluentbit as a statefulset #484
Conversation
related #443 |
pkg/operator/fbstatefulset.go
Outdated
}, | ||
}, | ||
}, | ||
{ |
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.
Does it need to mount the container and system log paths in the Collector mode?
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 we needn't mount these paths in collector mode which is only used to collect data from network
// Host networking is requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false. | ||
HostNetwork bool `json:"hostNetwork,omitempty"` | ||
// Buffer definition | ||
BufferVolume *BufferVolume `json:"buffer,omitempty"` |
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.
Why need this? This volume is just created but not mounted.
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.
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.
What does BufferVolume
do?
Add FluentBit collector is helpful in scenarios of collecting data through the network including the following input plugins:
All DaemonSet based fields can be removed:
|
Agree. |
fixed |
Need to add logic to create a service and add input plugins' port to this service |
DisableService bool `json:"disableService,omitempty"` | ||
// The path where buffer chunks are stored. This field would make no effect in memory buffer plugin. | ||
// +kubebuilder:validation:Required | ||
BufferPath *string `json:"bufferPath,omitempty"` |
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.
kubebuilder:validation:Required
and omitempty
should not be set simultaneously.
controllers/collector_controller.go
Outdated
|
||
func (r *CollectorReconciler) delete(ctx context.Context, co *fluentbitv1alpha2.Collector) error { | ||
var sa corev1.ServiceAccount | ||
err := r.Get(ctx, client.ObjectKey{Namespace: co.Namespace, Name: co.Name}, &sa) |
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.
No need to get it before deleting, just delete it directly.
Why does not delete the clusterrole
and clusterrolebinding
?
controllers/collector_controller.go
Outdated
} | ||
|
||
var sts appsv1.StatefulSet | ||
err = r.Get(ctx, client.ObjectKey{Namespace: co.Namespace, Name: co.Name}, &sts) |
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.
No need to get it before deleting, just delete it directly.
pkg/operator/fbstatefulset.go
Outdated
if strings.HasPrefix(*bufferPath, "/buffers") { | ||
return *bufferPath | ||
} else { | ||
targetPaths := []string{"/buffers"} |
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.
Why do this?
return ctrl.NewControllerManagedBy(mgr). | ||
For(&fluentbitv1alpha2.Collector{}). | ||
Owns(&corev1.ServiceAccount{}). | ||
Owns(&appsv1.StatefulSet{}). |
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.
The service should also be controlled/owned by the Collector
CRD
if err := r.Delete(ctx, &sa); err != nil && !errors.IsNotFound(err) { | ||
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.
should also add logic the delete the service?
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.
fixed
pkg/operator/fbstatefulset.go
Outdated
@@ -0,0 +1,194 @@ | |||
package operator |
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.
This file can be renamed to collector-statefulset
?
Signed-off-by: chengdehao <dehaocheng@kubesphere.io>
Don't forget to add docs for this @wenchajun |
Signed-off-by: chengdehao dehaocheng@kubesphere.io
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: