-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UCP: support monitor mount external configuration #2294
Changes from 8 commits
cdc9561
1b4149b
b659c07
08b16cf
d9415cc
7c9cc90
8b302f9
090e010
5beecd3
b17dbda
4b0be1c
679c19a
f66642c
4fc8ec1
4ca7926
d630a33
ceca34a
cdbb7f8
85b7ee7
72e9715
da0589f
d010960
64ad314
f4adabe
29ad5f3
956ae68
00dbfac
6eab03a
dcadeec
fbccca0
3f8d3fe
360c656
7b8eff3
161d730
b3e30a8
25e46dd
1d0a247
5b34f99
977fb31
753ab55
76354e2
432ac85
b77cba7
1eca463
1b0581d
bfcc535
cba083f
45f74b3
2bb0b81
1a7050c
6c56e84
1dc0508
5abddd4
1427471
69b2961
cf244c1
89d659e
3d1eb79
e92201e
2b5981c
58d984e
a63722d
8969ddb
ac4f2e6
a990b4b
7792dbf
4959d64
813acae
41f5823
364498a
c30ef23
1793824
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,190 @@ | ||||
# Source: tidb-cluster/templates/monitor-configmap.yaml | ||||
apiVersion: v1 | ||||
kind: ConfigMap | ||||
metadata: | ||||
name: external-config | ||||
labels: | ||||
app.kubernetes.io/name: tidb-cluster | ||||
app.kubernetes.io/managed-by: Helm | ||||
app.kubernetes.io/instance: test | ||||
app.kubernetes.io/component: monitor | ||||
helm.sh/chart: tidb-cluster-dev | ||||
data: | ||||
prometheus-config: |- | ||||
global: | ||||
scrape_interval: 15s | ||||
evaluation_interval: 15s | ||||
scrape_configs: | ||||
- job_name: 'pd' | ||||
scrape_interval: 15s | ||||
honor_labels: true | ||||
kubernetes_sd_configs: | ||||
- role: pod | ||||
namespaces: | ||||
names: | ||||
- default | ||||
scheme: http | ||||
tls_config: | ||||
insecure_skip_verify: true | ||||
relabel_configs: | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: keep | ||||
regex: test | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component] | ||||
action: keep | ||||
regex: pd | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] | ||||
action: keep | ||||
regex: true | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] | ||||
action: replace | ||||
target_label: __metrics_path__ | ||||
regex: (.+) | ||||
- source_labels: [__meta_kubernetes_pod_name, __meta_kubernetes_pod_label_app_kubernetes_io_instance, | ||||
__meta_kubernetes_pod_annotation_prometheus_io_port] | ||||
regex: (.+);(.+);(.+) | ||||
target_label: __address__ | ||||
replacement: $1.$2-pd-peer:$3 | ||||
action: replace | ||||
- source_labels: [__meta_kubernetes_namespace] | ||||
action: replace | ||||
target_label: kubernetes_namespace | ||||
- source_labels: [__meta_kubernetes_pod_node_name] | ||||
action: replace | ||||
target_label: kubernetes_node | ||||
- source_labels: [__meta_kubernetes_pod_ip] | ||||
action: replace | ||||
target_label: kubernetes_pod_ip | ||||
- source_labels: [__meta_kubernetes_pod_name] | ||||
action: replace | ||||
target_label: instance | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: replace | ||||
target_label: cluster | ||||
- job_name: 'tidb' | ||||
scrape_interval: 15s | ||||
honor_labels: true | ||||
kubernetes_sd_configs: | ||||
- role: pod | ||||
namespaces: | ||||
names: | ||||
- default | ||||
scheme: http | ||||
tls_config: | ||||
insecure_skip_verify: true | ||||
relabel_configs: | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: keep | ||||
regex: test | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component] | ||||
action: keep | ||||
regex: tidb | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] | ||||
action: keep | ||||
regex: true | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] | ||||
action: replace | ||||
target_label: __metrics_path__ | ||||
regex: (.+) | ||||
- source_labels: [__meta_kubernetes_pod_name, __meta_kubernetes_pod_label_app_kubernetes_io_instance, | ||||
__meta_kubernetes_pod_annotation_prometheus_io_port] | ||||
regex: (.+);(.+);(.+) | ||||
target_label: __address__ | ||||
replacement: $1.$2-tidb-peer:$3 | ||||
action: replace | ||||
- source_labels: [__meta_kubernetes_namespace] | ||||
action: replace | ||||
target_label: kubernetes_namespace | ||||
- source_labels: [__meta_kubernetes_pod_node_name] | ||||
action: replace | ||||
target_label: kubernetes_node | ||||
- source_labels: [__meta_kubernetes_pod_ip] | ||||
action: replace | ||||
target_label: kubernetes_pod_ip | ||||
- source_labels: [__meta_kubernetes_pod_name] | ||||
action: replace | ||||
target_label: instance | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: replace | ||||
target_label: cluster | ||||
- job_name: 'tikv' | ||||
scrape_interval: 15s | ||||
honor_labels: true | ||||
kubernetes_sd_configs: | ||||
- role: pod | ||||
namespaces: | ||||
names: | ||||
- default | ||||
scheme: http | ||||
tls_config: | ||||
insecure_skip_verify: true | ||||
# TiKV doesn't support scheme https for now. | ||||
# And we should fix it after TiKV fix this issue: https://github.com/tikv/tikv/issues/5340 | ||||
# | ||||
# scheme: http | ||||
# tls_config: | ||||
# insecure_skip_verify: true | ||||
# | ||||
relabel_configs: | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: keep | ||||
regex: test | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component] | ||||
action: keep | ||||
regex: tikv | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] | ||||
action: keep | ||||
regex: true | ||||
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] | ||||
action: replace | ||||
target_label: __metrics_path__ | ||||
regex: (.+) | ||||
- source_labels: [__meta_kubernetes_pod_name, __meta_kubernetes_pod_label_app_kubernetes_io_instance, | ||||
__meta_kubernetes_pod_annotation_prometheus_io_port] | ||||
regex: (.+);(.+);(.+) | ||||
target_label: __address__ | ||||
replacement: $1.$2-tikv-peer:$3 | ||||
action: replace | ||||
- source_labels: [__meta_kubernetes_namespace] | ||||
action: replace | ||||
target_label: kubernetes_namespace | ||||
- source_labels: [__meta_kubernetes_pod_node_name] | ||||
action: replace | ||||
target_label: kubernetes_node | ||||
- source_labels: [__meta_kubernetes_pod_ip] | ||||
action: replace | ||||
target_label: kubernetes_pod_ip | ||||
- source_labels: [__meta_kubernetes_pod_name] | ||||
action: replace | ||||
target_label: instance | ||||
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance] | ||||
action: replace | ||||
target_label: cluster | ||||
rule_files: | ||||
- '/prometheus-rules/rules/*.rules.yml' | ||||
|
||||
dashboard-config: |- | ||||
{ | ||||
"apiVersion": 1, | ||||
"providers": [ | ||||
{ | ||||
"folder": "", | ||||
"name": "0", | ||||
"options": { | ||||
"path": "/grafana-dashboard-definitions/tidb" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How to support additional dashboards for tidb monitor in this pr? We should support this as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we could also export grafana config in the configmap. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we support custom dashboards by configMap , we will need to append extra configMap to volumes and VolumeMounts . reference tidb-operator/pkg/monitor/monitor/util.go Line 312 in 7ccb528
And I think users can dynamically add dashboard in Grafana.So, this feature is not important. |
||||
}, | ||||
"orgId": 1, | ||||
"type": "file" | ||||
} | ||||
] | ||||
} | ||||
start-command: |- | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the This approach is more recommended since it can help specify something other than the start commands for Prometheus, like env vars, volumes, etc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have only support command field patch in container, other field patch I think is not important now. |
||||
/bin/prometheus | ||||
--web.enable-admin-api | ||||
--web.enable-lifecycle | ||||
--log.level=info | ||||
--config.file=/etc/prometheus/prometheus.yml | ||||
--storage.tsdb.path=/data/prometheus | ||||
--storage.tsdb.retention=12d | ||||
|
||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,13 @@ type PrometheusSpec struct { | |
Service ServiceSpec `json:"service,omitempty"` | ||
// +optional | ||
ReserveDays int `json:"reserveDays,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yisaer Not related to this pr, but I am curious about this field. So we only support retention with unit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you are right. Maybe we would create a new proper property for this in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have support custom command ,so I think |
||
// +optional | ||
Config *Configuration `json:"config,omitempty"` | ||
} | ||
|
||
// Config is the the desired state of Prometheus Configuration | ||
mikechengwei marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type Configuration struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think only |
||
ExternalConfigMap string `json:"externalConfigMap,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
} | ||
|
||
// GrafanaSpec is the desired state of grafana | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this configuration and the configuration auto-generated by tidbmonitor? I don't think we should make mounting external configuration as the default choice for tidbmonitor.