-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into yinliang/modify-br-tls
- Loading branch information
Showing
12 changed files
with
373 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,27 @@ spec: | |
emptyDir: {} | ||
''' | ||
|
||
// Able to override default values in Jenkins job via environment variables. | ||
if (!env.DEFAULT_GIT_REF) { | ||
env.DEFAULT_GIT_REF = "master" | ||
} | ||
|
||
if (!env.DEFAULT_GINKGO_NODES) { | ||
env.DEFAULT_GINKGO_NODES = "8" | ||
} | ||
|
||
if (!env.DEFAULT_E2E_ARGS) { | ||
env.DEFAULT_E2E_ARGS = "--ginkgo.skip='\\[Serial\\]|\\[Stability\\]' --ginkgo.focus='\\[tidb-operator\\]'" | ||
} | ||
|
||
if (!env.DEFAULT_CLUSTER) { | ||
env.DEFAULT_CLUSTER = "jenkins-tidb-operator-e2e" | ||
} | ||
|
||
if (!env.DEFAULT_AWS_REGION) { | ||
env.DEFAULT_AWS_REGION = "us-west-2" | ||
} | ||
|
||
pipeline { | ||
agent { | ||
kubernetes { | ||
|
@@ -50,16 +71,17 @@ pipeline { | |
} | ||
|
||
options { | ||
timeout(time: 3, unit: 'HOURS') | ||
timeout(time: 3, unit: 'HOURS') | ||
} | ||
|
||
parameters { | ||
string(name: 'GIT_URL', defaultValue: '[email protected]:pingcap/tidb-operator.git', description: 'git repo url') | ||
string(name: 'GIT_REF', defaultValue: 'master', description: 'git ref spec to checkout, e.g. master, release-1.1') | ||
string(name: 'GIT_REF', defaultValue: env.DEFAULT_GIT_REF, description: 'git ref spec to checkout, e.g. master, release-1.1') | ||
string(name: 'PR_ID', defaultValue: '', description: 'pull request ID, this will override GIT_REF if set, e.g. 1889') | ||
string(name: 'CLUSTER', defaultValue: 'jenkins-tidb-operator-e2e', description: 'the name of the cluster') | ||
string(name: 'AWS_REGION', defaultValue: 'us-west-2', description: 'the AWS region') | ||
string(name: 'GINKGO_NODES', defaultValue: '8', description: 'the number of ginkgo nodes') | ||
string(name: 'GINKGO_NODES', defaultValue: env.DEFAULT_GINKGO_NODES, description: 'the number of ginkgo nodes') | ||
string(name: 'E2E_ARGS', defaultValue: env.DEFAULT_E2E_ARGS, description: "e2e args, e.g. --ginkgo.focus='\\[Stability\\]'") | ||
string(name: 'CLUSTER', defaultValue: env.DEFAULT_CLUSTER, description: 'the name of the cluster') | ||
string(name: 'AWS_REGION', defaultValue: env.DEFAULT_AWS_REGION, description: 'the AWS region') | ||
} | ||
|
||
environment { | ||
|
@@ -117,7 +139,7 @@ pipeline { | |
echo "info: try to clean the cluster created previously" | ||
./ci/aws-clean-eks.sh \$CLUSTER | ||
echo "info: begin to run e2e" | ||
./hack/e2e.sh -- --ginkgo.skip='\\[Serial\\]' --ginkgo.focus='\\[tidb-operator\\]' | ||
./hack/e2e.sh -- ${params.E2E_ARGS} | ||
""" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,31 @@ spec: | |
emptyDir: {} | ||
''' | ||
|
||
// Able to override default values in Jenkins job via environment variables. | ||
if (!env.DEFAULT_GIT_REF) { | ||
env.DEFAULT_GIT_REF = "master" | ||
} | ||
|
||
if (!env.DEFAULT_GINKGO_NODES) { | ||
env.DEFAULT_GINKGO_NODES = "8" | ||
} | ||
|
||
if (!env.DEFAULT_E2E_ARGS) { | ||
env.DEFAULT_E2E_ARGS = "--ginkgo.skip='\\[Serial\\]|\\[Stability\\]' --ginkgo.focus='\\[tidb-operator\\]'" | ||
} | ||
|
||
if (!env.DEFAULT_CLUSTER) { | ||
env.DEFAULT_CLUSTER = "jenkins-tidb-operator-e2e" | ||
} | ||
|
||
if (!env.DEFAULT_GCP_PROJECT) { | ||
env.DEFAULT_GCP_PROJECT = "" | ||
} | ||
|
||
if (!env.DEFAULT_GCP_ZONE) { | ||
env.DEFAULT_GCP_ZONE = "us-central1-b" | ||
} | ||
|
||
pipeline { | ||
agent { | ||
kubernetes { | ||
|
@@ -50,17 +75,18 @@ pipeline { | |
} | ||
|
||
options { | ||
timeout(time: 3, unit: 'HOURS') | ||
timeout(time: 3, unit: 'HOURS') | ||
} | ||
|
||
parameters { | ||
string(name: 'GIT_URL', defaultValue: '[email protected]:pingcap/tidb-operator.git', description: 'git repo url') | ||
string(name: 'GIT_REF', defaultValue: 'master', description: 'git ref spec to checkout, e.g. master, release-1.1') | ||
string(name: 'GIT_REF', defaultValue: env.DEFAULT_GIT_REF, description: 'git ref spec to checkout, e.g. master, release-1.1') | ||
string(name: 'PR_ID', defaultValue: '', description: 'pull request ID, this will override GIT_REF if set, e.g. 1889') | ||
string(name: 'CLUSTER', defaultValue: 'jenkins-tidb-operator-e2e', description: 'the name of the cluster') | ||
string(name: 'GCP_PROJECT', defaultValue: 'smooth-tendril-207212', description: 'the GCP project ID') | ||
string(name: 'GCP_ZONE', defaultValue: 'us-central1-b', description: 'the GCP zone') | ||
string(name: 'GINKGO_NODES', defaultValue: '8', description: 'the number of ginkgo nodes') | ||
string(name: 'GINKGO_NODES', defaultValue: env.DEFAULT_GINKGO_NODES, description: 'the number of ginkgo nodes') | ||
string(name: 'E2E_ARGS', defaultValue: env.DEFAULT_E2E_ARGS, description: "e2e args, e.g. --ginkgo.focus='\\[Stability\\]'") | ||
string(name: 'CLUSTER', defaultValue: env.DEFAULT_CLUSTER, description: 'the name of the cluster') | ||
string(name: 'GCP_PROJECT', defaultValue: env.DEFAULT_GCP_PROJECT, description: 'the GCP project ID') | ||
string(name: 'GCP_ZONE', defaultValue: env.DEFAULT_GCP_ZONE, description: 'the GCP zone') | ||
} | ||
|
||
environment { | ||
|
@@ -120,7 +146,7 @@ pipeline { | |
echo "info: try to clean the cluster created previously" | ||
SKIP_BUILD=y SKIP_IMAGE_BUILD=y SKIP_UP=y SKIP_TEST=y ./hack/e2e.sh | ||
echo "info: begin to run e2e" | ||
./hack/e2e.sh -- --ginkgo.skip='\\[Serial\\]' --ginkgo.focus='\\[tidb-operator\\]' | ||
./hack/e2e.sh -- ${params.E2E_ARGS} | ||
""" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Deploying TidbCluster with Auto-scaling | ||
|
||
> **Note:** | ||
> | ||
> This setup is for test or demo purpose only and **IS NOT** applicable for critical environment. Refer to the [Documents](https://pingcap.com/docs/stable/tidb-in-kubernetes/deploy/prerequisites/) for production setup. | ||
|
||
The following steps will create a TiDB cluster with monitoring and auto-scaler, the monitoring data is not persisted by default. | ||
|
||
**Prerequisites**: | ||
- Has TiDB operator `v1.1.0-beta.2` or higher version installed. [Doc](https://pingcap.com/docs/stable/tidb-in-kubernetes/deploy/tidb-operator/) | ||
- Has default `StorageClass` configured, and there are enough PVs (by default, 6 PVs are required) of that storageClass: | ||
|
||
This could be verified by the following command: | ||
|
||
```bash | ||
> kubectl get storageclass | ||
``` | ||
|
||
The output is similar to this: | ||
|
||
```bash | ||
NAME PROVISIONER AGE | ||
standard (default) kubernetes.io/gce-pd 1d | ||
gold kubernetes.io/gce-pd 1d | ||
``` | ||
|
||
Alternatively, you could specify the storageClass explicitly by modifying `tidb-cluster.yaml`. | ||
|
||
|
||
## Enabling Auto-scaling | ||
|
||
> **Note:** | ||
> | ||
> The Auto-scaling feature is still in alpha, you should enable this feature in TiDB Operator by setting values.yaml: | ||
```yaml | ||
features: | ||
AutoScaling=true | ||
``` | ||
Auto-scale the cluster based on CPU load | ||
```bash | ||
> kubectl -n <namespace> apply -f ./ | ||
``` | ||
|
||
## Destroy | ||
|
||
```bash | ||
> kubectl -n <namespace> delete -f ./ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: pingcap.com/v1alpha1 | ||
kind: TidbClusterAutoScaler | ||
metadata: | ||
name: auto-scaling-demo | ||
spec: | ||
cluster: | ||
name: auto-scaling-demo | ||
monitor: | ||
name: auto-scaling-demo | ||
tikv: | ||
minReplicas: 3 | ||
maxReplicas: 4 | ||
metricsTimeDuration: "1m" | ||
metrics: | ||
- type: "Resource" | ||
resource: | ||
name: "cpu" | ||
target: | ||
type: "Utilization" | ||
averageUtilization: 80 | ||
tidb: | ||
minReplicas: 2 | ||
maxReplicas: 3 | ||
metricsTimeDuration: "1m" | ||
metrics: | ||
- type: "Resource" | ||
resource: | ||
name: "cpu" | ||
target: | ||
type: "Utilization" | ||
averageUtilization: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: pingcap.com/v1alpha1 | ||
kind: TidbCluster | ||
metadata: | ||
name: auto-scaling-demo | ||
spec: | ||
version: v3.0.8 | ||
timezone: UTC | ||
pvReclaimPolicy: Delete | ||
pd: | ||
baseImage: pingcap/pd | ||
replicas: 3 | ||
requests: | ||
storage: "1Gi" | ||
config: {} | ||
tikv: | ||
baseImage: pingcap/tikv | ||
replicas: 3 | ||
requests: | ||
storage: "1Gi" | ||
config: {} | ||
tidb: | ||
baseImage: pingcap/tidb | ||
replicas: 2 | ||
service: | ||
type: ClusterIP | ||
config: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: pingcap.com/v1alpha1 | ||
kind: TidbMonitor | ||
metadata: | ||
name: auto-scaling-demo | ||
spec: | ||
clusters: | ||
- name: auto-scaling-demo | ||
prometheus: | ||
baseImage: prom/prometheus | ||
version: v2.11.1 | ||
grafana: | ||
baseImage: grafana/grafana | ||
version: 6.0.1 | ||
initializer: | ||
baseImage: pingcap/tidb-monitor-initializer | ||
version: v3.0.5 | ||
reloader: | ||
baseImage: pingcap/tidb-monitor-reloader | ||
version: v1.0.1 | ||
imagePullPolicy: IfNotPresent |
Oops, something went wrong.