Remove tag consideration from Fluentd ClusterFilter / Filter order

未关闭
#1,832 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@cvas22 已经在做这个了。

开始于 2026年11月11日。

  • #2125 来自 @cvas22 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, kubernetes
领域
devops

调研方向

从 apis/fluentd/v1alpha1/plugins/params/model.go 中的 PluginStoreByNameById.Less 开始。阅读当前的名称、标签和 ID 比较,然后评估不考虑标签时所要求的排序。当排序遵循过滤器名称和 ID 时即表示完成,包括 ** 出现在过滤器之间的情况。

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

The filter order logic in fluentd ever since https://github.com/fluent/fluent-operator/pull/1106 can be seen here.
Specifically in:

func (a PluginStoreByNameById) Less(i, j int) bool {
	if a[i].Name == a[j].Name {
		if a[i].GetTag() == "**" && a[j].GetTag() != "**" {
			return false
		}
		if a[i].GetTag() != "**" && a[j].GetTag() == "**" {
			return true
		}
		return a[i].GetId() < a[j].GetId()
	} else {
		return a[i].Name < a[j].Name
	}
}

From reading the code, it seems filters with tag ** will be order last no matter the id (which matches my experience).
My argument is that the current ordering is problematic and unintuitive.

Describe the solution you'd like

The more initiative ordering, is to consider the filter k8s name, and then if a ClusterFilter / Filter contains a list of several filters, it should add them in order.
This seems to already happen inside return a[i].GetId() < a[j].GetId(), so the only thing left is to remove the GetTag section.

I understand that this is a breaking change, but the current ordering prevent having ** in as a middle filter, which is useful.
I think this should either be a breaking change in version v4, or add a parameter for the deployment to disable tag ordering.

Workaround

Using customPlugin with some placeholder tag, and then setting the filter to ** in the config section.

Additional context

No response

主要语言
Go
星标
689
派生
333
平均合并
2 天 14 小时
30 天内合并 PR
41

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fluent/fluent-operator 的其他 Issue

查看 fluent/fluent-operator 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。