-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Ksonnet: Configurable resource request and limit on all loki components #2695
Ksonnet: Configurable resource request and limit on all loki components #2695
Conversation
> Loki.libsonnet (changed) - Update import for consul from jsonnet-libs/consul to local consul.libsonnet > config.libsonnet (changed) - Add consul_replicas - ingester : * Update pvc size from 5 to 10Gi (same as ingester.libsonnet) * Add replicas, resource request and limit (same as ingester.libsonnet) - querier : add replicas, resource request and limit (same as querier.libsonnet) - query-frontend : add resource request and limit (same as query-frontend.libsonnet) - table-manager : add replicas, resource request and limit (same as table-manager.libsonnet) - gateway : add replicas, resource request and limit (same as table-manager.libsonnet) - distributor : add replicas, resource request and limit (same as table-manager.libsonnet) > consul.libsonnet (new) - Add explicit resource requirement (same as jsonnet-libs jsonnet-libs/consul) > ingester.libsonnet (changed) - Refer replicas, resource request and limit, pvc size to config.libsonnet > querier.libsonnet (changed) - Refer replicas, resource request and limit to config.libsonnet > query-frontend.libsonnet (changed) - Refer resource request and limit to config.libsonnet > table-manager.libsonnet (changed) - Refer replicas, resource request and limit to config.libsonnet > gateway.libsonnet (changed) - Refer replicas, resource request and limit to config.libsonnet > distributor.libsonnet (changed) - Refer replicas, resource request and limit to config.libsonnet > memcached.libsonnet (changed) - Add explicit resource requirement (based on generated loki manifests)
Codecov Report
@@ Coverage Diff @@
## master #2695 +/- ##
==========================================
- Coverage 61.46% 61.39% -0.07%
==========================================
Files 173 173
Lines 13421 13421
==========================================
- Hits 8249 8240 -9
- Misses 4421 4426 +5
- Partials 751 755 +4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the PR. You've got the right idea, but these meta parameters shouldn't be under the $._config.loki
prefix because that actually gets marshalled into the configmap here. If you were to run this now, all the loki pods would crash because of these unexpected fields in their config.
That being said, I really like what this PR is trying to do. You can follow the example started by the querier & frontend here by using the $._config
prefix instead ($._config.querier
, etc). It may even be a good time to develop a specific prefix for these instead, such as $._config.components
to centralize all these meta parameters such as $._config.components.{querier,queryFrontend,etc}
@@ -6,22 +6,38 @@ memcached { | |||
name: 'memcached', | |||
max_item_size: '2m', | |||
memory_limit_mb: 4096, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better handled by the options exposed in the library, which also account for passing the args to memcached among other things:
https://github.com/grafana/jsonnet-libs/blob/master/memcached/memcached.libsonnet#L22-L31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I am passing max_item_size and memory_limit_mb args to config.libsonnet
@@ -0,0 +1,7 @@ | |||
local consul = import "consul/consul.libsonnet"; | |||
|
|||
consul { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should add this file if we don't make any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to expose them to config.libsonnet
There is unfortunate limitation in tanka that it could not refer to <$._config.components>. Failed on runtime.. It seems refering to nested variable is not supported yet. (possible different parser engine with https://github.com/google/jsonnet) so I have to put in $._config |
@owen-d Hello, any updates, comments? |
Hello @owen-d, I just saw there was a file conflict. It's corrected now. Please review and let me know your thoughts. Thank you |
Hey, I don't think I was clear enough earlier, but I was suggesting we create the After talking about this issue with @slim-bean, I'm questioning if adding these parameters is actually helpful. Jsonnet, unlike helm, can easily be arbitrarily overridden, so adding these parameter fields may just contribute to code bloat in the long term. I apologize that I've changed my tune on this PR; I'm sure it's frustrating. I'm in favor of closing this PR now, but am open to other opinions. @slim-bean @cyriltovena thoughts? |
I had created
Yes, I agree jsonnet can be overriden. But when installing loki with tanka, I could not change the resource request from environments/loki/main.jsonnet, that is why I go through the troubles exposing them all in config.libsonnet. If it's not a trouble, could you please show me how to override the resource request from environments/loki/main.jsonnet? |
Absolutely! You can do it via
where |
Hello @owen-d Thank you! This is a relief! I was figuring out how to do it in main.jsonnet for quite a time before changing config.libsonnet I am posting the solution here for other people who want to adjust the resource // adjust resource // adjust replica // adjust resource for memcached Closing the PR :) |
:) |
Changes:
Loki.libsonnet (changed)
config.libsonnet (changed)
boltdb_shipper.libsonnet
consul.libsonnet (new)
ingester.libsonnet (changed)
querier.libsonnet (changed)
query-frontend.libsonnet (changed)
table-manager.libsonnet (changed)
gateway.libsonnet (changed)
distributor.libsonnet (changed)
memcached.libsonnet (changed)
What this PR does / why we need it:
Provides configurable resource request and limit in config. Beneficial for user who would want to use microservice but start with modest resource
Which issue(s) this PR fixes:
#2687
Special notes for your reviewer:
For memcached_chunks, it looks like tanka have its own calc by container arguments? I am putting the values the same as generated manifest. Suggest correction if the value is incorrect
Checklist