Skip to content

Commit e8f31a0

Browse files
damyancw-Guo
authored andcommitted
Fixes service IP address validation
Although `fluent-bit` supports IPv6, HTTP listening on an IPv6 address fails due to the address validation currently supporting IPv4 only. Improve the RegEx to support both IPv4 and IPv6 good enough™ Notes: - the IPv6 RegEx part matches also the unspecified address `::` - the IPv4 RegEx part was improved to match the dot delimiter `.` literally (it previously matched every character, due to missing escaping) Signed-off-by: Damyan Yordanov <[email protected]>
1 parent 07f5bc8 commit e8f31a0

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ type Service struct {
9797
// enable Health check feature at http://127.0.0.1:2020/api/v1/health Note: Enabling this will not automatically configure kubernetes to use fluentbit's healthcheck endpoint
9898
HealthCheck *bool `json:"healthCheck,omitempty"`
9999
// Address to listen
100-
// +kubebuilder:validation:Pattern:="^\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3}$"
100+
// +kubebuilder:validation:Pattern:="^(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$"
101101
HttpListen string `json:"httpListen,omitempty"`
102102
// Port to listen
103103
// +kubebuilder:validation:Minimum:=1

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfluentbitconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ spec:
345345
type: boolean
346346
httpListen:
347347
description: Address to listen
348-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
348+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
349349
type: string
350350
httpPort:
351351
description: Port to listen

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbitconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ spec:
377377
type: boolean
378378
httpListen:
379379
description: Address to listen
380-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
380+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
381381
type: string
382382
httpPort:
383383
description: Port to listen

config/crd/bases/fluentbit.fluent.io_clusterfluentbitconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ spec:
345345
type: boolean
346346
httpListen:
347347
description: Address to listen
348-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
348+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
349349
type: string
350350
httpPort:
351351
description: Port to listen

config/crd/bases/fluentbit.fluent.io_fluentbitconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ spec:
377377
type: boolean
378378
httpListen:
379379
description: Address to listen
380-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
380+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
381381
type: string
382382
httpPort:
383383
description: Port to listen

docs/best-practice/monitoring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Fluent Bit comes with a built-in HTTP Server. According to the official [documen
55
```conf
66
[SERVICE]
77
HTTP_Server On
8-
HTTP_Listen 0.0.0.0
8+
HTTP_Listen '::'
99
HTTP_PORT 2020
1010
```
1111

@@ -29,7 +29,7 @@ spec:
2929
matchLabels:
3030
fluentbit.fluent.io/enabled: 'true'
3131
service:
32-
httpListen: 0.0.0.0
32+
httpListen: '::'
3333
httpPort: 2020
3434
httpServer: true
3535
parsersFile: parsers.conf

manifests/setup/fluent-operator-crd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ spec:
18031803
type: boolean
18041804
httpListen:
18051805
description: Address to listen
1806-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
1806+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
18071807
type: string
18081808
httpPort:
18091809
description: Port to listen
@@ -16685,7 +16685,7 @@ spec:
1668516685
type: boolean
1668616686
httpListen:
1668716687
description: Address to listen
16688-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
16688+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
1668916689
type: string
1669016690
httpPort:
1669116691
description: Port to listen

manifests/setup/setup.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ spec:
18031803
type: boolean
18041804
httpListen:
18051805
description: Address to listen
1806-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
1806+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
18071807
type: string
18081808
httpPort:
18091809
description: Port to listen
@@ -16685,7 +16685,7 @@ spec:
1668516685
type: boolean
1668616686
httpListen:
1668716687
description: Address to listen
16688-
pattern: ^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$
16688+
pattern: ^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]*)$
1668916689
type: string
1669016690
httpPort:
1669116691
description: Port to listen

0 commit comments

Comments
 (0)