Skip to content
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

Support-Multi-version-TiDB-monitor #666

Merged
merged 11 commits into from
Jul 29, 2019

Conversation

qiffang
Copy link
Contributor

@qiffang qiffang commented Jul 18, 2019

What problem does this PR solve?

In this PR, it contains 3 functions

  1. Support multi TiDB version
  2. Support to dynamic reload rules
  3. Update monitor deployment Strategy

1.TiDB multi version
In this PR, Every TiDB has own monitor initializer image.
And the docker receive 4 variables

GF_PROVISIONING_PATH // grafana provisioning path
TIDB_CLUSTER_NAME // TiDB cluster name
TIDB_ENABLE_BINLOG // whether enable binlog
PROM_CONFIG_PATH // proemtheus rules config path

TiDB Operator use the new monitor way to replace the old.

2.Dynamic update alert rules
In reload, it support a UI to update alert rules and it will call reload of Promtheus.
The UI likes this
image

  1. Update strategy with ReCreate.

What is changed and how does it work?

Delete the old way and import a tidb-monitor-initializer image to init grafana dashboards and prometheus rules.

Check List

Tests

  • TiDB Cluster dashboards work well and ClusterName is replaced successful.
  • Promethes rules work well and ClusterName is replaced successful.
  • Alert rule can be updated dynamic.
  • Monitor deployment strategy is updated successful.

Related changes

  • Need to update the documentation

Does this PR introduce a user-facing change?:

Action required: Users should migrate the configs in values.yaml of previous chart releases to the new values.yaml of the new chart. Otherwise, the monitor pods will be failed when upgrading monitor with the new chart.
For example, configs in old values.yaml:
monitor:
 create: true
 # Also see rbac.create
 # If you set rbac.create to false, you need to provide a value here.
 # If you set rbac.create to true, you should leave this empty.
 # serviceAccount:
 persistent: false
 storageClassName: local-storage
 storage: 10Gi
 grafana:
   ...
 prometheus:
   image: prom/prometheus:v2.2.1
   ...

After migration, new values.yaml should be as below:
monitor:
 create: true
 # Also see rbac.create
 # If you set rbac.create to false, you need to provide a value here.
 # If you set rbac.create to true, you should leave this empty.
 # serviceAccount:
 persistent: false
 storageClassName: local-storage
 storage: 10Gi
 initializer:
   image: pingcap/tidb-monitor-initializer:v3.0.0
   imagePullPolicy: IfNotPresent
   reloader:
   create: true
   image: pingcap/tidb-monitor-reloader:v1.0.0
   imagePullPolicy: IfNotPresent
   service:
     type: NodePort
 grafana:
   ...
 prometheus:
   image: prom/prometheus:v2.11.1
   ...

charts/tidb-cluster/values.yaml Show resolved Hide resolved
@@ -330,6 +330,10 @@ monitor:
persistent: false
storageClassName: local-storage
storage: 10Gi
initializer:
create: true
image: pingcap/tidb-monitor-initializer:v3.0.0-rc.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ docker pull pingcap/tidb-monitor-initializer:v3.0.0-rc.1
Error response from daemon: pull access denied for pingcap/tidb-monitor-initializer, repository does not exist or may require 'docker login'

Copy link
Contributor Author

@qiffang qiffang Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/pingcap/monitoring The images here are note uploaded to DockerHub yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values in other places like test, terraform also have to be updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have a CI check to tell us that terraform values are out of date.

@weekface
Copy link
Contributor

/run-e2e-tests

@weekface weekface added this to the v1.0.0 milestone Jul 18, 2019
@@ -181,23 +185,10 @@ spec:
- key: dashboard-config
path: dashboards.yaml
name: dashboards-provisioning
- emptyDir: {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to use the same directory as the data directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数据目录是 PV,配置不需要PV

Signed-off-by: qiffang <947321353@qq.com>
@@ -11,6 +11,9 @@ metadata:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
spec:
replicas: 1
strategy:
type: Recreate
rollingUpdate: null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove这个会有问题

Error: UPGRADE FAILED: Deployment.apps “tikv200-monitor” is invalid: spec.strategy.rollingUpdate: Forbidden: may not be specified when strategy `type` is ‘Recreate’

需要显示把这个置为null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@weekface
Copy link
Contributor

/run-e2e-tests

@tennix
Copy link
Member

tennix commented Jul 25, 2019

/run-e2e-tests

value: /grafana-dashboard-definitions/tidb
- name: TIDB_CLUSTER_NAME
value: {{ template "cluster.name" . }}
- name: TIDB_ENABLE_BINLOG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this env? TIDB_ENABLE_BINLOG

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env is used to decide whether Grafana show BinLog dashboard.

weekface
weekface previously approved these changes Jul 25, 2019
Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: qiffang <947321353@qq.com>
Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tennix
Copy link
Member

tennix commented Jul 29, 2019

/run-e2e-tests

@tennix tennix merged commit 5a227d8 into pingcap:master Jul 29, 2019
weekface pushed a commit that referenced this pull request Jul 29, 2019
yahonda pushed a commit that referenced this pull request Dec 27, 2021
Signed-off-by: Ran <huangran@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants