@@ -751,6 +751,18 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
751
751
expectedErrors : nil ,
752
752
msg : "valid nginx.org/hsts-max-age annotation" ,
753
753
},
754
+ {
755
+ annotations : map [string ]string {
756
+ "nginx.org/hsts" : "false" ,
757
+ "nginx.org/hsts-max-age" : "120" ,
758
+ },
759
+ specServices : map [string ]bool {},
760
+ isPlus : false ,
761
+ appProtectEnabled : false ,
762
+ internalRoutesEnabled : false ,
763
+ expectedErrors : nil ,
764
+ msg : "valid nginx.org/hsts-max-age nginx.org/hsts can be false" ,
765
+ },
754
766
{
755
767
annotations : map [string ]string {
756
768
"nginx.org/hsts" : "true" ,
@@ -778,32 +790,30 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
778
790
},
779
791
msg : "invalid nginx.org/hsts-max-age, related annotation nginx.org/hsts not set" ,
780
792
},
793
+
781
794
{
782
795
annotations : map [string ]string {
783
- "nginx.org/hsts" : "false " ,
784
- "nginx.org/hsts-max-age " : "120 " ,
796
+ "nginx.org/hsts" : "true " ,
797
+ "nginx.org/hsts-include-subdomains " : "true " ,
785
798
},
786
799
specServices : map [string ]bool {},
787
800
isPlus : false ,
788
801
appProtectEnabled : false ,
789
802
internalRoutesEnabled : false ,
790
- expectedErrors : []string {
791
- "annotations.nginx.org/hsts-max-age: Forbidden: related annotation nginx.org/hsts: must be true" ,
792
- },
793
- msg : "invalid nginx.org/hsts-max-age nginx.org/hsts is not true" ,
803
+ expectedErrors : nil ,
804
+ msg : "valid nginx.org/hsts-include-subdomains annotation" ,
794
805
},
795
-
796
806
{
797
807
annotations : map [string ]string {
798
- "nginx.org/hsts" : "true " ,
808
+ "nginx.org/hsts" : "false " ,
799
809
"nginx.org/hsts-include-subdomains" : "true" ,
800
810
},
801
811
specServices : map [string ]bool {},
802
812
isPlus : false ,
803
813
appProtectEnabled : false ,
804
814
internalRoutesEnabled : false ,
805
815
expectedErrors : nil ,
806
- msg : "valid nginx.org/hsts-include-subdomains annotation " ,
816
+ msg : "valid nginx.org/hsts-include-subdomains, nginx.org/hsts can be false " ,
807
817
},
808
818
{
809
819
annotations : map [string ]string {
@@ -832,32 +842,30 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
832
842
},
833
843
msg : "invalid nginx.org/hsts-include-subdomains, related annotation nginx.org/hsts not set" ,
834
844
},
845
+
835
846
{
836
847
annotations : map [string ]string {
837
- "nginx.org/hsts" : "false " ,
838
- "nginx.org/hsts-include-subdomains " : "true" ,
848
+ "nginx.org/hsts" : "true " ,
849
+ "nginx.org/hsts-behind-proxy " : "true" ,
839
850
},
840
851
specServices : map [string ]bool {},
841
852
isPlus : false ,
842
853
appProtectEnabled : false ,
843
854
internalRoutesEnabled : false ,
844
- expectedErrors : []string {
845
- "annotations.nginx.org/hsts-include-subdomains: Forbidden: related annotation nginx.org/hsts: must be true" ,
846
- },
847
- msg : "invalid nginx.org/hsts-include-subdomains nginx.org/hsts is not true" ,
855
+ expectedErrors : nil ,
856
+ msg : "valid nginx.org/hsts-behind-proxy annotation" ,
848
857
},
849
-
850
858
{
851
859
annotations : map [string ]string {
852
- "nginx.org/hsts" : "true " ,
860
+ "nginx.org/hsts" : "false " ,
853
861
"nginx.org/hsts-behind-proxy" : "true" ,
854
862
},
855
863
specServices : map [string ]bool {},
856
864
isPlus : false ,
857
865
appProtectEnabled : false ,
858
866
internalRoutesEnabled : false ,
859
867
expectedErrors : nil ,
860
- msg : "valid nginx.org/hsts-behind-proxy annotation " ,
868
+ msg : "valid nginx.org/hsts-behind-proxy, nginx.org/hsts can be false " ,
861
869
},
862
870
{
863
871
annotations : map [string ]string {
@@ -886,20 +894,6 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
886
894
},
887
895
msg : "invalid nginx.org/hsts-behind-proxy, related annotation nginx.org/hsts not set" ,
888
896
},
889
- {
890
- annotations : map [string ]string {
891
- "nginx.org/hsts" : "false" ,
892
- "nginx.org/hsts-behind-proxy" : "true" ,
893
- },
894
- specServices : map [string ]bool {},
895
- isPlus : false ,
896
- appProtectEnabled : false ,
897
- internalRoutesEnabled : false ,
898
- expectedErrors : []string {
899
- "annotations.nginx.org/hsts-behind-proxy: Forbidden: related annotation nginx.org/hsts: must be true" ,
900
- },
901
- msg : "invalid nginx.org/hsts-behind-proxy nginx.org/hsts is not true" ,
902
- },
903
897
904
898
{
905
899
annotations : map [string ]string {
0 commit comments