NandanSatheeshJupiter opened a new issue, #12150:
URL: https://github.com/apache/apisix/issues/12150

   ### Description
   
   I have created a custom docker image with the plugin created - 
   
   Let's keep this a simple plugin for example - 
   ```
   local core = require("apisix.core")
   
   local plugin_name = "log"
   
   local _M = {
       version = 0.1,
       priority = 0,
       name = plugin_name,
   }
   
   _M.schema = {
       type = "object",
       properties = {},
   }
   
   function _M.access(conf, ctx)
       core.log.info("log plugin triggered!")
   end
   
   return _M
   ```
   Dockerfile - 
   ```
   FROM apache/apisix:3.12.0-debian
   
   USER root
   
   RUN apt-get update && apt-get install -y vim
   
   USER apisix
   
   COPY ./jwt-auth-headers.lua 
/usr/local/apisix/apisix/plugins/jwt-auth-headers.lua
   COPY ./log.lua /usr/local/apisix/apisix/plugins/log.lua
   ```
   k8s YML 
   ```
   apiVersion: v1
   kind: Namespace
   metadata:
     name: apisix
   ---
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: apisix-config
     namespace: apisix
   data:
     config.yaml: |
       apisix:
         node_listen: 9080
         enable_admin_cors: true
         admin_key:
           - name: "admin"
             key: edd1c9f034335f136f87ad84b625c8f1
             role: admin
       deployment:
         role: data_plane
         role_data_plane:
           config_provider: yaml
       logger:
         level: "info"  
       
       plugins:
         - log
         - jwt-auth-headers
         - serverless-pre-function
         - grpc-transcode
         - limit-req
         - limit-count
         - proxy-rewrite
         - ip-restriction
         - response-rewrite
       
       plugin_attr:
         - log
   ---
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: apisix-routes
     namespace: apisix
   data:
     apisix.yaml: |
       routes:
         - id: 100
           uri: /health
           plugins:
             log:
             serverless-pre-function:
               phase: access
               functions:
                 - |
                   return function(conf, ctx)
                     ngx.say('APISIX is healthy')
                     ngx.exit(200)
                   end
         - id: 1
           uri: /hello
           upstream:
             type: roundrobin
             nodes:
               "127.0.0.1:8080": 1
           plugins:
             response-rewrite:
               headers:
                 set:
                   X-Config-Version: "v1"
               body: "Hello from APISIX v1\n"
       #END
   ---
   apiVersion: apps/v1
   kind: Deployment
   metadata:
     name: apisix
     namespace: apisix
     annotations:
       reloader.stakater.com/auto: "true"
       configmap.reloader.stakater.com/reload: "apisix-config,apisix-routes"
   spec:
     replicas: 1
     selector:
       matchLabels:
         app: apisix
     template:
       metadata:
         labels:
           app: apisix
       spec:
         containers:
         - name: apisix
           image: custom-apisix:1.0.6
           imagePullPolicy: Never
           resources:
             requests:
               cpu: 500m
               memory: 1Gi
             limits:
               cpu: 500m
               memory: 1Gi
           ports:
           - containerPort: 9080
             name: http
           - containerPort: 9443
             name: https
           - containerPort: 9180
             name: admin
           livenessProbe:
             httpGet:
               path: /health
               port: 9080
               scheme: HTTP
             initialDelaySeconds: 30
             periodSeconds: 10
             timeoutSeconds: 5
             failureThreshold: 3
           readinessProbe:
             httpGet:
               path: /health
               port: 9080
               scheme: HTTP
             initialDelaySeconds: 30
             periodSeconds: 10
             timeoutSeconds: 5
             failureThreshold: 3
           volumeMounts:
           - name: config
             mountPath: /usr/local/apisix/conf/config.yaml
             subPath: config.yaml
           - name: routes
             mountPath: /usr/local/apisix/conf/apisix.yaml
             subPath: apisix.yaml
         volumes:
         - name: config
           configMap:
             name: apisix-config
         - name: routes
           configMap:
             name: apisix-routes
   ---
   apiVersion: v1
   kind: Service
   metadata:
     name: apisix
     namespace: apisix
   spec:
     type: NodePort
     ports:
     - port: 80
       targetPort: 9080
       name: http
     - port: 9180
       targetPort: 9180
       name: admin
     selector:
       app: apisix
   ---
   apiVersion: autoscaling/v2
   kind: HorizontalPodAutoscaler
   metadata:
     name: hpa
     namespace: apisix
   spec:
     scaleTargetRef:
       apiVersion: apps/v1
       kind: Deployment
       name: apisix
     maxReplicas: 10
     minReplicas: 2
     metrics:
       - type: Resource
         resource:
           name: cpu
           target:
             type: Utilization
             averageUtilization: 75
       - type: Resource
         resource:
           name: memory
           target:
             type: Utilization
             averageUtilization: 75
     behavior:
       scaleDown:
         stabilizationWindowSeconds: 120  
         policies:
         - type: Pods
           value: 1 
           periodSeconds: 30
   ---
   ```
   
   The issue is that the plugin is not getting loaded. Is there anything which 
is missed currently in the config? Help awaited. Thanks in advance. 
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.12.0
   - Operating system (run `uname -a`): 
   ```
   Linux apisix-5df8c7454c-2mf4f 5.15.49-linuxkit-pr #1 SMP PREEMPT Thu May 25 
07:27:39 UTC 2023 aarch64 GNU/Linux
   ```
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
   ```
   nginx version: openresty/1.27.1.1
   built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
   built with OpenSSL 3.2.0 23 Nov 2023
   TLS SNI support enabled
   ```
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`): N/A
   - APISIX Dashboard version, if relevant: N/A
   - Plugin runner version, for issues related to plugin runners: N/A
   - LuaRocks version, for installation issues (run `luarocks --version`): N/A
   


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