You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Show how much each namespace cost over the past 5 days
@@ -253,17 +253,19 @@ subcommand has its own set of flags for adjusting query behavior and output.
253
253
There are several flags that modify the behavior of queries to the backing
254
254
Kubecost/OpenCost APIs:
255
255
```
256
-
-r, --release-name string The name of the Helm release, used to template service names if they are unset. For example, if Kubecost is installed with 'helm install kubecost2 kubecost/cost-analyzer', then this should be set to 'kubecost2'. (default "kubecost")
257
-
--service-name string The name of the Kubecost cost analyzer service. By default, it is derived from the Helm release name and should not need to be overridden.
258
-
--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)
259
-
-N, --kubecost-namespace string The namespace that Kubecost is deployed in. Requests to the API will be directed to this namespace. Defaults to the Helm release name.
256
+
-r, --release-name string The name of the Helm release, used to template service names if they are unset. For example, if Kubecost is installed with 'helm install kubecost2 kubecost/cost-analyzer', then this should be set to 'kubecost2'. (default "kubecost")
257
+
--service-name string The name of the Kubecost cost analyzer service. By default, it is derived from the Helm release name and should not need to be overridden.
258
+
--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)
259
+
-N, --kubecost-namespace string The namespace that Kubecost is deployed in. Requests to the API will be directed to this namespace. Defaults to the Helm release name.
260
260
261
-
--use-proxy Instead of temporarily port-forwarding, proxy a request to Kubecost through the Kubernetes API server.
261
+
--use-proxy Instead of temporarily port-forwarding, proxy a request to Kubecost through the Kubernetes API server.
262
262
263
-
--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")
264
-
--predict-resource-cost-path string URL path at which Resource Cost Prediction queries can be served from the configured service. (default "/model/prediction/resourcecost")
265
-
--predict-resource-cost-diff-path string URL path at which Resource Cost Prediction diff queries can be served from the configured service. (default "/model/prediction/resourcecostdiff")
266
-
--no-diff Set true to not attempt a cost difference with a matching in-cluster workload, if one can be found.
263
+
--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")
264
+
265
+
--predict-speccost-path string URL path at which Prediction queries can be served from the configured service. (default "/model/prediction/speccost")
266
+
--no-usage Set true ignore historical usage data (if any exists) when performing cost prediction.
267
+
--only-after Set true to only show the overall predicted cost of the workload.
268
+
--only-diff Set true to only show the cost difference (cost "impact") instead of the overall cost plus diff. (default true)
cmd.Flags().StringVar(&options.window, "window", "1d", "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.")
49
26
cmd.Flags().BoolVar(&options.isHistorical, "historical", false, "show the total cost during the window instead of the projected monthly rate based on the data in the window")
50
-
cmd.Flags().BoolVar(&options.showCPUCost, "show-cpu", false, "show data for CPU cost")
51
-
cmd.Flags().BoolVar(&options.showMemoryCost, "show-memory", false, "show data for memory cost")
52
-
cmd.Flags().BoolVar(&options.showGPUCost, "show-gpu", false, "show data for GPU cost")
53
-
cmd.Flags().BoolVar(&options.showPVCost, "show-pv", false, "show data for PV (physical volume) cost")
54
-
cmd.Flags().BoolVar(&options.showNetworkCost, "show-network", false, "show data for network cost")
cmd.Flags().BoolVar(&options.showEfficiency, "show-efficiency", true, "show efficiency of cost alongside CPU and memory cost")
58
-
cmd.Flags().BoolVar(&options.showAssetType, "show-asset-type", false, "show type of assets displayed.")
59
-
cmd.Flags().BoolVarP(&options.showAll, "show-all-resources", "A", false, "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.")
cmd.Flags().StringVarP(&options.HelmReleaseName, "release-name", "r", "kubecost", "The name of the Helm release, used to template service names if they are unset. For example, if Kubecost is installed with 'helm install kubecost2 kubecost/cost-analyzer', then this should be set to 'kubecost2'.")
66
-
cmd.Flags().StringVarP(&options.KubecostNamespace, "kubecost-namespace", "N", "", "The namespace that Kubecost is deployed in. Requests to the API will be directed to this namespace. Defaults to the Helm release name.")
67
-
68
-
cmd.Flags().IntVar(&options.ServicePort, "service-port", 9090, "The port of the service at which the APIs are running. If using OpenCost, you may want to set this to 9003.")
69
-
cmd.Flags().StringVar(&options.ServiceName, "service-name", "", "The name of the Kubecost cost analyzer service. By default, it is derived from the Helm release name and should not need to be overridden.")
70
-
cmd.Flags().BoolVar(&options.UseProxy, "use-proxy", false, "Instead of temporarily port-forwarding, proxy a request to Kubecost through the Kubernetes API server.")
71
-
cmd.Flags().StringVar(&options.AllocationPath, "allocation-path", "/model/allocation", "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'")
72
-
cmd.Flags().StringVar(&options.PredictResourceCostPath, "predict-resource-cost-path", "/model/prediction/resourcecost", "URL path at which Resource Cost Prediction queries can be served from the configured service.")
73
-
cmd.Flags().StringVar(&options.PredictResourceCostDiffPath, "predict-resource-cost-diff-path", "/model/prediction/resourcecostdiff", "URL path at which Resource Cost Prediction diff queries can be served from the configured service.")
74
27
75
-
//Check if environment variable KUBECTL_COST_USE_PROXY is set, it defaults to false
76
-
v:=viper.New()
77
-
v.SetEnvPrefix(envPrefix)
78
-
v.AutomaticEnv()
79
-
bindAFlagToViperEnv(cmd, v, "use-proxy")
80
-
}
81
-
82
-
// addKubeOptionsFlags sets up the cobra command with the flags from
83
-
// KubeOptions' configFlags so that a kube client can be built to a
84
-
// user's specification. Its one modification is to change the name
85
-
// of the namespace flag to kubecost-namespace because we want to
86
-
// "behave as expected", i.e. --namespace affects the request to the
0 commit comments