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

Failing when customPricing set #205

Closed
mogaal opened this issue May 15, 2024 · 0 comments · Fixed by #208
Closed

Failing when customPricing set #205

mogaal opened this issue May 15, 2024 · 0 comments · Fixed by #208

Comments

@mogaal
Copy link
Contributor

mogaal commented May 15, 2024

Using the latest version of the Helm Chart (version: 1.37.0) and setting customPricing to true (.Values.opencost.customPricing.enabled) cause the pod to fail with the following error:

opencost-ui /docker-entrypoint.sh: Configuration complete; ready for start up
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: using the "epoll" event method
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: nginx/1.25.5
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014) 
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: OS: Linux 6.6.22-linuxkit
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
opencost-ui 2024/05/15 10:27:58 [notice] 1#1: start worker processes
opencost 2024-05-15T10:27:58.127117389Z INF No metrics-config configmap found at install time, using existing configs: configmaps "metrics-config" not found
opencost 2024-05-15T10:27:58.127243847Z INF Failed to get metrics config before init: error reading metrics config file: open /tmp/custom-config/metrics.json: not a directory
opencost 2024-05-15T10:27:58.127567764Z WRN Controller: pullWatchers: failed to load config statuses from file: open /tmp/custom-config/cloud-configurations.json: not a directory. Proceeding to create the file
opencost 2024-05-15T10:27:58.127651722Z ERR Controller: pullWatchers: failed to save statuses failed to save config statuses to file: open /tmp/custom-config/cloud-configurations.json: not a directory
opencost 2024-05-15T10:27:58.127671222Z ERR MultiCloudWatcher:  error checking file at '/tmp/custom-config/cloud-integration/cloud-integration.json': stat /tmp/custom-config/cloud-integration/cloud-integration.json: not a directory
opencost 2024-05-15T10:27:58.127685347Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.127701597Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.127721472Z ERR Failed to load config file: /tmp/custom-config/clusters/default-clusters.yaml. Error: stat /tmp/custom-config/clusters/default-clusters.yaml: not a directory
opencost 2024-05-15T10:27:58.127737514Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.12774268Z INF Failed to download pricing data: stat /tmp/custom-config/default.json: not a directory
opencost 2024-05-15T10:27:58.12774668Z INF Init: AggregateCostModel cache warming enabled
opencost 2024-05-15T10:27:58.127775055Z INF Custom Costs enabled: false
opencost 2024-05-15T10:27:58.127806139Z INF EXPORT_CSV_FILE is not set, CSV export is disabled
opencost 2024-05-15T10:27:58.127809889Z INF Cloud Costs enabled: false
opencost 2024-05-15T10:27:58.127824014Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.127879847Z ERR error accessing cloud provider configuration: stat /tmp/custom-config/default.json: not a directory
opencost 2024-05-15T10:27:58.127892472Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.127897889Z ERR error accessing cloud provider configuration: stat /tmp/custom-config/default.json: not a directory
opencost 2024-05-15T10:27:58.127953805Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'
opencost 2024-05-15T10:27:58.12794668Z WRN Failed to read default region from labels on node kind-control-plane
opencost 2024-05-15T10:27:58.127981222Z INF Custom Pricing file at path '/tmp/custom-config/default.json' read error: 'stat /tmp/custom-config/default.json: not a directory'

The configMap gets mounted as a file on /tmp/custom-config (not directory) as you see below

~ $ 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"
}~ $

It should be instead mounted as /tmp/custom-config/default.json. A fix would be removing the subPath (so it gets mounted as directory) in this line.

Helm values file used for the tests:

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

Successfully merging a pull request may close this issue.

1 participant