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

   ### Issue description
   
   I configured an ingress according to the [annotation 
guide](https://apisix.apache.org/zh/docs/ingress-controller/concepts/annotations/#use-apisixpluginconfig)
 on an ACK kubernetes. But It's not working at all.
   
   My configuration as below:
   ```yaml
   
   apiVersion: apisix.apache.org/v2
   kind: ApisixPluginConfig
   metadata:
     name: echo-and-cors-apc
     namespace: test
   spec:
     plugins:
     - name: echo
       enable: true
       config:
         before_body: "This is the preface"
         after_body: "This is the epilogue"
         headers:
           X-Foo: v1
           X-Foo2: v2
     - name: cors
       enable: true
   ---
   
   apiVersion: networking.k8s.io/v1
   kind: Ingress
   metadata:
     name: httpbin-demo-apisix
     namespace: test
     annotations:
       kubernetes.io/ingress.class: apisix
       k8s.apisix.apache.org/plugin-conifg-name: "echo-and-cors-apc"
   spec:
     rules:
     - host: httpbin-demo.apisix.mysite.com
       http:
         paths:
         - backend:
             service:
               name: httpbin-demo
               port:
                 number: 80
           path: /
           pathType: Prefix
   ```
   
   After applying, I can get the configured PluginConfig and Route from  
apisix_admin api.
   The PluginConfig added:
   ```json
   {
           "createdIndex": 377,
           "value": {
             "name": "test_echo-and-cors-apc",
             "update_time": 1670417412,
             "desc": "Created by apisix-ingress-controller, DO NOT modify it 
manually",
             "create_time": 1670417167,
             "plugins": {
               "cors": {
                 "allow_headers": "*",
                 "allow_origins": "*",
                 "expose_headers": "*",
                 "max_age": 5,
                 "allow_credential": false,
                 "allow_methods": "*"
               },
               "echo": {
                 "before_body": "This is the preface",
                 "after_body": "This is the epilogue",
                 "headers": {
                   "X-Foo": "v1",
                   "X-Foo2": "v2"
                 }
               }
             },
             "id": "777a719e",
             "labels": {
               "managed-by": "apisix-ingress-controller"
             }
           },
           "modifiedIndex": 380,
           "key": "/apisix/plugin_configs/777a719e"
    }
   ```
   The Route added:
   ```json
   {
           "createdIndex": 379,
           "value": {
             "name": "ing_test_httpbin-demo-apisix_e5d87ed",
             "priority": 0,
             "desc": "Created by apisix-ingress-controller, DO NOT modify it 
manually",
             "upstream_id": "29777be0",
             "host": "httpbin-demo.apisix.mysite.com",
             "update_time": 1670417234,
             "status": 1,
             "create_time": 1670417234,
             "uris": [
               "/",
               "/*"
             ],
             "id": "d6df95c8",
             "labels": {
               "managed-by": "apisix-ingress-controller"
             }
           },
           "modifiedIndex": 379,
           "key": "/apisix/routes/d6df95c8"
   }
   ```
   As we can see, no PluginConfig attached to Route.
   And tests to http://httpbin-demo.apisix.mysite.com/get from browser also 
show no working. 
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long): 
   ```
   helm.sh/chart:ingress-controller-0.10.1
   app.kubernetes.io/version:1.5.0
   ```
   - your Kubernetes cluster version (output of kubectl version):
   ```
   Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.2", 
GitCommit:"5835544ca568b757a8ecae5c153f317e5736700e", GitTreeState:"clean", 
BuildDate:"2022-09-21T14:33:49Z", GoVersion:"go1.19.1", Compiler:"gc", 
Platform:"linux/amd64"}
   Kustomize Version: v4.5.7
   Server Version: version.Info{Major:"1", Minor:"24+", 
GitVersion:"v1.24.6-aliyun.1", 
GitCommit:"be2c483aa02d6189c93f0b4ca6420c1d37d5c55c", GitTreeState:"clean", 
BuildDate:"2022-11-16T04:06:26Z", GoVersion:"go1.18.6", Compiler:"gc", 
Platform:"linux/amd64"}
   ```
   - if you run apisix-ingress-controller in Bare-metal environment, also show 
your OS version (uname -a):
   nope
   
   ### Minimal test code / Steps to reproduce
   
   1. applly with below template:
   ```yaml
   
   apiVersion: apisix.apache.org/v2
   kind: ApisixPluginConfig
   metadata:
     name: echo-and-cors-apc
     namespace: test
   spec:
     plugins:
     - name: echo
       enable: true
       config:
         before_body: "This is the preface"
         after_body: "This is the epilogue"
         headers:
           X-Foo: v1
           X-Foo2: v2
     - name: cors
       enable: true
   ---
   
   apiVersion: networking.k8s.io/v1
   kind: Ingress
   metadata:
     name: httpbin-demo-apisix
     namespace: test
     annotations:
       kubernetes.io/ingress.class: apisix
       k8s.apisix.apache.org/plugin-conifg-name: "echo-and-cors-apc"
   spec:
     rules:
     - host: httpbin-demo.apisix.mysite.com
       http:
         paths:
         - backend:
             service:
               name: httpbin-demo
               port:
                 number: 80
           path: /
           pathType: Prefix
   ```
   
   2. Open http://httpbin-demo.apisix.mysite.com/get from browser. 
   
   ### Actual result
   
   The PluginConfig has no effect. the output from browser network inspection 
keep the same.
   
   ### Error log
   
   Not noticed.
   
   ### Expected result
   
   The PluginConfig takes effect. http header added:  "X-Foo": "v1", "X-Foo2": 
"v2"


-- 
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