Skip to content

feat: support env var for secret config of plugins like kafka-logger, elasticsearch-logger #11366

@Zeeeeta

Description

@Zeeeeta

Description

I am using helm to deploy a set of APISIX, Dashboard and etcd.
I defined the extraEnvVars in the values.yaml and set K8s secret, and able to print the ENV VAR key/value in the apisix-gateway pod.

However, when I set the plugin config json following this guide, it is not able to use the ENV VAR value.
https://apisix.apache.org/docs/apisix/terminology/secret/#use-environment-variables-to-manage-secrets

Sample of simplied config as below:

{
    "plugins": {
        "kafka-logger": {
            "brokers": [
                {
                    "sasl_config": {
                        "mechanism": "PLAIN",
                        "password": "$ENV://KAFKA_LOGGER_PW",
                        "user": "user"
                    }
                }
            ]
        },
        "elasticsearch-logger": {
            "auth": {
                "password": "$ENV://ELASTICSEARCH_LOGGER_PW",
                "username": "user"
            }
        }
    }
}

I also tried with the mocking plugin but with no luck, is the ENV VAR mechanism not working on every plugin?

Environment

Kubernetes Version: v1.27.12 +rke2r1
APISIX Helm Charts Version: 2.8.0
APISIX version: 3.9.1
Operating system: Linux apisix-797b96d476-vtkg2 5.14.0-362.8.1.el9_3.x86_64
OpenResty / Nginx version: openresty/1.25.3.1
etcd version: 3.5.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions