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

Deploy fluentbit as a statefulset #484

Merged
merged 1 commit into from Dec 19, 2022
Merged

Conversation

wenchajun
Copy link
Member

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.:


@wenchajun
Copy link
Member Author

related #443

},
},
},
{
Copy link
Collaborator

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?

Copy link
Member

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"`
Copy link
Collaborator

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does BufferVolume do?

@wenchajun wenchajun changed the title Deploy fluentbit as a statefulset [WIP]Deploy fluentbit as a statefulset Dec 6, 2022
@wenchajun wenchajun changed the title [WIP]Deploy fluentbit as a statefulset Deploy fluentbit as a statefulset Dec 6, 2022
@wenchajun
Copy link
Member Author

fixed

@benjaminhuo
Copy link
Member

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"`
Copy link
Collaborator

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.


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)
Copy link
Collaborator

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?

}

var sts appsv1.StatefulSet
err = r.Get(ctx, client.ObjectKey{Namespace: co.Namespace, Name: co.Name}, &sts)
Copy link
Collaborator

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.

if strings.HasPrefix(*bufferPath, "/buffers") {
return *bufferPath
} else {
targetPaths := []string{"/buffers"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this?

wanjunlei
wanjunlei previously approved these changes Dec 19, 2022
return ctrl.NewControllerManagedBy(mgr).
For(&fluentbitv1alpha2.Collector{}).
Owns(&corev1.ServiceAccount{}).
Owns(&appsv1.StatefulSet{}).
Copy link
Member

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
}

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -0,0 +1,194 @@
package operator
Copy link
Member

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>
@benjaminhuo benjaminhuo merged commit 3796ca0 into fluent:master Dec 19, 2022
@benjaminhuo
Copy link
Member

Don't forget to add docs for this @wenchajun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants