haowang-pony opened a new issue #710:
URL: https://github.com/apache/apisix-ingress-controller/issues/710


   ### Issue description
   I want to set the default_cluster_admin_key from env variable. I have such 
config.yaml file and set the `ADMIN_PASSWORD` as env. And I mount the 
config.yaml as configMap for my apisix-ingress-controller pods.  but the 
config.yaml couldn't read the `ADMIN_PASSWORD` from os environment. 
   
   apisix-ingress-controller config.yaml
   ```
         apisix:
           default_cluster_base_url: 
"http://apisix-admin.ingress-apisix:9180/apisix/admin";
           default_cluster_admin_key: "${ADMIN_PASSWORD}"
         log_level: "debug"
         log_output: "stderr"
         http_listen: ":8080"
         enable_profiling: true
         kubernetes:
           kubeconfig: ""
           resync_interval: "30s"
           app_namespaces:
           - "*"
           ingress_class: "apisix"
           ingress_version: "networking/v1"
           apisix_route_version: "apisix.apache.org/v2beta1"
   
   ```
   
   env config
   ```
             env:
             - name: ADMIN_PASSWORD
               valueFrom:
                 secretKeyRef:
                   key: password
                   name: apisix-admin-secret
   ```
   
   But the interesting thing is: my apisix config.yaml file could correctly 
read `ADMIN_PASSWORD` from environment. 
   
   apisix config.yaml
   ```
           apisix:
             node_listen: 9080             # APISIX listening port
             enable_heartbeat: true
             enable_admin: true
             enable_admin_cors: true
             enable_debug: false
             enable_dev_mode: false          # Sets nginx worker_processes to 1 
if set to true
             enable_reuseport: true          # Enable nginx SO_REUSEPORT switch 
if set to true.
             enable_ipv6: true
             config_center: etcd             # etcd: use etcd to store the 
config value
   
             allow_admin:                  # 
http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
               - 0.0.0.0/0
             port_admin: 9180
   
             admin_key:
               # admin: can everything for configuration data
               - name: "${ADMIN_USERNAME}"
                 key: ${ADMIN_PASSWORD}
                 role: admin
               # viewer: only can view configuration data
               - name: "${VIEWER_USERNAME}"
                 key: ${VIEWER_PASSWORD}
                 role: viewer
   ```
   
   ### Environment
   
   * your apisix-ingress-controller version (output of 
`apisix-ingress-controller version --long`); 1.2.0
   * your Kubernetes cluster version (output of `kubectl version`);   v1.20.11
   * if you run apisix-ingress-controller in Bare-metal environment, also show 
your OS version (`uname -a`). Linux apisix-ingress-controller-6d46bd8c5c-fwzjq 
5.4.0-45-generic #49~18.04.2-Ubuntu SMP Wed Aug 26 16:29:02 UTC 2020 x86_64 
Linux
   


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