@@ -53,7 +53,7 @@ var _ = Describe("monitor_conf", func() {
53
53
})
54
54
55
55
When ("there is no connection string" , func () {
56
- It ("generates conf with an no processes" , func () {
56
+ It ("generates conf with no processes" , func () {
57
57
Expect (cluster ).NotTo (BeNil ())
58
58
cluster .Status .ConnectionString = ""
59
59
config := GetMonitorProcessConfiguration (
@@ -595,9 +595,125 @@ var _ = Describe("monitor_conf", func() {
595
595
})
596
596
})
597
597
598
+ When ("there are parameters in the general section that use the public IP" , func () {
599
+ BeforeEach (func () {
600
+ cluster .Spec .Processes = map [fdbv1beta2.ProcessClass ]fdbv1beta2.ProcessSettings {
601
+ fdbv1beta2 .ProcessClassGeneral : {
602
+ CustomParameters : fdbv1beta2.FoundationDBCustomParameters {
603
+ "locality_my_fancy_ip = $FDB_PUBLIC_IP" ,
604
+ },
605
+ },
606
+ }
607
+ })
608
+
609
+ It ("includes the custom parameters" , func () {
610
+ config := GetMonitorProcessConfiguration (
611
+ cluster ,
612
+ fdbv1beta2 .ProcessClassStorage ,
613
+ 1 ,
614
+ fdbv1beta2 .ImageTypeUnified ,
615
+ )
616
+ Expect (config .Arguments ).To (HaveLen (baseArgumentLength + 1 ))
617
+ Expect (config .Arguments [10 ]).To (Equal (monitorapi.Argument {
618
+ ArgumentType : monitorapi .ConcatenateArgumentType ,
619
+ Values : []monitorapi.Argument {
620
+ {
621
+ ArgumentType : monitorapi .LiteralArgumentType ,
622
+ Value : "--locality_my_fancy_ip=" ,
623
+ },
624
+ {
625
+ ArgumentType : monitorapi .EnvironmentArgumentType ,
626
+ Source : "FDB_PUBLIC_IP" ,
627
+ },
628
+ }}))
629
+ })
630
+
631
+ When ("using IPv6 as PodIPFamily" , func () {
632
+ BeforeEach (func () {
633
+ cluster .Spec .Routing .PodIPFamily = pointer .Int (fdbv1beta2 .PodIPFamilyIPv6 )
634
+ })
635
+
636
+ It ("specifies the IP family for the public address" , func () {
637
+ config := GetMonitorProcessConfiguration (
638
+ cluster ,
639
+ fdbv1beta2 .ProcessClassStorage ,
640
+ 1 ,
641
+ fdbv1beta2 .ImageTypeUnified ,
642
+ )
643
+ Expect (config .Arguments ).To (HaveLen (baseArgumentLength + 1 ))
644
+ Expect (config .Arguments [10 ]).To (Equal (monitorapi.Argument {
645
+ ArgumentType : monitorapi .ConcatenateArgumentType ,
646
+ Values : []monitorapi.Argument {
647
+ {
648
+ ArgumentType : monitorapi .LiteralArgumentType ,
649
+ Value : "--locality_my_fancy_ip=" ,
650
+ },
651
+ {
652
+ ArgumentType : monitorapi .IPListArgumentType ,
653
+ Source : "FDB_PUBLIC_IP" ,
654
+ IPFamily : fdbv1beta2 .PodIPFamilyIPv6 ,
655
+ },
656
+ }}))
657
+
658
+ commandLineArgs , err := config .GenerateArguments (1 ,
659
+ map [string ]string {
660
+ "FDB_PUBLIC_IP" : "2001:db8:dead:beef::1,192.168.0.2" ,
661
+ "FDB_INSTANCE_ID" : "test" ,
662
+ "FDB_MACHINE_ID" : "test" ,
663
+ "FDB_ZONE_ID" : "test" ,
664
+ "FDB_DNS_NAME" : "test" ,
665
+ })
666
+ Expect (err ).NotTo (HaveOccurred ())
667
+ Expect (
668
+ commandLineArgs [10 ],
669
+ ).To (Equal ("--locality_my_fancy_ip=2001:db8:dead:beef::1" ))
670
+ })
671
+ })
672
+
673
+ When ("using IPv4 as PodIPFamily" , func () {
674
+ BeforeEach (func () {
675
+ cluster .Spec .Routing .PodIPFamily = pointer .Int (fdbv1beta2 .PodIPFamilyIPv4 )
676
+ })
677
+
678
+ It ("specifies the IP family for the public address" , func () {
679
+ config := GetMonitorProcessConfiguration (
680
+ cluster ,
681
+ fdbv1beta2 .ProcessClassStorage ,
682
+ 1 ,
683
+ fdbv1beta2 .ImageTypeUnified ,
684
+ )
685
+ Expect (config .Arguments ).To (HaveLen (baseArgumentLength + 1 ))
686
+ Expect (config .Arguments [10 ]).To (Equal (monitorapi.Argument {
687
+ ArgumentType : monitorapi .ConcatenateArgumentType ,
688
+ Values : []monitorapi.Argument {
689
+ {
690
+ ArgumentType : monitorapi .LiteralArgumentType ,
691
+ Value : "--locality_my_fancy_ip=" ,
692
+ },
693
+ {
694
+ ArgumentType : monitorapi .IPListArgumentType ,
695
+ Source : "FDB_PUBLIC_IP" ,
696
+ IPFamily : fdbv1beta2 .PodIPFamilyIPv4 ,
697
+ },
698
+ }}))
699
+
700
+ commandLineArgs , err := config .GenerateArguments (1 ,
701
+ map [string ]string {
702
+ "FDB_PUBLIC_IP" : "2001:db8:dead:beef::1,192.168.0.2" ,
703
+ "FDB_INSTANCE_ID" : "test" ,
704
+ "FDB_MACHINE_ID" : "test" ,
705
+ "FDB_ZONE_ID" : "test" ,
706
+ "FDB_DNS_NAME" : "test" ,
707
+ })
708
+ Expect (err ).NotTo (HaveOccurred ())
709
+ Expect (commandLineArgs [10 ]).To (Equal ("--locality_my_fancy_ip=192.168.0.2" ))
710
+ })
711
+ })
712
+ })
713
+
598
714
When ("using IPv6 as PodIPFamily" , func () {
599
715
BeforeEach (func () {
600
- cluster .Spec .Routing .PodIPFamily = pointer .Int (6 )
716
+ cluster .Spec .Routing .PodIPFamily = pointer .Int (fdbv1beta2 . PodIPFamilyIPv6 )
601
717
})
602
718
603
719
It ("specifies the IP family for the public address" , func () {
@@ -629,7 +745,7 @@ var _ = Describe("monitor_conf", func() {
629
745
630
746
When ("using IPv4 as PodIPFamily" , func () {
631
747
BeforeEach (func () {
632
- cluster .Spec .Routing .PodIPFamily = pointer .Int (4 )
748
+ cluster .Spec .Routing .PodIPFamily = pointer .Int (fdbv1beta2 . PodIPFamilyIPv4 )
633
749
})
634
750
635
751
It ("specifies the IP family for the public address" , func () {
0 commit comments