nodestats.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package env
  2. import (
  3. "github.com/opencost/opencost/core/pkg/env"
  4. )
  5. const (
  6. // Node Stats Client Configuration
  7. NodeStatsForceKubeProxyEnvVar = "NODESTATS_FORCE_KUBE_PROXY"
  8. NodeStatsLocalProxyEnvVar = "NODESTATS_LOCAL_PROXY"
  9. NodeStatsInsecureEnvVar = "NODESTATS_INSECURE"
  10. NodeStatsCertFileEnvVar = "NODESTATS_CERT_FILE"
  11. NodeStatsKeyFileEnvVar = "NODESTATS_KEY_FILE"
  12. )
  13. // IsNodeStatsForceKubeProxy returns true if the node stats client should force the kube proxy direct end
  14. // point formatting
  15. func IsNodeStatsForceKubeProxy() bool {
  16. return env.GetBool(NodeStatsForceKubeProxyEnvVar, false)
  17. }
  18. // GetNodeStatsLocalProxy returns the fully qualified local proxy endpoint for the node stats client IFF the proxyAPI
  19. // is selected.
  20. func GetNodeStatsLocalProxy() string {
  21. return env.Get(NodeStatsLocalProxyEnvVar, "")
  22. }
  23. // IsNodeStatsInsecure returns true if the node stats client should skip TLS verification
  24. func IsNodeStatsInsecure() bool {
  25. return env.GetBool(NodeStatsInsecureEnvVar, false)
  26. }
  27. // GetNodeStatsCertFile returns the path of the cert file
  28. func GetNodeStatsCertFile() string {
  29. return env.Get(NodeStatsCertFileEnvVar, "")
  30. }
  31. // GetNodeStatsKeyFile returns the path of the key file
  32. func GetNodeStatsKeyFile() string {
  33. return env.Get(NodeStatsKeyFileEnvVar, "")
  34. }