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

feat(plugin): Support customplugin (#301) #377

Merged
merged 1 commit into from
Sep 20, 2022
Merged

feat(plugin): Support customplugin (#301) #377

merged 1 commit into from
Sep 20, 2022

Conversation

Gentleelephant
Copy link
Collaborator

Signed-off-by: Gentleelephant birdhk@kubesphere.io

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #301

Does this PR introduced a user-facing change?


Additional documentation, usage docs, etc.:


@@ -19,6 +19,7 @@ package v1alpha2
import (
"bytes"
"fmt"
"github.com/fluent/fluent-operator/apis/fluentbit/v1alpha2/plugins/custom"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Imports need to sort.

@@ -1,6 +1,7 @@
package v1alpha2

import (
"github.com/fluent/fluent-operator/apis/fluentbit/v1alpha2/plugins/custom"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Imports need to sort.

if len(tmp) < 2 {
continue
}
if strings.EqualFold(tmp[0], "Name") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The key Name also can be name of NAME.

return "NONE"
}

func (a *CustomPlugin) Params(_ plugins.SecretLoader) (*params.KVs, error) {
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 to parser the config? Why need to skip the name field?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A custom plugin is also a plugin that implements the Plugin interface. The plugin name is already resolved in the Name method, so there is no need to resolve the Name again.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A more reasonable approach.

Add the name filed just when the p.Name() is not nil
https://github.com/fluent/fluent-operator/blob/master/apis/fluentbit/v1alpha2/clusterinput_types.go#L94

1663571575(1)

and make the customPlugin.Name() return nil

@benjaminhuo
Copy link
Member

@Gentleelephant We also need to update docs for plugins https://github.com/fluent/fluent-operator/tree/master/docs/plugins/fluentbit

@wanjunlei How to generate these docs automatically?

The index should be added manually as I can remember

@benjaminhuo
Copy link
Member

benjaminhuo commented Sep 19, 2022

@Gentleelephant We also need to update docs for plugins https://github.com/fluent/fluent-operator/tree/master/docs/plugins/fluentbit

@wanjunlei How to generate these docs automatically?

The index should be added manually as I can remember

make docs-update?

https://github.com/fluent/fluent-operator/blob/master/Makefile#L174

@wanjunlei
Copy link
Collaborator

@Gentleelephant We also need to update docs for plugins https://github.com/fluent/fluent-operator/tree/master/docs/plugins/fluentbit
@wanjunlei How to generate these docs automatically?
The index should be added manually as I can remember

make docs-update?

https://github.com/fluent/fluent-operator/blob/master/Makefile#L174

Yes

@Gentleelephant
Copy link
Collaborator Author

Regarding the modification of the document, do I need to create a new pr? @benjaminhuo @wanjunlei

@benjaminhuo
Copy link
Member

Regarding the modification of the document, do I need to create a new pr? @benjaminhuo @wanjunlei

No, In the same PR is ok

@benjaminhuo
Copy link
Member

benjaminhuo commented Sep 19, 2022

Signed-off-by: Gentleelephant <birdhk@kubesphere.io>
@benjaminhuo benjaminhuo merged commit 977a14a into fluent:master Sep 20, 2022
@Gentleelephant Gentleelephant deleted the feat-301 branch September 20, 2022 01:59
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.

Support custom plugins for fluentbit
3 participants