Skip to content

Commit

Permalink
Merge pull request #1244 from reegnz/add_new_fluentbit_config_parameters
Browse files Browse the repository at this point in the history
Add missing fluent-bit config parameters
  • Loading branch information
benjaminhuo authored Jul 18, 2024
2 parents e0d936d + cd963ea commit 9de7443
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ type Kubernetes struct {
// configurable 'time to live' for the K8s token. By default, it is set to 600 seconds.
// After this time, the token is reloaded from Kube_Token_File or the Kube_Token_Command.
KubeTokenTTL string `json:"kubeTokenTTL,omitempty"`
// Command to get Kubernetes authorization token.
// By default, it will be NULL and we will use token file to get token.
KubeTokenCommand string `json:"kubeTokenCommand,omitempty"`
// Configurable TTL for K8s cached namespace metadata.
// By default, it is set to 900 which means a 15min TTL for namespace cache entries.
// Setting this to 0 will mean entries are evicted at random once the cache is full.
KubeMetaNamespaceCacheTTL *int32 `json:"kubeMetaNamespaceCacheTTL,omitempty"`
// Include Kubernetes namespace resource labels in the extra metadata.
NamespaceLabels *bool `json:"namespaceLabels,omitempty"`
// Include Kubernetes namespace resource annotations in the extra metadata.
NamespaceAnnotations *bool `json:"namespaceAnnotations,omitempty"`
// Include Kubernetes namespace metadata only and no pod metadata.
// If this is set, the values of Labels and Annotations are ignored.
NamespaceMetadataOnly *bool `json:"namespaceMetadataOnly,omitempty"`
}

func (_ *Kubernetes) Name() string {
Expand Down Expand Up @@ -188,6 +202,21 @@ func (k *Kubernetes) Params(_ plugins.SecretLoader) (*params.KVs, error) {
if k.KubeTokenTTL != "" {
kvs.Insert("Kube_Token_TTL", k.KubeTokenTTL)
}
if k.KubeTokenCommand != "" {
kvs.Insert("Kube_Token_Command", fmt.Sprint(k.KubeTokenCommand))
}
if k.KubeMetaNamespaceCacheTTL != nil {
kvs.Insert("Kube_Meta_Namespace_Cache_TTL", fmt.Sprint(*k.KubeMetaNamespaceCacheTTL))
}
if k.NamespaceLabels != nil {
kvs.Insert("Namespace_Labels", fmt.Sprint(*k.NamespaceLabels))
}
if k.NamespaceAnnotations != nil {
kvs.Insert("Namespace_Annotations", fmt.Sprint(*k.NamespaceAnnotations))
}
if k.NamespaceMetadataOnly != nil {
kvs.Insert("Namespace_Metadata_Only", fmt.Sprint(*k.NamespaceMetadataOnly))
}
return kvs, nil
}

Expand Down
20 changes: 20 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/filter/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ spec:
when capacity is reached. In order to enable this option, you should set the number to a time interval.
For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted.
type: string
kubeMetaNamespaceCacheTTL:
description: |-
Configurable TTL for K8s cached namespace metadata.
By default, it is set to 900 which means a 15min TTL for namespace cache entries.
Setting this to 0 will mean entries are evicted at random once the cache is full.
format: int32
type: integer
kubeMetaPreloadCacheDir:
description: |-
If set, Kubernetes meta-data can be cached/pre-loaded from files in JSON format in this directory,
Expand All @@ -210,6 +217,11 @@ spec:
When the source records comes from Tail input plugin,
this option allows to specify what's the prefix used in Tail configuration.
type: string
kubeTokenCommand:
description: |-
Command to get Kubernetes authorization token.
By default, it will be NULL and we will use token file to get token.
type: string
kubeTokenFile:
description: Token file
type: string
Expand Down Expand Up @@ -254,6 +266,19 @@ spec:
the data contained in the log key. Recommended use is
for developers or testing only.
type: string
namespaceAnnotations:
description: Include Kubernetes namespace resource annotations
in the extra metadata.
type: boolean
namespaceLabels:
description: Include Kubernetes namespace resource labels
in the extra metadata.
type: boolean
namespaceMetadataOnly:
description: |-
Include Kubernetes namespace metadata only and no pod metadata.
If this is set, the values of Labels and Annotations are ignored.
type: boolean
regexParser:
description: |-
Set an alternative Parser to process record Tag and extract pod_name, namespace_name, container_name and docker_id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ spec:
when capacity is reached. In order to enable this option, you should set the number to a time interval.
For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted.
type: string
kubeMetaNamespaceCacheTTL:
description: |-
Configurable TTL for K8s cached namespace metadata.
By default, it is set to 900 which means a 15min TTL for namespace cache entries.
Setting this to 0 will mean entries are evicted at random once the cache is full.
format: int32
type: integer
kubeMetaPreloadCacheDir:
description: |-
If set, Kubernetes meta-data can be cached/pre-loaded from files in JSON format in this directory,
Expand All @@ -210,6 +217,11 @@ spec:
When the source records comes from Tail input plugin,
this option allows to specify what's the prefix used in Tail configuration.
type: string
kubeTokenCommand:
description: |-
Command to get Kubernetes authorization token.
By default, it will be NULL and we will use token file to get token.
type: string
kubeTokenFile:
description: Token file
type: string
Expand Down Expand Up @@ -254,6 +266,19 @@ spec:
the data contained in the log key. Recommended use is
for developers or testing only.
type: string
namespaceAnnotations:
description: Include Kubernetes namespace resource annotations
in the extra metadata.
type: boolean
namespaceLabels:
description: Include Kubernetes namespace resource labels
in the extra metadata.
type: boolean
namespaceMetadataOnly:
description: |-
Include Kubernetes namespace metadata only and no pod metadata.
If this is set, the values of Labels and Annotations are ignored.
type: boolean
regexParser:
description: |-
Set an alternative Parser to process record Tag and extract pod_name, namespace_name, container_name and docker_id.
Expand Down
25 changes: 25 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ spec:
when capacity is reached. In order to enable this option, you should set the number to a time interval.
For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted.
type: string
kubeMetaNamespaceCacheTTL:
description: |-
Configurable TTL for K8s cached namespace metadata.
By default, it is set to 900 which means a 15min TTL for namespace cache entries.
Setting this to 0 will mean entries are evicted at random once the cache is full.
format: int32
type: integer
kubeMetaPreloadCacheDir:
description: |-
If set, Kubernetes meta-data can be cached/pre-loaded from files in JSON format in this directory,
Expand All @@ -210,6 +217,11 @@ spec:
When the source records comes from Tail input plugin,
this option allows to specify what's the prefix used in Tail configuration.
type: string
kubeTokenCommand:
description: |-
Command to get Kubernetes authorization token.
By default, it will be NULL and we will use token file to get token.
type: string
kubeTokenFile:
description: Token file
type: string
Expand Down Expand Up @@ -254,6 +266,19 @@ spec:
the data contained in the log key. Recommended use is
for developers or testing only.
type: string
namespaceAnnotations:
description: Include Kubernetes namespace resource annotations
in the extra metadata.
type: boolean
namespaceLabels:
description: Include Kubernetes namespace resource labels
in the extra metadata.
type: boolean
namespaceMetadataOnly:
description: |-
Include Kubernetes namespace metadata only and no pod metadata.
If this is set, the values of Labels and Annotations are ignored.
type: boolean
regexParser:
description: |-
Set an alternative Parser to process record Tag and extract pod_name, namespace_name, container_name and docker_id.
Expand Down
25 changes: 25 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ spec:
when capacity is reached. In order to enable this option, you should set the number to a time interval.
For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted.
type: string
kubeMetaNamespaceCacheTTL:
description: |-
Configurable TTL for K8s cached namespace metadata.
By default, it is set to 900 which means a 15min TTL for namespace cache entries.
Setting this to 0 will mean entries are evicted at random once the cache is full.
format: int32
type: integer
kubeMetaPreloadCacheDir:
description: |-
If set, Kubernetes meta-data can be cached/pre-loaded from files in JSON format in this directory,
Expand All @@ -210,6 +217,11 @@ spec:
When the source records comes from Tail input plugin,
this option allows to specify what's the prefix used in Tail configuration.
type: string
kubeTokenCommand:
description: |-
Command to get Kubernetes authorization token.
By default, it will be NULL and we will use token file to get token.
type: string
kubeTokenFile:
description: Token file
type: string
Expand Down Expand Up @@ -254,6 +266,19 @@ spec:
the data contained in the log key. Recommended use is
for developers or testing only.
type: string
namespaceAnnotations:
description: Include Kubernetes namespace resource annotations
in the extra metadata.
type: boolean
namespaceLabels:
description: Include Kubernetes namespace resource labels
in the extra metadata.
type: boolean
namespaceMetadataOnly:
description: |-
Include Kubernetes namespace metadata only and no pod metadata.
If this is set, the values of Labels and Annotations are ignored.
type: boolean
regexParser:
description: |-
Set an alternative Parser to process record Tag and extract pod_name, namespace_name, container_name and docker_id.
Expand Down
5 changes: 5 additions & 0 deletions docs/plugins/fluentbit/filter/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ Kubernetes filter allows to enrich your log files with Kubernetes metadata. <br
| kubeletHost | kubelet host using for HTTP request, this only works when Use_Kubelet set to On. | string |
| kubeMetaCacheTTL | configurable TTL for K8s cached metadata. By default, it is set to 0 which means TTL for cache entries is disabled and cache entries are evicted at random when capacity is reached. In order to enable this option, you should set the number to a time interval. For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted. | string |
| kubeTokenTTL | configurable 'time to live' for the K8s token. By default, it is set to 600 seconds. After this time, the token is reloaded from Kube_Token_File or the Kube_Token_Command. | string |
| kubeTokenCommand | Command to get Kubernetes authorization token. By default, it will be NULL and we will use token file to get token. | string |
| kubeMetaNamespaceCacheTTL | Configurable TTL for K8s cached namespace metadata. By default, it is set to 900 which means a 15min TTL for namespace cache entries. Setting this to 0 will mean entries are evicted at random once the cache is full. | *int32 |
| namespaceLabels | Include Kubernetes namespace resource labels in the extra metadata. | *bool |
| namespaceAnnotations | Include Kubernetes namespace resource annotations in the extra metadata. | *bool |
| namespaceMetadataOnly | Include Kubernetes namespace metadata only and no pod metadata. If this is set, the values of Labels and Annotations are ignored. | *bool |
Loading

0 comments on commit 9de7443

Please sign in to comment.