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

Fix memory conversion from different units to MiB #1128

Merged
merged 7 commits into from
Jan 24, 2024
Merged

Conversation

jinja2
Copy link
Collaborator

@jinja2 jinja2 commented Jan 24, 2024

Description:

Helm chart cannot convert non-integer values of memory limits to MiB. When a float value, for e.g. 0.5Gi, is set for memory resource, the variable SPLUNK_MEMORY_TOTAL_MIB (used by the collector to set default memory limit) is set to 0. This PR updates the helper function to handle non-integer memory limit values.

Link to Splunk idea: <Link to Splunk idea, see https://ideas.splunk.com>

Testing: PR also adds some unittests which checks the generated variable value for correctness.

Documentation:

@jinja2 jinja2 requested review from a team as code owners January 24, 2024 04:05
@jinja2 jinja2 marked this pull request as draft January 24, 2024 04:06
@jinja2 jinja2 marked this pull request as ready for review January 24, 2024 04:14
This helper converts the input value of memory to MiB.
Input needs to be a valid value as supported by k8s memory resource field.
*/}}
{{- define "splunk-otel-collector.convertMemToMib" }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The template converts the input to bytes first and then bytes to MiB. Check the unttest file for examples.

@jinja2 jinja2 merged commit adb08dc into main Jan 24, 2024
32 checks passed
@jinja2 jinja2 deleted the mem-conversion branch January 24, 2024 20:13
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants