Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Warning logs on environment read in latest version #53

Open
lays147 opened this issue Apr 16, 2024 · 3 comments
Open

[Bug]: Warning logs on environment read in latest version #53

lays147 opened this issue Apr 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lays147
Copy link

lays147 commented Apr 16, 2024

Kong Version

3.6.1

Plugin Version

0.2.0-1

On which environment your Kong instance is running?

ECS

Plugin Configuration

_format_version: "3.0"

_info:
  defaults: {}
  select_tags:
    - ddtrace

plugins:
  - name: ddtrace
    tags:
      - ddtrace
    config:
      service_name: my-api-gateway
      environment: production
      static_tags:
        - name: app
          value: my-api-gateway

What happened?

Within this latest version, I'm getting several warning logs from the plugin about errors on reading the env configs from a vault:
image

2024/04/16 16:33:48 [warn] 1363#0: *2487 [kong] vault.lua:1255 could not retrieve value for reference {vault://env/DD_TRACE_PROPAGATION_STYLE_EXTRACT} (could not get value from external vault (no value found)), context: ngx.timer

I don't even have a vault configured within this Kong.

This is not impacting the availability of the Kong Gateway, but it's a very verbose log that's being triggered all the time.

@lays147 lays147 added the bug Something isn't working label Apr 16, 2024
@dmehala
Copy link
Contributor

dmehala commented Apr 16, 2024

Hey!

These warnings occur during the initialization phase or when a new configuration is received. The plugin attempts to resolve Datadog environment variable (DD_SERVICE, DD_ENV, etc).

The warning is generated by kong.vault. Unfortunately, there isn't much I can do about it, aside from possibly using os.getenv. However, I'd prefer kong vault caching mechanism instead of making N syscalls per environment variable to resolve.

I apologize for not having a more satisfactory solution for you. I'll continue to brainstorm and see if I can come up with a better approach.

@lays147
Copy link
Author

lays147 commented Apr 16, 2024

@dmehala no problem.

Adding one more thing:
This plugin searches the values under the env prefix. based on the kong docs, it retrieves the values from the environment variables on the container, but it can be also set through the Vault API, but the API does not accept the env prefix, despite the docs using the envprefix.

So, if someone tries to set these variables in a new prefix(as I was trying to get rid of the warnings), this plugin does not support a custom path for it, so it won't work.

@cuotos
Copy link

cuotos commented Apr 18, 2024

could the plugin be made to not be configurable by env var and defer that to the user to use env vars in their config / deck yaml file?

I dont know of any other plugin that makes direct calls to get_env(), it seems like this possibly isn't intended to be used by external code?

These warnings occur during the initialization phase or when a new configuration is received

Thanks for pointing to this. Just to add, its then every 1min after that as I believe kong is doing it own secret rotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants