@@ -386,10 +386,10 @@ pipeline:
386386 cfg = ClusterFluentBitConfig {
387387 Spec : FluentBitConfigSpec {
388388 Service : & Service {
389- Daemon : ptr (false ),
390- FlushSeconds : ptr [ float64 ] (1 ),
391- GraceSeconds : ptr [ int64 ] (30 ),
392- HttpServer : ptr (true ),
389+ Daemon : ptrBool (false ),
390+ FlushSeconds : ptrFloat64 (1 ),
391+ GraceSeconds : ptrInt64 (30 ),
392+ HttpServer : ptrBool (true ),
393393 LogLevel : "info" ,
394394 ParsersFile : "parsers.conf" ,
395395 },
@@ -402,7 +402,7 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
402402
403403 sl := plugins .NewSecretLoader (nil , "testnamespace" )
404404
405- disableInotifyWatcher := ptr (true )
405+ disableInotifyWatcher := ptrBool (true )
406406
407407 inputObj := & ClusterInput {
408408 TypeMeta : metav1.TypeMeta {
@@ -420,10 +420,10 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
420420 Tag : "logs.foo.bar" ,
421421 Path : "/logs/containers/apps0" ,
422422 ExcludePath : "/logs/containers/exclude_path" ,
423- SkipLongLines : ptr (true ),
423+ SkipLongLines : ptrBool (true ),
424424 IgnoreOlder : "5m" ,
425425 MemBufLimit : "5MB" ,
426- RefreshIntervalSeconds : ptr [ int64 ] (10 ),
426+ RefreshIntervalSeconds : ptrInt64 (10 ),
427427 DB : "/fluent-bit/tail/pos.db" ,
428428 },
429429 },
@@ -507,10 +507,10 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
507507 Match : "logs.foo.bar" ,
508508 Syslog : & output.Syslog {
509509 Host : "example.com" ,
510- Port : ptr [ int32 ] (3300 ),
510+ Port : ptrInt32 ( int32 (3300 ) ),
511511 Mode : "tls" ,
512512 TLS : & plugins.TLS {
513- Verify : ptr (true ),
513+ Verify : ptrBool (true ),
514514 },
515515 SyslogMessageKey : "log" ,
516516 SyslogHostnameKey : "do_app_name" ,
@@ -540,14 +540,14 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
540540 Match : "logs.foo.bar" ,
541541 HTTP : & output.HTTP {
542542 Host : "https://example2.com" ,
543- Port : ptr [ int32 ] (433 ),
543+ Port : ptrInt32 ( int32 (433 ) ),
544544 Uri : "/logs" ,
545545 Headers : headers ,
546546 Format : "json_lines" ,
547547 JsonDateKey : "timestamp" ,
548548 JsonDateFormat : "iso8601" ,
549549 TLS : & plugins.TLS {
550- Verify : ptr (true ),
550+ Verify : ptrBool (true ),
551551 },
552552 },
553553 },
@@ -567,7 +567,7 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
567567 Match : "*" ,
568568 OpenSearch : & output.OpenSearch {
569569 Host : "https://example2.com" ,
570- Port : ptr [ int32 ] (9200 ),
570+ Port : ptrInt32 ( int32 (9200 ) ),
571571 Index : "my_index" ,
572572 Type : "my_type" ,
573573 },
@@ -588,7 +588,7 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
588588 Match : "*" ,
589589 Elasticsearch : & output.Elasticsearch {
590590 Host : "https://example2.com" ,
591- Port : ptr [ int32 ] (9200 ),
591+ Port : ptrInt32 ( int32 (9200 ) ),
592592 Index : "my_index" ,
593593 Type : "my_type" ,
594594 WriteOperation : "upsert" ,
@@ -629,12 +629,13 @@ func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
629629 i ++
630630 }
631631}
632+
632633func Test_FluentBitConfig_RenderMainConfigYaml (t * testing.T ) {
633634 g := NewGomegaWithT (t )
634635
635636 sl := plugins .NewSecretLoader (nil , "testnamespace" )
636637
637- disableInotifyWatcher := ptr (true )
638+ disableInotifyWatcher := ptrBool (true )
638639
639640 inputObj := & ClusterInput {
640641 TypeMeta : metav1.TypeMeta {
@@ -652,10 +653,10 @@ func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) {
652653 Tag : "logs.foo.bar" ,
653654 Path : "/logs/containers/apps0" ,
654655 ExcludePath : "/logs/containers/exclude_path" ,
655- SkipLongLines : ptr (true ),
656+ SkipLongLines : ptrBool (true ),
656657 IgnoreOlder : "5m" ,
657658 MemBufLimit : "5MB" ,
658- RefreshIntervalSeconds : ptr [ int64 ] (10 ),
659+ RefreshIntervalSeconds : ptrInt64 (10 ),
659660 DB : "/fluent-bit/tail/pos.db" ,
660661 },
661662 },
@@ -739,10 +740,10 @@ func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) {
739740 Match : "logs.foo.bar" ,
740741 Syslog : & output.Syslog {
741742 Host : "example.com" ,
742- Port : ptr [ int32 ] (3300 ),
743+ Port : ptrInt32 ( int32 (3300 ) ),
743744 Mode : "tls" ,
744745 TLS : & plugins.TLS {
745- Verify : ptr (true ),
746+ Verify : ptrBool (true ),
746747 },
747748 SyslogMessageKey : "log" ,
748749 SyslogHostnameKey : "do_app_name" ,
@@ -772,14 +773,14 @@ func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) {
772773 Match : "logs.foo.bar" ,
773774 HTTP : & output.HTTP {
774775 Host : "https://example2.com" ,
775- Port : ptr [ int32 ] (433 ),
776+ Port : ptrInt32 ( int32 (433 ) ),
776777 Uri : "/logs" ,
777778 Headers : headers ,
778779 Format : "json_lines" ,
779780 JsonDateKey : "timestamp" ,
780781 JsonDateFormat : "iso8601" ,
781782 TLS : & plugins.TLS {
782- Verify : ptr (true ),
783+ Verify : ptrBool (true ),
783784 },
784785 },
785786 },
@@ -799,7 +800,7 @@ func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) {
799800 Match : "*" ,
800801 OpenSearch : & output.OpenSearch {
801802 Host : "https://example2.com" ,
802- Port : ptr [ int32 ] (9200 ),
803+ Port : ptrInt32 ( int32 (9200 ) ),
803804 Index : "my_index" ,
804805 Type : "my_type" ,
805806 },
@@ -820,7 +821,7 @@ func Test_FluentBitConfig_RenderMainConfigYaml(t *testing.T) {
820821 Match : "*" ,
821822 Elasticsearch : & output.Elasticsearch {
822823 Host : "https://example2.com" ,
823- Port : ptr [ int32 ] (9200 ),
824+ Port : ptrInt32 ( int32 (9200 ) ),
824825 Index : "my_index" ,
825826 Type : "my_type" ,
826827 WriteOperation : "upsert" ,
@@ -908,10 +909,10 @@ func TestRenderMainConfigK8s(t *testing.T) {
908909 Tail : & input.Tail {
909910 Tag : "kube.*" ,
910911 Path : "/var/log/containers/*.log" ,
911- SkipLongLines : ptr (true ),
912+ SkipLongLines : ptrBool (true ),
912913 IgnoreOlder : "5m" ,
913914 MemBufLimit : "5MB" ,
914- RefreshIntervalSeconds : ptr [ int64 ] (10 ),
915+ RefreshIntervalSeconds : ptrInt64 (10 ),
915916 DB : "/fluent-bit/tail/pos.db" ,
916917 },
917918 },
@@ -942,7 +943,7 @@ func TestRenderMainConfigK8s(t *testing.T) {
942943 Parser : & filter.Parser {
943944 KeyName : "log" ,
944945 Parser : "bar" ,
945- ReserveData : ptr (true ),
946+ ReserveData : ptrBool (true ),
946947 },
947948 },
948949 },
@@ -967,7 +968,7 @@ func TestRenderMainConfigK8s(t *testing.T) {
967968 Match : "kube.*" ,
968969 OpenSearch : & output.OpenSearch {
969970 Host : "foo.bar" ,
970- Port : ptr [ int32 ] (9200 ),
971+ Port : ptrInt32 (9200 ),
971972 Index : "foo-index" ,
972973 },
973974 },
@@ -987,7 +988,7 @@ func TestRenderMainConfigK8s(t *testing.T) {
987988 Match : "kube.*" ,
988989 Elasticsearch : & output.Elasticsearch {
989990 Host : "foo.bar" ,
990- Port : ptr [ int32 ] (9200 ),
991+ Port : ptrInt32 (9200 ),
991992 Index : "foo-index" ,
992993 WriteOperation : "update" ,
993994 },
@@ -1031,10 +1032,10 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
10311032 Tail : & input.Tail {
10321033 Tag : "kube.*" ,
10331034 Path : "/var/log/containers/*.log" ,
1034- SkipLongLines : ptr (true ),
1035+ SkipLongLines : ptrBool (true ),
10351036 IgnoreOlder : "5m" ,
10361037 MemBufLimit : "5MB" ,
1037- RefreshIntervalSeconds : ptr [ int64 ] (10 ),
1038+ RefreshIntervalSeconds : ptrInt64 (10 ),
10381039 DB : "/fluent-bit/tail/pos.db" ,
10391040 },
10401041 },
@@ -1059,7 +1060,7 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
10591060 {Parser : & filter.Parser {
10601061 KeyName : "log" ,
10611062 Parser : "test" ,
1062- ReserveData : ptr (true ),
1063+ ReserveData : ptrBool (true ),
10631064 }},
10641065 },
10651066 },
@@ -1081,7 +1082,7 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
10811082 Match : "kube.*" ,
10821083 Elasticsearch : & output.Elasticsearch {
10831084 Host : "foo.bar" ,
1084- Port : ptr [ int32 ] (9200 ),
1085+ Port : ptrInt32 (9200 ),
10851086 Index : "foo-index" ,
10861087 },
10871088 },
@@ -1105,7 +1106,7 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
11051106 Parser : & filter.Parser {
11061107 KeyName : "log" ,
11071108 Parser : "bar" ,
1108- ReserveData : ptr (true ),
1109+ ReserveData : ptrBool (true ),
11091110 },
11101111 },
11111112 },
@@ -1130,7 +1131,7 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
11301131 Match : "kube.*" ,
11311132 OpenSearch : & output.OpenSearch {
11321133 Host : "foo.bar" ,
1133- Port : ptr [ int32 ] (9200 ),
1134+ Port : ptrInt32 (9200 ),
11341135 Index : "foo-index" ,
11351136 },
11361137 },
@@ -1150,7 +1151,7 @@ func TestRenderMainConfigK8sInYaml(t *testing.T) {
11501151 Match : "kube.*" ,
11511152 Elasticsearch : & output.Elasticsearch {
11521153 Host : "foo.bar" ,
1153- Port : ptr [ int32 ] (9200 ),
1154+ Port : ptrInt32 (9200 ),
11541155 Index : "foo-index" ,
11551156 WriteOperation : "update" ,
11561157 },
@@ -1178,10 +1179,10 @@ func TestClusterFluentBitConfig_RenderMainConfig_WithParsersFiles(t *testing.T)
11781179 cfbc := ClusterFluentBitConfig {
11791180 Spec : FluentBitConfigSpec {
11801181 Service : & Service {
1181- Daemon : ptr (false ),
1182- FlushSeconds : ptr [ float64 ] (1 ),
1183- GraceSeconds : ptr [ int64 ] (30 ),
1184- HttpServer : ptr (true ),
1182+ Daemon : ptrBool (false ),
1183+ FlushSeconds : ptrFloat64 (1 ),
1184+ GraceSeconds : ptrInt64 (30 ),
1185+ HttpServer : ptrBool (true ),
11851186 LogLevel : "info" ,
11861187 ParsersFiles : []string {"parsers.conf" , "parsers_multiline.conf" },
11871188 },
@@ -1371,3 +1372,19 @@ func TestClusterFluentBitConfig_RenderMultilineParserConfig(t *testing.T) {
13711372 g .Expect (err ).NotTo (HaveOccurred ())
13721373 g .Expect (config ).To (Equal (expectedMultilineParsers ))
13731374}
1375+
1376+ func ptrBool (v bool ) * bool {
1377+ return & v
1378+ }
1379+
1380+ func ptrInt64 (v int64 ) * int64 {
1381+ return & v
1382+ }
1383+
1384+ func ptrInt32 (v int32 ) * int32 {
1385+ return & v
1386+ }
1387+
1388+ func ptrFloat64 (v float64 ) * float64 {
1389+ return & v
1390+ }
0 commit comments