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

Loki Tanka microservices: common environment variables #6124

Merged
merged 3 commits into from
May 17, 2022
Merged

Loki Tanka microservices: common environment variables #6124

merged 3 commits into from
May 17, 2022

Conversation

irizzant
Copy link
Contributor

@irizzant irizzant commented May 9, 2022

What this PR does / why we need it:

This PR adds commonEnvs config parameter to specify variables common to all Pod and it was created to facilitate specifying S3 credentials.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Is this an important fix or new feature? Add an entry in the CHANGELOG.md.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@irizzant irizzant requested a review from a team as a code owner May 9, 2022 07:51
@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@irizzant
Copy link
Contributor Author

irizzant commented May 11, 2022

Hello @kavirajk can you please take a look at this?

@kavirajk
Copy link
Contributor

@irizzant thanks for the PR. My primary concern here is empty commonEnvs by default. I'm pretty sure you are overriding commonEnvs in your environments with proper variables.

Curious why not add commonEnvs directly in our envs and overrides the pod's spec accordingly?

Something similar to

local loki = import 'lib/loki';
{
   _config+: {
        commonEnvs: [ envVar.new('AWS_CREDENTIALS')],
    }

    distributor_container+::
        container.withEnvMixin(_config.commonEnvs)

}

Same for other pod(s) containers as well.

In fact this is how we do internally to pass credentials to our pods.

@irizzant
Copy link
Contributor Author

@kavirajk the empty array as value for commonEnvs is actually handled by withEnvMixin function, example here.
In case there are no envs already specified at pod level there is just an empty array, nothing dangerous on its own.

The reason why I didn't use the approach you suggested is to avoid the override at container level.
I think that something like:

   _config+: {
        commonEnvs: [ envVar.new('AWS_CREDENTIALS')],
    }

without having to go through all the containers to add:

somecontainer+::
        container.withEnvMixin(_config.commonEnvs)

is a more friendly approach.

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@kavirajk
Copy link
Contributor

@irizzant I'm convinced.

Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks @irizzant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants