Skip to content

Commit 3278e3e

Browse files
authored
Merge pull request #277 from bytedance/update-values
Update chart values and template
2 parents 9931050 + 20f13a9 commit 3278e3e

File tree

15 files changed

+75
-119
lines changed

15 files changed

+75
-119
lines changed

docs/getting_started/installation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ You can enable metrics to monitor the operation of vArmor. All metrics are expos
7373
--set metrics.enabled=true
7474
```
7575

76-
You can use the following command to create a `ServiceMonitor` object in the namespace where vArmor is installed. Default: disabled.
77-
78-
```bash
79-
--set metrics.serviceMonitorEnabled=true
80-
```
76+
If the `monitoring.coreos.com/v1` API is available in the cluster, vArmor will automatically create a `ServiceMonitor` object during deployment for integration with Prometheus.
8177

8278
#### Set the Log Output Format to JSON
8379
The default format of agent and manager is TEXT. You can use the following command to set it to JSON.
@@ -122,7 +118,7 @@ The feature extends network access control to restrict container access to speci
122118
The feature is currently only supported by the BPF enforcer and requires Kubernetes v1.21 or higher.
123119

124120
#### Run Agent in HostNetwork Mode
125-
The agent runs in its own network namespace and exposes the readinessProbe on port `6080` by default. If you want to run it in the host's network namespace, you can use following options.
121+
The agent runs in its own network namespace and exposes the readinessProbe on port `9580` by default. If you want to run it in the host's network namespace, you can use following options.
126122

127123
```bash
128124
--set agent.network.hostNetwork=true \

docs/getting_started/installation.zh_CN.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ vArmor 顺序检查系统的审计日志是否存在,并通过监控第一个
7272
--set metrics.enabled=true
7373
```
7474

75-
您可以使用下面的选项在 vArmor 所在命名空间中创建 `ServiceMonitor` 对象,用于与 Prometheus 集成。默认值:关闭。
76-
77-
```bash
78-
--set metrics.serviceMonitorEnabled=true
79-
```
75+
如果您的集群支持 `monitoring.coreos.com/v1` API,vArmor 会在部署时自动创建一个 `ServiceMonitor` 对象,用于与 Prometheus 集成。
8076

8177
#### 设置日志格式为 JSON
8278
Agent 和 Manager 的日志格式默认为文本格式,您可以使用下面的选项将其设置为 JSON 格式。
@@ -122,7 +118,7 @@ vArmor 只会对包含此 label 的 Workloads 开启沙箱防护。你可以使
122118
当前仅 BPF enforcer 支持此功能,并且需要 Kubernetes v1.21 及以上版本。
123119

124120
#### 在宿主机网络命名空间中运行 Agent
125-
vArmor 的 Agent 默认运行在独立的网络命名空间中,并在端口 `6080` 暴露就绪探针。如果您想将其部署在宿主网络命名空间中,那么可以使用下面的选项进行配置。
121+
vArmor 的 Agent 默认运行在独立的网络命名空间中,并在端口 `9580` 暴露就绪探针。如果您想将其部署在宿主网络命名空间中,那么可以使用下面的选项进行配置。
126122

127123
```bash
128124
--set agent.network.hostNetwork=true \

docs/getting_started/metrics.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ vArmor now includes a comprehensive metrics system. This document describes the
1515
2. Install vArmor with metrics enabled:
1616
```bash
1717
helm install varmor varmor/varmor \
18-
--set metrics.enable=true \
19-
--set metrics.serviceMonitorEnabled=true
18+
--set metrics.enable=true
2019
```
2120

2221
3. Import Grafana dashboard:
@@ -26,20 +25,11 @@ vArmor now includes a comprehensive metrics system. This document describes the
2625
- Select the appropriate Prometheus data source
2726
- Click Import to finish
2827

29-
## Enabling Metrics
30-
To enable the metrics system:
31-
1. Set `metrics.enable` to `true` in your values configuration
32-
2. To create a Prometheus ServiceMonitor, set `metrics.serviceMonitorEnabled` to `true`
33-
34-
Once enabled, metrics are exposed at the `/metric` endpoint on port 8081 of the manager.
35-
3628
## Available Metrics
3729

3830
### Profile Processing Metrics
3931
These metrics track the status and performance of the ArmorProfile object processed by the Agent.
4032
All profile processing metrics include the following labels:
41-
- `namespace`: The namespace of the profile
42-
- `profile_name`: Name of the profile
4333
- `node_name`: Name of the node
4434

4535
| Metric Name | Type | Description |
@@ -61,11 +51,9 @@ These metrics provide insights into admission webhook operations of the Manager.
6151
#### Webhook Latency Metric
6252
The `varmor_webhook_latency` metric is a histogram that measures webhook processing latency with buckets at 0.1, 0.5, 1, 2, and 5 seconds.
6353
This metric includes the following labels:
64-
- `request_uid`: Request UID
6554
- `request_kind`: The type of workload be submitted
66-
- `request_namespace`: The namespace of workload be submitted
67-
- `request_name`: The name of workload be submitted
68-
- `request_operation`: Whether the workload be mutated by Manager or not
55+
- `request_operation`: The operation type of the request
56+
- `request_mutated`: Whether the workload be mutated by Manager or not
6957

7058
## Grafana Dashboard
7159
A pre-configured Grafana dashboard is available in the codebase for visualizing these metrics. The dashboard provides comprehensive views of both profile processing and webhook performance metrics.

docs/getting_started/metrics.zh_CN.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ vArmor 目前支持可观测性指标,本文档描述了可用的指标、配
1515
2. 安装启用了指标系统的 vArmor
1616
```bash
1717
helm install varmor varmor/varmor \
18-
--set metrics.enable=true \
19-
--set metrics.serviceMonitorEnabled=true
18+
--set metrics.enable=true
2019
```
2120

2221
3. 导入 Grafana 仪表板:
@@ -26,19 +25,10 @@ vArmor 目前支持可观测性指标,本文档描述了可用的指标、配
2625
- 选择合适的 Prometheus 数据源
2726
- 点击导入完成
2827

29-
## 启用指标系统
30-
要启用指标系统,需要:
31-
1. 在配置文件中将 `metrics.enable` 设置为 `true`
32-
2. 如需创建 Prometheus ServiceMonitor,将 `metrics.serviceMonitorEnabled` 设置为 `true`
33-
34-
启用后,指标将在 Manager 的 8081 端口的 `/metric` 端点上暴露。
35-
3628
## 可用指标
3729

3830
### 配置文件处理指标
3931
这些指标用于跟踪由 Agent 处理的 ArmorProfile 对象的状态和性能。所有配置文件处理指标包含以下标签:
40-
- `namespace`:配置文件所在的命名空间
41-
- `profile_name`:配置文件名称
4232
- `node_name`:节点名称
4333

4434
| 指标名称 | 类型 | 描述 |
@@ -60,11 +50,9 @@ vArmor 目前支持可观测性指标,本文档描述了可用的指标、配
6050
#### Webhook 延迟指标
6151
`varmor_webhook_latency` 指标是一个直方图,用于测量 webhook 处理延迟,包含 0.1、0.5、1、2 和 5 秒的区间。
6252
此指标包含以下标签:
63-
- `request_uid`:请求 UID
6453
- `request_kind`:工作负载类型
65-
- `request_namespace`:工作负载的命名空间
66-
- `request_name`:工作负载的名称
67-
- `request_operation`:工作负载是否被 Manager 变更
54+
- `request_operation`:请求操作类型
55+
- `request_mutated`:工作负载是否被 Manager 变更
6856

6957
## Grafana 仪表板
7058
代码库中提供了一个预配置的 Grafana 仪表板,用于可视化这些指标。该仪表板提供了配置文件处理和 webhook 性能指标的全面视图。

docs/guides/performance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vArmor user-space components use the resource quotas as shown in the table below
2121

2222
| Manager CPU | Manager Memory | Agent CPU | Agent Memory |
2323
|:-----------:|:--------------:|:-----------:|:------------:|
24-
| 200m / 100m | 300Mi / 200Mi | 200m / 100m | 100Mi / 40Mi (The BPF enforcer is disabled)<br />200Mi /100Mi (The BPF enforcer is enabled) |
24+
| 500m / 100m | 300Mi / 200Mi | 1 / 100m | 100Mi / 40Mi (The BPF enforcer is disabled)<br />200Mi /100Mi (The BPF enforcer is enabled) |
2525

2626
Explanation:
2727

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func getAgentReadinessPort() int {
218218
return port
219219
}
220220
}
221-
return 6080
221+
return 9580
222222
}
223223

224224
func getClassifierServicePort() int {

manifests/varmor/templates/deployments/manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,7 @@ spec:
149149
tolerations:
150150
{{- toYaml . | nindent 8 }}
151151
{{- end }}
152+
{{- with .Values.manager.topologySpreadConstraints }}
153+
topologySpreadConstraints:
154+
{{- toYaml . | nindent 6 }}
155+
{{- end }}

manifests/varmor/templates/monitor/manager-service-monitor.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitorEnabled }}
1+
{{- if .Values.metrics.enabled }}
2+
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" -}}
23
apiVersion: monitoring.coreos.com/v1
34
kind: ServiceMonitor
45
metadata:
@@ -18,4 +19,11 @@ spec:
1819
path: /metrics
1920
interval: 15s
2021
scrapeTimeout: 14s
22+
metricRelabelings:
23+
- action: keep
24+
regex: 'varmor_.*'
25+
sourceLabels: [__name__]
26+
- action: labeldrop
27+
regex: instance|service|container|endpoint
28+
{{- end }}
2129
{{- end }}

manifests/varmor/values.yaml

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ fullnameOverride: ""
1111

1212
metrics:
1313
enabled: false
14-
serviceMonitorEnabled: false
15-
# syncMetricsSecond: 10
1614

1715
restartExistWorkloads:
1816
enabled: true
@@ -154,11 +152,11 @@ manager:
154152

155153
resources:
156154
limits:
157-
cpu: 200m
158-
memory: 300Mi
155+
cpu: "500m"
156+
memory: "300Mi"
159157
requests:
160-
cpu: 100m
161-
memory: 200Mi
158+
cpu: "100m"
159+
memory: "200Mi"
162160

163161
autoscaling:
164162
enabled: false
@@ -173,6 +171,20 @@ manager:
173171

174172
tolerations: []
175173

174+
topologySpreadConstraints:
175+
- labelSelector:
176+
matchLabels:
177+
app.kubernetes.io/component: varmor-manager
178+
maxSkew: 1
179+
topologyKey: kubernetes.io/hostname
180+
whenUnsatisfiable: ScheduleAnyway
181+
- labelSelector:
182+
matchLabels:
183+
app.kubernetes.io/component: varmor-manager
184+
maxSkew: 1
185+
topologyKey: topology.kubernetes.io/zone
186+
whenUnsatisfiable: ScheduleAnyway
187+
176188

177189
agent:
178190
name: agent
@@ -210,7 +222,7 @@ agent:
210222
network:
211223
hostNetwork: false
212224
dnsPolicy: ClusterFirstWithHostNet
213-
readinessPort: 6080
225+
readinessPort: 9580
214226

215227
args: []
216228

@@ -231,22 +243,22 @@ agent:
231243
name: apparmor-dir
232244
resources:
233245
limits:
234-
cpu: 200m
235-
memory: 100Mi
246+
cpu: "1"
247+
memory: "100Mi"
236248
requests:
237-
cpu: 100m
238-
memory: 40Mi
249+
cpu: "100m"
250+
memory: "40Mi"
239251

240252
bpfLsmEnforcer:
241253
args:
242254
- --enableBpfEnforcer
243255
resources:
244256
limits:
245-
cpu: 200m
246-
memory: 200Mi
257+
cpu: "1"
258+
memory: "200Mi"
247259
requests:
248-
cpu: 100m
249-
memory: 100Mi
260+
cpu: "100m"
261+
memory: "100Mi"
250262

251263
unloadAllAaProfiles:
252264
args:
@@ -269,11 +281,11 @@ agent:
269281
name: auditdata
270282
resources:
271283
limits:
272-
cpu: 2
273-
memory: 2Gi
284+
cpu: "2"
285+
memory: "2Gi"
274286
requests:
275-
cpu: 500m
276-
memory: 500Mi
287+
cpu: "500m"
288+
memory: "500Mi"
277289

278290
bpfRelated:
279291
volumeMounts:
@@ -347,17 +359,13 @@ classifier:
347359
network:
348360
servicePort: 5000
349361

350-
resources: {}
351-
# We usually recommend not to specify default resources and to leave this as a conscious
352-
# choice for the user. This also increases chances charts run on environments with little
353-
# resources, such as Minikube. If you do want to specify resources, uncomment the following
354-
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
355-
# limits:
356-
# cpu: 100m
357-
# memory: 128Mi
358-
# requests:
359-
# cpu: 100m
360-
# memory: 128Mi
362+
resources:
363+
limits:
364+
cpu: "2"
365+
memory: "2Gi"
366+
requests:
367+
cpu: "500m"
368+
memory: "500Mi"
361369

362370
autoscaling:
363371
enabled: false

website/docs/getting_started/installation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ You can enable metrics to monitor the operation of vArmor. All metrics are expos
7777
--set metrics.enabled=true
7878
```
7979

80-
You can use the following command to create a `ServiceMonitor` object in the namespace where vArmor is installed. Default: disabled.
81-
82-
```bash
83-
--set metrics.serviceMonitorEnabled=true
84-
```
80+
If the `monitoring.coreos.com/v1` API is available in the cluster, vArmor will automatically create a `ServiceMonitor` object during deployment for integration with Prometheus.
8581

8682
#### Set the Log Output Format to JSON
8783
The default format of agent and manager is TEXT. You can use the following command to set it to JSON.
@@ -127,7 +123,7 @@ The feature extends network access control to restrict container access to speci
127123
The feature is currently only supported by the BPF enforcer and requires Kubernetes v1.21 or higher.
128124

129125
#### Run Agent in HostNetwork Mode
130-
The agent runs in its own network namespace and exposes the readinessProbe on port `6080` by default. If you want to run it in the host's network namespace, you can use following options.
126+
The agent runs in its own network namespace and exposes the readinessProbe on port `9580` by default. If you want to run it in the host's network namespace, you can use following options.
131127

132128
```bash
133129
--set agent.network.hostNetwork=true \

0 commit comments

Comments
 (0)