-
Notifications
You must be signed in to change notification settings - Fork 85
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 error when loading custom pricing configuration file #206
Conversation
@mattray Hi, when you have some time, pls let me know if this looks good to you 🙏 |
@@ -243,7 +243,7 @@ spec: | |||
readOnly: false | |||
{{- end }} | |||
{{- if .Values.opencost.customPricing.enabled }} | |||
- mountPath: {{ .Values.opencost.customPricing.configPath }} | |||
- mountPath: {{ .Values.opencost.customPricing.configPath }}/{{ include "opencost.configFileName" . }}.json | |||
name: custom-configs | |||
subPath: {{ include "opencost.configFileName" . }}.json |
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.
the subPath isn't working?
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.
No, it gets mounted as a file:
~ $ ls /tmp/custom-config -l
-rw-r--r-- 1 root root 299 May 15 10:27 /tmp/custom-config
~ $ cat /tmp/custom-config
{
"CPU": "1.25",
"GPU": "0.95",
"RAM": "0.5",
"description": "Modified pricing configuration.",
"internetNetworkEgress": "0.12",
"regionNetworkEgress": "0.01",
"spotCPU": "0.006655",
"spotRAM": "0.000892",
"storage": "0.25",
"zoneNetworkEgress": "0.01",
"provider" : "custom"
}~ $
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.
As @mogaal said,
The subPath specifies what key should be loaded from the configmap. The mountPath is the full path to the file loaded, so it should also contain the file's name or else the custom-config would be considered as the mounted file's name. Final applied deployment should be like this:
- mountPath: /tmp/custom-config/default.json
name: custom-configs
readOnly: true
subPath: default.json
#208 should have the full fix for this, as you need to fix the custom metrics too. |
Signed-off-by: Matt Ray <github@mattray.dev>
This fixes the bug I reported in #205, where the
CONFIG_PATH
directory is mounted as a file instead of as a directory:This causes the pod to fail with: