ikatlinsky opened a new issue, #1577:
URL: https://github.com/apache/apisix-ingress-controller/issues/1577

   ### Issue description
   
   I am using the ingress controller to create the following apisix resources:
   - Plugin configs
   - Upstream
   - Route
   
   The following definitions are used:
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixUpstream
   metadata:
     name: httpbin-upstream
     namespace: acl
   spec:
     externalNodes:
     - type: Domain
       name: httpbin.org
     retries: 3
     timeout:
       connect: "3s"
       send: "2s"
       read: "3s"
     loadbalancer:
       type: roundrobin
     healthCheck:
       active:
         concurrency: 10
         host: httpbin.org
         type: http
         timeout: 2
         httpPath: /
         healthy:
           httpCodes:
             - 200
             - 302
           interval: "1s"
           successes: 3
         unhealthy:
           httpCodes:
             - 429
             - 404
             - 500
             - 501
             - 502
             - 503
             - 504
             - 505
           httpFailures: 5
           interval: "3s"
           tcpFailures: 2
           timeouts: 3
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixPluginConfig
   metadata:
     name: httpbin-plugins
     namespace: acl
   spec:
     plugins:
     - name: proxy-rewrite
       enable: true
       config:
         regex_uri:
         - "^/httpbin/(.*)"
         - "/$1"
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: httpbin-route
     namespace: acl
   spec:
     http:
       - name: httpbin-route-rule
         match:
           hosts:
             - apisix.local.net
           paths:
             - /httpbin/*
           methods:
             - GET
         upstreams:
           - name: httpbin-upstream
         plugin_config_name: httpbin-plugins
   ```
   
   As result my configuration is applied to the apisix, but plugin config is 
not assigned to the route. 
   My assumption that issue is because of the bug in the following file: 
apisix_route.go, more precisely the following fragment
   
   ```go
   if part.PluginConfigName != "" {
                                route.PluginConfigId = 
id.GenID(apisixv1.ComposePluginConfigName(ar.Namespace, part.PluginConfigName))
                        }
   ```
   
   is only executed when `len(backends) > 0` (function translateHTTPRouteV2).
   
   I guess it should be applied both for case with backends and case with 
upstream, like mine.
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long): 1.6.0
   - your Kubernetes cluster version (output of kubectl version): 1.23.6
   
   
   ### Minimal test code / Steps to reproduce
   
   1. Apply the definitions which are provided above
   2. Wait till definitions will be applied
   3. Check resulted configuration of the route
   
   ### Actual result
   
   ```json
   {
     "uris": [
       "/httpbin/*"
     ],
     "name": "acl_httpbin-route_httpbin-route-rule",
     "desc": "Created by apisix-ingress-controller, DO NOT modify it manually",
     "methods": [
       "GET"
     ],
     "hosts": [
       "apisix.local.net"
     ],
     "upstream_id": "6f1d84e5",
     "labels": {
       "managed-by": "apisix-ingress-controller"
     },
     "status": 1
   }
   ```
   
   plugin_config_id is missed from the configuration
   
   ### Error log
   
   no error log, just incorrect behaviour
   
   ### Expected result
   
   plugin_config_id is properly assigned to the route


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to