55 "time"
66
77 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+ "k8s.io/utils/ptr"
89 "sigs.k8s.io/controller-runtime/pkg/client"
910 gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
1011 "sigs.k8s.io/gateway-api/apis/v1alpha2"
@@ -22,7 +23,7 @@ func (r *HTTPRouteReconciler) processHTTPRoutePolicies(tctx *provider.TranslateC
2223 policies : make (map [targetRefKey ][]v1alpha1.HTTPRoutePolicy ),
2324 }
2425 listForAllRules v1alpha1.HTTPRoutePolicyList
25- key = indexer .GenHTTPRoutePolicyIndexKey (v1alpha1 . GroupVersion . Group , "HTTPRoute" , httpRoute .GetNamespace (), httpRoute .GetName (), "" )
26+ key = indexer .GenHTTPRoutePolicyIndexKey (gatewayv1 . GroupName , "HTTPRoute" , httpRoute .GetNamespace (), httpRoute .GetName (), "" )
2627 )
2728 if err := r .List (context .Background (), & listForAllRules , client.MatchingFields {indexer .PolicyTargetRefs : key }); err != nil {
2829 return err
@@ -41,7 +42,7 @@ func (r *HTTPRouteReconciler) processHTTPRoutePolicies(tctx *provider.TranslateC
4142 var (
4243 ruleName = string (* rule .Name )
4344 listForSectionRules v1alpha1.HTTPRoutePolicyList
44- key = indexer .GenHTTPRoutePolicyIndexKey (v1alpha1 . GroupVersion . Group , "HTTPRoute" , httpRoute .GetNamespace (), httpRoute .GetName (), ruleName )
45+ key = indexer .GenHTTPRoutePolicyIndexKey (gatewayv1 . GroupName , "HTTPRoute" , httpRoute .GetNamespace (), httpRoute .GetName (), ruleName )
4546 )
4647 if err := r .List (context .Background (), & listForSectionRules , client.MatchingFields {indexer .PolicyTargetRefs : key }); err != nil {
4748 continue
@@ -136,7 +137,7 @@ func (c *conflictChecker) append(sectionName string, policy v1alpha1.HTTPRoutePo
136137 Loop:
137138 for _ , items := range c .policies {
138139 for _ , item := range items {
139- if item . Spec . Priority != policy . Spec . Priority || * item .Spec .Priority != * policy .Spec .Priority {
140+ if ! ptr . Equal ( item .Spec .Priority , policy .Spec .Priority ) {
140141 c .conflict = true
141142 break Loop
142143 }
0 commit comments