@@ -140,11 +140,11 @@ func (r *ApisixRouteReconciler) Reconcile(ctx context.Context, req ctrl.Request)
140140 return ctrl.Result {}, nil
141141}
142142
143- func (r * ApisixRouteReconciler ) processApisixRoute (ctx context.Context , tc * provider.TranslateContext , ar * apiv2.ApisixRoute ) error {
143+ func (r * ApisixRouteReconciler ) processApisixRoute (ctx context.Context , tc * provider.TranslateContext , in * apiv2.ApisixRoute ) error {
144144 var (
145145 rules = make (map [string ]struct {})
146146 )
147- for httpIndex , http := range ar .Spec .HTTP {
147+ for httpIndex , http := range in .Spec .HTTP {
148148 // check rule names
149149 if _ , ok := rules [http .Name ]; ok {
150150 return ReasonError {
@@ -156,13 +156,13 @@ func (r *ApisixRouteReconciler) processApisixRoute(ctx context.Context, tc *prov
156156
157157 // check plugin config reference
158158 if http .PluginConfigName != "" {
159- if err := r .validatePluginConfig (ctx , tc , ar , http ); err != nil {
159+ if err := r .validatePluginConfig (ctx , tc , in , http ); err != nil {
160160 return err
161161 }
162162 }
163163
164164 // check secret
165- if err := r .validateSecrets (ctx , tc , ar , http ); err != nil {
165+ if err := r .validateSecrets (ctx , tc , in , http ); err != nil {
166166 return err
167167 }
168168
@@ -183,20 +183,20 @@ func (r *ApisixRouteReconciler) processApisixRoute(ctx context.Context, tc *prov
183183 }
184184
185185 // process backend
186- if err := r .validateBackends (ctx , tc , ar , http ); err != nil {
186+ if err := r .validateBackends (ctx , tc , in , http ); err != nil {
187187 return err
188188 }
189189 // process upstreams
190- if err := r .validateUpstreams (ctx , tc , ar , http ); err != nil {
190+ if err := r .validateUpstreams (ctx , tc , in , http ); err != nil {
191191 return err
192192 }
193193 }
194194
195195 return nil
196196}
197197
198- func (r * ApisixRouteReconciler ) validatePluginConfig (ctx context.Context , tc * provider.TranslateContext , ar * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
199- pcNamespace := ar .Namespace
198+ func (r * ApisixRouteReconciler ) validatePluginConfig (ctx context.Context , tc * provider.TranslateContext , in * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
199+ pcNamespace := in .Namespace
200200 if http .PluginConfigNamespace != "" {
201201 pcNamespace = http .PluginConfigNamespace
202202 }
@@ -217,7 +217,7 @@ func (r *ApisixRouteReconciler) validatePluginConfig(ctx context.Context, tc *pr
217217 }
218218
219219 // Check if ApisixPluginConfig has IngressClassName and if it matches
220- if ar .Spec .IngressClassName != pc .Spec .IngressClassName && pc .Spec .IngressClassName != "" {
220+ if in .Spec .IngressClassName != pc .Spec .IngressClassName && pc .Spec .IngressClassName != "" {
221221 var pcIC networkingv1.IngressClass
222222 if err := r .Get (ctx , client.ObjectKey {Name : pc .Spec .IngressClassName }, & pcIC ); err != nil {
223223 return ReasonError {
@@ -260,7 +260,7 @@ func (r *ApisixRouteReconciler) validatePluginConfig(ctx context.Context, tc *pr
260260 return nil
261261}
262262
263- func (r * ApisixRouteReconciler ) validateSecrets (ctx context.Context , tc * provider.TranslateContext , ar * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
263+ func (r * ApisixRouteReconciler ) validateSecrets (ctx context.Context , tc * provider.TranslateContext , in * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
264264 for _ , plugin := range http .Plugins {
265265 if ! plugin .Enable || plugin .Config == nil || plugin .SecretRef == "" {
266266 continue
@@ -269,7 +269,7 @@ func (r *ApisixRouteReconciler) validateSecrets(ctx context.Context, tc *provide
269269 secret = corev1.Secret {
270270 ObjectMeta : metav1.ObjectMeta {
271271 Name : plugin .SecretRef ,
272- Namespace : ar .Namespace ,
272+ Namespace : in .Namespace ,
273273 },
274274 }
275275 secretNN = utils .NamespacedName (& secret )
@@ -286,14 +286,14 @@ func (r *ApisixRouteReconciler) validateSecrets(ctx context.Context, tc *provide
286286 return nil
287287}
288288
289- func (r * ApisixRouteReconciler ) validateBackends (ctx context.Context , tc * provider.TranslateContext , ar * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
289+ func (r * ApisixRouteReconciler ) validateBackends (ctx context.Context , tc * provider.TranslateContext , in * apiv2.ApisixRoute , http apiv2.ApisixRouteHTTP ) error {
290290 var backends = make (map [types.NamespacedName ]struct {})
291291 for _ , backend := range http .Backends {
292292 var (
293293 service = corev1.Service {
294294 ObjectMeta : metav1.ObjectMeta {
295295 Name : backend .ServiceName ,
296- Namespace : ar .Namespace ,
296+ Namespace : in .Namespace ,
297297 },
298298 }
299299 serviceNN = utils .NamespacedName (& service )
0 commit comments