kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
876 stars 55 forks source link

Revert "adding environment variable KUBECTL_COST_USE_PROXY to set the --use-proxy behavior" #124

Closed michaelmdresser closed 2 years ago

michaelmdresser commented 2 years ago

Reverts kubecost/kubectl-cost#122

122 broke --use-proxy. Example output:

→ kubectl cost namespace --use-proxy 
Error: failed to query allocation API: failed to proxy get kubecost. err: the server is currently unable to handle the request (get services kubecost-cost-analyzer:⎂); data: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"no endpoints available for service \"kubecost-cost-analyzer:⎂\"","reason":"ServiceUnavailable","code":503}

Usage:
  cost namespace [flags]

Aliases:
  namespace, ns

Flags:
      --allocation-path string         URL path at which Allocation queries can be served from the configured service. If using OpenCost, you may want to set this to '/allocation/compute' (default "/model/allocation")
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir string               Default cache directory (default "/home/delta/.kube/cache")
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
  -h, --help                           help for namespace
      --historical                     show the total cost during the window instead of the projected monthly rate based on the data in the window
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -N, --kubecost-namespace string      The namespace that kubecost is deployed in. Requests to the API will be directed to this namespace. (default "kubecost")
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --service-name string            The name of the kubecost cost analyzer service. Change if you're running a non-standard deployment, like the staging helm chart. (default "kubecost-cost-analyzer")
      --service-port int               The port of the service at which the APIs are running. If using OpenCost, you may want to set this to 9003. (default 9090)
  -A, --show-all-resources             Equivalent to --show-cpu --show-memory --show-gpu --show-pv --show-network --show-efficiency for namespace, deployment, controller, lable and pod OR --show-type --show-cpu --show-memory for node.
      --show-asset-type                show type of assets displayed.
      --show-cpu                       show data for CPU cost
      --show-efficiency                show efficiency of cost alongside CPU and memory cost (default true)
      --show-gpu                       show data for GPU cost
      --show-lb                        show load balancer cost data
      --show-memory                    show data for memory cost
      --show-network                   show data for network cost
      --show-pv                        show data for PV (physical volume) cost
      --show-shared                    show shared cost data
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --use-proxy                      Instead of temporarily port-forwarding, proxy a request to Kubecost through the Kubernetes API server.
      --user string                    The name of the kubeconfig user to use
      --window string                  The window of data to query. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here. (default "1d")

Global Flags:
      --log-level string   Set the log level from one of: 'trace', 'debug', 'info', 'warn', 'error'. (default "info")

Will re-merge the env var behavior when we get it working.

michaelmdresser commented 2 years ago

Actually, this behavior was present even before #122. Don't need to revert.