@@ -659,9 +659,7 @@ func TestWarnings(t *testing.T) {
659
659
},
660
660
}},
661
661
}},
662
- expected : []string {
663
- `spec.containers[0].ports[1]: duplicate container port 80/TCP, conflicts with spec.containers[0]` ,
664
- },
662
+ expected : []string {},
665
663
},
666
664
{
667
665
name : "one container, two ports, same protocol, port and hostPort, different hostIP" ,
@@ -725,9 +723,7 @@ func TestWarnings(t *testing.T) {
725
723
},
726
724
}},
727
725
}},
728
- expected : []string {
729
- `spec.containers[1].ports[0]: duplicate container port 80/TCP, conflicts with spec.containers[0]` ,
730
- },
726
+ expected : []string {},
731
727
},
732
728
{
733
729
name : "two containers, one port each, same protocol, port and hostPort, different hostIP" ,
@@ -758,7 +754,7 @@ func TestWarnings(t *testing.T) {
758
754
}},
759
755
}},
760
756
expected : []string {
761
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
757
+ `spec.containers[0].ports[1]: duplicate port definition with spec.containers[0].ports [0]` ,
762
758
},
763
759
},
764
760
{
@@ -773,7 +769,7 @@ func TestWarnings(t *testing.T) {
773
769
}},
774
770
}},
775
771
expected : []string {
776
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
772
+ `spec.containers[0].ports[1]: duplicate port definition with spec.containers[0].ports [0]` ,
777
773
},
778
774
},
779
775
{
@@ -788,7 +784,21 @@ func TestWarnings(t *testing.T) {
788
784
}},
789
785
}},
790
786
expected : []string {
791
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
787
+ `spec.containers[0].ports[1]: duplicate port definition with spec.containers[0].ports[0]` ,
788
+ },
789
+ },
790
+ {
791
+ name : "one container port hostIP set without host port set" ,
792
+ template : & api.PodTemplateSpec {Spec : api.PodSpec {
793
+ Containers : []api.Container {{
794
+ Name : "foo" ,
795
+ Ports : []api.ContainerPort {
796
+ {ContainerPort : 80 , Protocol : api .ProtocolUDP , HostIP : "10.0.0.1" },
797
+ },
798
+ }},
799
+ }},
800
+ expected : []string {
801
+ `spec.containers[0].ports[0]: hostIP set without hostPort: {Name: HostPort:0 ContainerPort:80 Protocol:UDP HostIP:10.0.0.1}` ,
792
802
},
793
803
},
794
804
{
@@ -803,22 +813,25 @@ func TestWarnings(t *testing.T) {
803
813
}},
804
814
}},
805
815
expected : []string {
806
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
816
+ `spec.containers[0].ports[1]: overlapping port definition with spec.containers[0].ports[0]` ,
817
+ `spec.containers[0].ports[1]: hostIP set without hostPort: {Name: HostPort:0 ContainerPort:80 Protocol:UDP HostIP:10.0.0.1}` ,
807
818
},
808
819
},
809
820
{
810
- name : "duplicate container ports without one host IP set and one with" ,
821
+ name : "duplicate container ports without one host IP set and two with" ,
811
822
template : & api.PodTemplateSpec {Spec : api.PodSpec {
812
823
Containers : []api.Container {{
813
824
Name : "foo" ,
814
825
Ports : []api.ContainerPort {
815
- {ContainerPort : 80 , HostPort : 80 , Protocol : api .ProtocolUDP },
816
826
{ContainerPort : 80 , HostPort : 80 , Protocol : api .ProtocolUDP , HostIP : "10.0.0.1" },
827
+ {ContainerPort : 80 , HostPort : 80 , Protocol : api .ProtocolUDP },
828
+ {ContainerPort : 80 , HostPort : 80 , Protocol : api .ProtocolUDP , HostIP : "10.0.0.2" },
817
829
},
818
830
}},
819
831
}},
820
832
expected : []string {
821
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
833
+ `spec.containers[0].ports[1]: dangerously ambiguous port definition with spec.containers[0].ports[0]` ,
834
+ `spec.containers[0].ports[2]: dangerously ambiguous port definition with spec.containers[0].ports[1]` ,
822
835
},
823
836
},
824
837
{
@@ -833,7 +846,7 @@ func TestWarnings(t *testing.T) {
833
846
}},
834
847
}},
835
848
expected : []string {
836
- `spec.containers[0].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
849
+ `spec.containers[0].ports[1]: dangerously ambiguous port definition with spec.containers[0].ports [0]` ,
837
850
},
838
851
},
839
852
{
@@ -852,7 +865,7 @@ func TestWarnings(t *testing.T) {
852
865
}},
853
866
}},
854
867
expected : []string {
855
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
868
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports [0]` ,
856
869
},
857
870
},
858
871
{
@@ -871,7 +884,7 @@ func TestWarnings(t *testing.T) {
871
884
}},
872
885
}},
873
886
expected : []string {
874
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
887
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports [0]` ,
875
888
},
876
889
},
877
890
{
@@ -890,7 +903,7 @@ func TestWarnings(t *testing.T) {
890
903
}},
891
904
}},
892
905
expected : []string {
893
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
906
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports [0]` ,
894
907
},
895
908
},
896
909
{
@@ -909,7 +922,8 @@ func TestWarnings(t *testing.T) {
909
922
}},
910
923
}},
911
924
expected : []string {
912
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
925
+ `spec.containers[1].ports[0]: overlapping port definition with spec.containers[0].ports[0]` ,
926
+ `spec.containers[1].ports[0]: hostIP set without hostPort: {Name: HostPort:0 ContainerPort:80 Protocol:UDP HostIP:10.0.0.1}` ,
913
927
},
914
928
},
915
929
{
@@ -928,7 +942,7 @@ func TestWarnings(t *testing.T) {
928
942
}},
929
943
}},
930
944
expected : []string {
931
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
945
+ `spec.containers[1].ports[0]: dangerously ambiguous port definition with spec.containers[0].ports [0]` ,
932
946
},
933
947
},
934
948
{
@@ -947,7 +961,7 @@ func TestWarnings(t *testing.T) {
947
961
}},
948
962
}},
949
963
expected : []string {
950
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
964
+ `spec.containers[1].ports[0]: dangerously ambiguous port definition with spec.containers[0].ports [0]` ,
951
965
},
952
966
},
953
967
{
@@ -971,9 +985,12 @@ func TestWarnings(t *testing.T) {
971
985
}},
972
986
}},
973
987
expected : []string {
974
- `spec.containers[0].ports[2]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
975
- `spec.containers[1].ports[0]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
976
- `spec.containers[1].ports[1]: duplicate container port 80/UDP, conflicts with spec.containers[0]` ,
988
+ `spec.containers[0].ports[2]: duplicate port definition with spec.containers[0].ports[0]` ,
989
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports[0]` ,
990
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports[2]` ,
991
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[0].ports[0]` ,
992
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[0].ports[2]` ,
993
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[1].ports[0]` ,
977
994
},
978
995
},
979
996
{
@@ -1015,9 +1032,12 @@ func TestWarnings(t *testing.T) {
1015
1032
}},
1016
1033
}},
1017
1034
expected : []string {
1018
- `spec.containers[0].ports[2]: duplicate container port 80/TCP, conflicts with spec.containers[0]` ,
1019
- `spec.containers[1].ports[0]: duplicate container port 80/TCP, conflicts with spec.containers[0]` ,
1020
- `spec.containers[1].ports[1]: duplicate container port 80/TCP, conflicts with spec.containers[0]` ,
1035
+ `spec.containers[0].ports[2]: duplicate port definition with spec.containers[0].ports[0]` ,
1036
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports[0]` ,
1037
+ `spec.containers[1].ports[0]: duplicate port definition with spec.containers[0].ports[2]` ,
1038
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[0].ports[0]` ,
1039
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[0].ports[2]` ,
1040
+ `spec.containers[1].ports[1]: duplicate port definition with spec.containers[1].ports[0]` ,
1021
1041
},
1022
1042
},
1023
1043
}
0 commit comments