unreal-altran opened a new issue, #9331:
URL: https://github.com/apache/apisix/issues/9331

   ### Current Behavior
   
   I followed this official apisix 
[tutorial](https://apisix.apache.org/docs/ingress-controller/tutorials/external-service-discovery/)
 but with Consul discovery type. Everything works correctly if configured via 
ApiSix API but the reference to the plugin is lost if configured via CRD ( 
apisix ingress controller).
   
   
   I have tried different configurations with CRD. The following doesn't work. 
plugin_config_id field is missing from the configuration applied by the CRDs 
(example --> "plugin_config_id": "246f7509")
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixPluginConfig
   metadata:
     name: json-server-plugins
   spec:
     plugins:
       - name: openid-connect
         enable: true
         config:
           client_id: "json-server"
           client_secret: "yyyy"
           discovery: "xxxx"
           scope: "openid profile roles address phone"
           bearer_only: true
           realm: "zzzz"
           redirect_uri: "/*"
           logout_path: "/logout"
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixUpstream
   metadata:
     name: json-server-upstream
   spec:
     discovery:
       type: consul
       serviceName: json-server
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: json-server-route
   spec:
     http:
       - name: json-server
         match:
           hosts:
             - json-server.apisix.apps.lab.com
           paths:
             - /*
         plugin_config_name: json-server-plugins
         upstreams:
           - name: json-server-upstream
   ```        
   
   But this configuration works very well (the same but with plugin definition 
embedded directly to the route)
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixUpstream
   metadata:
     name: json-server-upstream
   spec:
     discovery:
       type: consul
       serviceName: json-server
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: json-server-route
   spec:
     http:
       - name: json-server
         match:
           hosts:
             - json-server.apisix.apps.lab.com
           paths:
             - /*
         upstreams:
           - name: json-server-upstream
         plugins:
           - name: openid-connect
             enable: true
             config:
               client_id: "json-server"
               client_secret: "yyyy"
               discovery: "xxxx"
               scope: "openid profile roles address phone"
               bearer_only: true
               realm: "zzzz"
               redirect_uri: "/*"
               logout_path: "/logout"
   ``` 
   
   **I also tried the first example (which doesn't work) and then I manually 
changed the configuration by adding "plugin_config_id": "246f7509" and 
everything worked perfectly.**
   
   
   ### Expected Behavior
   
   A route with references to plugin and upstream as required by the CRD 
configurations
   Example:
   
   ``` json
   {
     "uris": [
       "/*"
     ],
     "name": "consul_json-server-route_json-server",
     "desc": "Created by apisix-ingress-controller, DO NOT modify it manually",
     "hosts": [
       "json-server.apisix.apps.lab.com"
     ],
     **"plugin_config_id": "246f7509",**
     **"upstream_id": "72c79c84",**
     "labels": {
       "managed-by": "apisix-ingress-controller"
     },
     "status": 1
   }
   ``` 
   
   But I get this result
   
   ``` json
   {
     "uris": [
       "/*"
     ],
     "name": "consul_json-server-route_json-server",
     "desc": "Created by apisix-ingress-controller, DO NOT modify it manually",
     "hosts": [
       "json-server.apisix.apps.lab.com"
     ],
     **"upstream_id": "72c79c84",**
     "labels": {
       "managed-by": "apisix-ingress-controller"
     },
     "status": 1
   }
   ``` 
   
   ### Error Logs
   
   Nothing relevant
   
   ### Steps to Reproduce
   
   Followed this official apisix 
[tutorial](https://apisix.apache.org/docs/ingress-controller/tutorials/external-service-discovery/)
 but with Consul discovery type.
   
   ### Environment
   
   - APISIX 3.2 & APISIX INGRESS 1.6.1
   - kubernetes
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to