Skip to content

Commit bcfe78c

Browse files
authored
Merge pull request #579 from qmhu/rf-docs
bugfix: Add docs for recommend, revert expression change
2 parents cd75bf2 + e09c5b9 commit bcfe78c

21 files changed

+414
-561
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ https://user-images.githubusercontent.com/35299017/186680122-d7756b47-06be-44cb-
3636

3737
**Recommendation Framework**
3838

39-
Provide a pluggable framework for analytics and give recommendation for cloud resources, support out-of-box recommenders: Workload Resources/Replicas, Idle Resources.
39+
Provide a pluggable framework for analytics and give recommendation for cloud resources, support out-of-box recommenders: Workload Resources/Replicas, Idle Resources. [learn more](https://gocrane.io/docs/tutorials/recommendation/).
4040

4141
**Prediction-driven Horizontal Autoscaling**
4242

43-
EffectiveHorizontalPodAutoscaler supports prediction-driven autoscaling. With this capability, user can forecast the incoming peak flow and scale up their application ahead, also user can know when the peak flow will end and scale down their application gracefully. [learn more](docs/tutorials/using-effective-hpa-to-scaling-with-effectiveness.md).
43+
EffectiveHorizontalPodAutoscaler supports prediction-driven autoscaling. With this capability, user can forecast the incoming peak flow and scale up their application ahead, also user can know when the peak flow will end and scale down their application gracefully. [learn more](https://gocrane.io/docs/tutorials/using-effective-hpa-to-scaling-with-effectiveness/).
4444

4545
**Load-Aware Scheduling**
4646

47-
Provide a simple but efficient scheduler that schedule pods based on actual node utilization data,and filters out those nodes with high load to balance the cluster. [learn more](docs/tutorials/scheduling-pods-based-on-actual-node-load.md).
47+
Provide a simple but efficient scheduler that schedule pods based on actual node utilization data,and filters out those nodes with high load to balance the cluster. [learn more](https://gocrane.io/docs/tutorials/scheduling-pods-based-on-actual-node-load/).
4848

4949
**Colocation with Enhanced QoS**
5050

README_zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ Crane Dashboard **在线 Demo**: http://dashboard.gocrane.io/
3636

3737
**推荐框架**
3838

39-
提供了一个可扩展的推荐框架以支持多种云资源的分析,内置了多种推荐器:资源推荐,副本推荐,闲置资源推荐。
39+
提供了一个可扩展的推荐框架以支持多种云资源的分析,内置了多种推荐器:资源推荐,副本推荐,闲置资源推荐。[了解更多](https://gocrane.io/zh-cn/docs/tutorials/recommendation/)
4040

4141
**基于预测的水平弹性器**
4242

43-
EffectiveHorizontalPodAutoscaler 支持了预测驱动的弹性。它基于社区 HPA 做底层的弹性控制,支持更丰富的弹性触发策略(预测,观测,周期),让弹性更加高效,并保障了服务的质量。[了解更多](docs/tutorials/using-effective-hpa-to-scaling-with-effectiveness.zh.md)
43+
EffectiveHorizontalPodAutoscaler 支持了预测驱动的弹性。它基于社区 HPA 做底层的弹性控制,支持更丰富的弹性触发策略(预测,观测,周期),让弹性更加高效,并保障了服务的质量。[了解更多](https://gocrane.io/zh-cn/docs/tutorials/using-effective-hpa-to-scaling-with-effectiveness/)
4444

4545
**负载感知的调度器**
4646

47-
动态调度器根据实际的节点利用率构建了一个简单但高效的模型,并过滤掉那些负载高的节点来平衡集群。[了解更多](docs/tutorials/scheduling-pods-based-on-actual-node-load.zh.md)
47+
动态调度器根据实际的节点利用率构建了一个简单但高效的模型,并过滤掉那些负载高的节点来平衡集群。[了解更多](https://gocrane.io/zh-cn/docs/tutorials/scheduling-pods-based-on-actual-node-load/)
4848

4949
**基于 QoS 的混部**
5050

pkg/utils/ehpa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ func GetExpressionQueryDefault(metric autoscalingv2.MetricSpec, namespace string
113113
labels = append(labels, k+"="+`"`+v+`"`)
114114
}
115115
}
116-
expressionQuery = GetCustumerExpression(metric.Pods.Metric.Name, strings.Join(labels, ","))
116+
expressionQuery = GetCustomerExpression(metric.Pods.Metric.Name, strings.Join(labels, ","))
117117
case autoscalingv2.ExternalMetricSourceType:
118118
var labels []string
119119
if metric.External.Metric.Selector != nil {
120120
for k, v := range metric.External.Metric.Selector.MatchLabels {
121121
labels = append(labels, k+"="+`"`+v+`"`)
122122
}
123123
}
124-
expressionQuery = GetCustumerExpression(metric.External.Metric.Name, strings.Join(labels, ","))
124+
expressionQuery = GetCustomerExpression(metric.External.Metric.Name, strings.Join(labels, ","))
125125
}
126126

127127
return expressionQuery

pkg/utils/expression_prom_default.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
// todo: later we change these templates to configurable like prometheus-adapter
88
const (
99
// WorkloadCpuUsageExprTemplate is used to query workload cpu usage by promql, param is namespace,workload-name,duration str
10-
WorkloadCpuUsageExprTemplate = `sum(irate(container_cpu_usage_seconds_total{namespace="%s",pod=~"^%s-%s"}[%s]))`
10+
WorkloadCpuUsageExprTemplate = `sum(irate(container_cpu_usage_seconds_total{namespace="%s",pod=~"^%s-.*$"}[%s]))`
1111
// WorkloadMemUsageExprTemplate is used to query workload mem usage by promql, param is namespace, workload-name
12-
WorkloadMemUsageExprTemplate = `sum(container_memory_working_set_bytes{namespace="%s",pod=~"^%s-%s"})`
12+
WorkloadMemUsageExprTemplate = `sum(container_memory_working_set_bytes{namespace="%s",pod=~"^%s-.*$"})`
1313

1414
// following is node exporter metric for node cpu/memory usage
1515
// NodeCpuUsageExprTemplate is used to query node cpu usage by promql, param is node name which prometheus scrape, duration str
@@ -23,35 +23,31 @@ const (
2323
PodMemUsageExprTemplate = `sum(container_memory_working_set_bytes{container!="POD",namespace="%s",pod="%s"})`
2424

2525
// ContainerCpuUsageExprTemplate is used to query container cpu usage by promql, param is namespace,pod,container duration str
26-
ContainerCpuUsageExprTemplate = `irate(container_cpu_usage_seconds_total{container!="POD",namespace="%s",pod=~"^%s-%s",container="%s"}[%s])`
26+
ContainerCpuUsageExprTemplate = `irate(container_cpu_usage_seconds_total{container!="POD",namespace="%s",pod=~"^%s.*$",container="%s"}[%s])`
2727
// ContainerMemUsageExprTemplate is used to query container cpu usage by promql, param is namespace,pod,container
28-
ContainerMemUsageExprTemplate = `container_memory_working_set_bytes{container!="POD",namespace="%s",pod=~"^%s-%s",container="%s"}`
28+
ContainerMemUsageExprTemplate = `container_memory_working_set_bytes{container!="POD",namespace="%s",pod=~"^%s.*$",container="%s"}`
2929

30-
CustumerExprTemplate = `sum(%s{%s})`
30+
CustomerExprTemplate = `sum(%s{%s})`
3131
)
3232

33-
const (
34-
RegMatchesPodName = `[a-z0-9]+-[a-z0-9]{5}$`
35-
)
36-
37-
func GetCustumerExpression(metricName string, labels string) string {
38-
return fmt.Sprintf(CustumerExprTemplate, metricName, labels)
33+
func GetCustomerExpression(metricName string, labels string) string {
34+
return fmt.Sprintf(CustomerExprTemplate, metricName, labels)
3935
}
4036

4137
func GetWorkloadCpuUsageExpression(namespace string, name string) string {
42-
return fmt.Sprintf(WorkloadCpuUsageExprTemplate, namespace, name, RegMatchesPodName, "3m")
38+
return fmt.Sprintf(WorkloadCpuUsageExprTemplate, namespace, name, "3m")
4339
}
4440

4541
func GetWorkloadMemUsageExpression(namespace string, name string) string {
46-
return fmt.Sprintf(WorkloadMemUsageExprTemplate, namespace, name, RegMatchesPodName)
42+
return fmt.Sprintf(WorkloadMemUsageExprTemplate, namespace, name)
4743
}
4844

4945
func GetContainerCpuUsageExpression(namespace string, workloadName string, containerName string) string {
50-
return fmt.Sprintf(ContainerCpuUsageExprTemplate, namespace, workloadName, RegMatchesPodName, containerName, "3m")
46+
return fmt.Sprintf(ContainerCpuUsageExprTemplate, namespace, workloadName, containerName, "3m")
5147
}
5248

5349
func GetContainerMemUsageExpression(namespace string, workloadName string, containerName string) string {
54-
return fmt.Sprintf(ContainerMemUsageExprTemplate, namespace, workloadName, RegMatchesPodName, containerName)
50+
return fmt.Sprintf(ContainerMemUsageExprTemplate, namespace, workloadName, containerName)
5551
}
5652

5753
func GetPodCpuUsageExpression(namespace string, name string) string {

pkg/web/src/i18n/resources/en/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,8 @@
157157
"当前副本数": "Current Replicas",
158158
"更新时间": "Update Time",
159159
"当前资源(容器/CPU/Memory)": "Current Resource(Container/CPU/Memory)",
160-
"成本分布": "Cost by Dimension"
160+
"成本分布": "Cost by Dimension",
161+
"最近1小时": "Last 1 Hour",
162+
"节点名": "Node Name",
163+
"闲置节点": "Idle Node"
161164
}

pkg/web/src/i18n/resources/zh/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,8 @@
157157
"当前副本数": "当前副本数",
158158
"更新时间": "更新时间",
159159
"当前资源(容器/CPU/Memory)": "当前资源(容器/CPU/Memory)",
160-
"成本分布": "成本分布"
160+
"成本分布": "成本分布",
161+
"最近1小时": "最近1小时",
162+
"节点名": "节点名",
163+
"闲置节点": "闲置节点"
161164
}

pkg/web/src/router/modules/recommend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const useRecommendRouteConfig = () => {
3838
path: 'idleNode',
3939
Component: lazy(() => import('pages/Recommend/IdleNode')),
4040
meta: {
41-
title: t('闭置节点'),
41+
title: t('闲置节点'),
4242
},
4343
},
4444
],

site/content/en/docs/Contributing/developer-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: "Getting started to develop crane"
77
First, please make sure you've got a working [Go environment](https://golang.org/doc/install)
88
and [Docker environment](https://docs.docker.com/engine).
99

10+
## Prepare local crane environment
11+
12+
Please referring to [quick start](/docs/getting-started/quick-start)
13+
1014
## Clone crane
1115

1216
Clone the repository,

site/content/en/docs/Getting started/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="tru
2929

3030
**Recommendation Framework**
3131

32-
Provide a pluggable framework for analytics and give recommendation for cloud resources, support out-of-box recommenders: Workload Resources/Replicas, Idle Resources.
32+
Provide a pluggable framework for analytics and give recommendation for cloud resources, support out-of-box recommenders: Workload Resources/Replicas, Idle Resources. [learn more](/docs/tutorials/recommendation).
3333

3434
**Prediction-driven Horizontal Autoscaling**
3535

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
---
3+
title: "Recommendation"
4+
weight: 10
5+
description: >
6+
Docs for Recommendation.
7+
---

0 commit comments

Comments
 (0)