Commit b1f2401
committed
fix: isHTTPRouteFilterReferencingSecret always returns true and cross-namespace index
Two bugs in the HTTPRouteFilter secret predicate path:
1. predicates.go: isHTTPRouteFilterReferencingSecret had 'return true' where
'return false' was intended when no HTTPRouteFilter references the given
Secret. This caused validateSecretForReconcile to always return true when
hrfCRDExists=true, triggering unnecessary reconciliations on every Secret
change.
2. indexers.go: secretRouteFilterIndexFunc indexed the Secret reference under
filter.Namespace instead of the Secret's actual namespace. When
ValueRef.Namespace points to a different namespace (allowed by the CRD
with a ReferenceGrant), the index key was wrong and cross-namespace
credential rotation would not trigger reconciliation. Fixed by using
gatewayapi.NamespaceDerefOr to resolve the correct namespace, matching
the pattern used by secretSecurityPolicyIndexFunc and
secretEnvoyExtensionPolicyIndexFunc.
Added unit tests covering:
- Secret not referenced by any HTTPRouteFilter (expect false)
- Secret referenced by HTTPRouteFilter CredentialInjection, same namespace (expect true)
- Secret in another namespace referenced via ValueRef.Namespace (expect true)1 parent 3619397 commit b1f2401
3 files changed
Lines changed: 59 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1154 | 1154 | | |
1155 | 1155 | | |
1156 | 1156 | | |
1157 | | - | |
| 1157 | + | |
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
868 | 923 | | |
869 | 924 | | |
870 | 925 | | |
| |||
877 | 932 | | |
878 | 933 | | |
879 | 934 | | |
| 935 | + | |
880 | 936 | | |
881 | 937 | | |
882 | 938 | | |
| |||
895 | 951 | | |
896 | 952 | | |
897 | 953 | | |
| 954 | + | |
898 | 955 | | |
899 | 956 | | |
900 | 957 | | |
| |||
0 commit comments