Skip to content

Commit

Permalink
Merge branch 'release-1.0' into automated-cherry-pick-of-pingcap#1229-…
Browse files Browse the repository at this point in the history
…release-1.0
  • Loading branch information
weekface authored Nov 26, 2019
2 parents 47c14ae + b04559f commit baace6b
Show file tree
Hide file tree
Showing 72 changed files with 1,884 additions and 333 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ci

on:
pull_request:
branches:
- master
- release-*

jobs:

verify:
runs-on: ubuntu-18.04
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
fetch-depth: 1
path: go/src/github.com/pingcap/tidb-operator

- name: Basic checks
run: |
# workaround for https://github.com/actions/setup-go/issues/14
export GOPATH=/home/runner/work/tidb-operator/go
export PATH=$PATH:$GOPATH/bin
make check-setup
echo $GOPATH
ls $GOPATH/bin
make check
- name: Build binaries and images
run: make docker e2e-docker cli
- name: Unit Tests
run: make test
91 changes: 90 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,92 @@
# TiDB Operator v1.0.4 Release Notes

## v1.0.4 What's New

### Action Required

There is no action required if you are upgrading from [v1.0.3](#tidb-operator-v103-release-notes).

### Highlights

[#1202](https://github.com/pingcap/tidb-operator/pull/1202) introduced `HostNetwork` support, which offers better performance compared to the Pod network. Check out our [benchmark report](https://pingcap.com/docs/dev/benchmark/sysbench-in-k8s/#pod-network-vs-host-network) for details.

> **Note:**
>
> Due to [this issue of Kubernetes](https://github.com/kubernetes/kubernetes/issues/78420), the Kubernetes cluster must be one of the following versions to enable `HostNetwork` of the TiDB cluster:
> - `v1.13.11` or later
> - `v1.14.7` or later
> - `v1.15.4` or later
> - any version since `v1.16.0`
[#1175](https://github.com/pingcap/tidb-operator/pull/1175) added the `podSecurityContext` support for TiDB cluster Pods. We recommend setting the namespaced kernel parameters for TiDB cluster Pods according to our [Environment Recommendation](https://pingcap.com/docs/dev/tidb-in-kubernetes/deploy/prerequisites/#the-configuration-of-kernel-parameters).

New Helm chart `tidb-lightning` brings [TiDB Lightning](https://pingcap.com/docs/stable/reference/tools/tidb-lightning/overview/) support for TiDB in Kubernetes. Check out the [document](https://pingcap.com/docs/dev/tidb-in-kubernetes/maintain/lightning/) for detailed user guide.

Another new Helm chart `tidb-drainer` brings multiple drainers support for TiDB Binlog in Kubernetes. Check out the [document](https://pingcap.com/docs/dev/tidb-in-kubernetes/maintain/tidb-binlog/#deploy-multiple-drainers) for detailed user guide.

### Improvements

- Support HostNetwork ([#1202](https://github.com/pingcap/tidb-operator/pull/1202))
- Support configuring sysctls for Pods and enable net.* ([#1175](https://github.com/pingcap/tidb-operator/pull/1175))
- Add tidb-lightning support ([#1161](https://github.com/pingcap/tidb-operator/pull/1161))
- Add new helm chart tidb-drainer to support multiple drainers ([#1160](https://github.com/pingcap/tidb-operator/pull/1160))

## Detailed Bug Fixes and Changes

- Add e2e scripts and simplify the e2e Jenkins file ([#1174](https://github.com/pingcap/tidb-operator/pull/1174))
- Fix the pump/drainer data directory to avoid data loss caused by bad configuration ([#1183](https://github.com/pingcap/tidb-operator/pull/1183))
- Add init sql case to e2e ([#1199](https://github.com/pingcap/tidb-operator/pull/1199))
- Keep the instance label of drainer same with the TiDB cluster in favor of monitoring ([#1170](https://github.com/pingcap/tidb-operator/pull/1170))
- Set `podSecuriyContext` to nil by default in favor of backward compatibility ([#1184](https://github.com/pingcap/tidb-operator/pull/1184))

## Additional Notes for Users of v1.1.0.alpha branch

For historical reasons, `v1.1.0.alpha` is a hot-fix branch and got this name by mistake. All fixes in that branch are cherry-picked to `v1.0.4` and the `v1.1.0.alpha` branch will be discarded to keep things clear.

We strongly recommend you to upgrade to `v1.0.4` if you are using any version under `v1.1.0.alpha`.

`v1.0.4` introduces the following fixes comparing to `v1.1.0.alpha.3`:

- Support HostNetwork ([#1202](https://github.com/pingcap/tidb-operator/pull/1202))
- Add the permit host option for tidb-initializer job ([#779](https://github.com/pingcap/tidb-operator/pull/779))
- Fix drainer misconfiguration in tidb-cluster chart ([#945](https://github.com/pingcap/tidb-operator/pull/945))
- Set the default `externalTrafficPolicy` to be Local for TiDB services ([#960](https://github.com/pingcap/tidb-operator/pull/960))
- Fix tidb-operator crash when users modify sts upgrade strategy improperly ([#969](https://github.com/pingcap/tidb-operator/pull/969))
- Add the `maxFailoverCount` limit to TiKV ([#976](https://github.com/pingcap/tidb-operator/pull/976))
- Fix values file customization for tidb-operator on aliyun ([#983](https://github.com/pingcap/tidb-operator/pull/983))
- Do not limit failover count when maxFailoverCount = 0 ([#978](https://github.com/pingcap/tidb-operator/pull/978))
- Suspend the `ReplaceUnhealthy` process for TiKV auto-scaling-group on AWS ([#1027](https://github.com/pingcap/tidb-operator/pull/1027))
- Fix the issue that the `create_tidb_cluster_release` variable does not work ([#1066](https://github.com/pingcap/tidb-operator/pull/1066)))
- Add `v1` to statefulset apiVersions ([#1056](https://github.com/pingcap/tidb-operator/pull/1056))
- Add timezone support ([#1126](https://github.com/pingcap/tidb-operator/pull/1027))

# TiDB Operator v1.0.3 Release Notes

## v1.0.3 What's New

### Action Required

ACTION REQUIRED: This release upgrades default TiDB version to `v3.0.5` which fixed a serious [bug](https://github.com/pingcap/tidb/pull/12597) in TiDB. So if you are using TiDB `v3.0.4` or prior versions, you **must** upgrade to `v3.0.5`.

ACTION REQUIRED: This release adds the `timezone` support for [all charts](https://github.com/pingcap/tidb-operator/tree/master/charts).

For existing TiDB clusters. If the `timezone` in `tidb-cluster/values.yaml` has been customized to other timezones instead of the default `UTC`, then upgrading tidb-operator will trigger a rolling update for the related pods.

The related pods include `pump`, `drainer`, `dicovery`, `monitor`, `scheduled backup`, `tidb-initializer`, and `tikv-importer`.

The time zone for all images maintained by `tidb-operator` should be `UTC`. If you use your own images, you need to make sure that the corresponding time zones are `UTC`.

### Improvements

- Add the `timezone` support for all containers of the TiDB cluster
- Support configuring resource requests and limits for all containers of the TiDB cluster

## Detailed Bug Fixes and Changes

- Upgrade default TiDB version to `v3.0.5` ([#1132](https://github.com/pingcap/tidb-operator/pull/1132))
- Add the `timezone` support for all containers of the TiDB cluster ([#1122](https://github.com/pingcap/tidb-operator/pull/1122))
- Support configuring resource requests and limits for all containers of the TiDB cluster ([#853](https://github.com/pingcap/tidb-operator/pull/853))

# TiDB Operator v1.0.2 Release Notes

## v1.0.2 What's New
Expand Down Expand Up @@ -257,7 +346,7 @@ The `monitor` section in new `values.yaml`:
monitor:
create: true
initializer:
image: pingcap/tidb-monitor-initializer:v3.0.1
image: pingcap/tidb-monitor-initializer:v3.0.5
imagePullPolicy: IfNotPresent
reloader:
create: true
Expand Down
48 changes: 31 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ DOCKER_REGISTRY := $(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY),localhost:5000)

GOVER_MAJOR := $(shell go version | sed -E -e "s/.*go([0-9]+)[.]([0-9]+).*/\1/")
GOVER_MINOR := $(shell go version | sed -E -e "s/.*go([0-9]+)[.]([0-9]+).*/\2/")
GO111 := $(shell [ $(GOVER_MAJOR) -gt 1 ] || [ $(GOVER_MAJOR) -eq 1 ] && [ $(GOVER_MINOR) -ge 11 ]; echo $$?)
ifeq ($(GO111), 1)
$(error Please upgrade your Go compiler to 1.11 or higher version)
GO113 := $(shell [ $(GOVER_MAJOR) -gt 1 ] || [ $(GOVER_MAJOR) -eq 1 ] && [ $(GOVER_MINOR) -ge 13 ]; echo $$?)
ifeq ($(GO113), 1)
$(error Please upgrade your Go compiler to 1.13 or higher version)
endif

GOOS := $(if $(GOOS),$(GOOS),linux)
GOARCH := $(if $(GOARCH),$(GOARCH),amd64)
GOENV := GO15VENDOREXPERIMENT="1" GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH)
GO := $(GOENV) go build
GO := $(GOENV) go build -trimpath
GOTEST := CGO_ENABLED=0 GO111MODULE=on go test -v -cover

IMAGE_TAG ?= latest
PACKAGE_LIST := go list ./... | grep -vE "pkg/client" | grep -vE "zz_generated"
PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|github.com/pingcap/tidb-operator/||'
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
Expand All @@ -26,10 +27,15 @@ TEST_COVER_PACKAGES:=go list ./pkg/... | grep -vE "pkg/client" | grep -vE "pkg/t
default: build

docker-push: docker
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator:latest"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator:${IMAGE_TAG}"

ifeq ($(NO_BUILD),y)
docker:
@echo "NO_BUILD=y, skip build for $@"
else
docker: build
docker build --tag "${DOCKER_REGISTRY}/pingcap/tidb-operator:latest" images/tidb-operator
endif
docker build --tag "${DOCKER_REGISTRY}/pingcap/tidb-operator:${IMAGE_TAG}" images/tidb-operator

build: controller-manager scheduler discovery admission-controller

Expand All @@ -50,9 +56,14 @@ e2e-setup:
@GO111MODULE=on CGO_ENABLED=0 go get github.com/onsi/[email protected]

e2e-docker-push: e2e-docker
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator-e2e:latest"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator-e2e:${IMAGE_TAG}"

ifeq ($(NO_BUILD),y)
e2e-docker:
@echo "NO_BUILD=y, skip build for $@"
else
e2e-docker: e2e-build
endif
[ -d tests/images/e2e/tidb-operator ] && rm -r tests/images/e2e/tidb-operator || true
[ -d tests/images/e2e/tidb-cluster ] && rm -r tests/images/e2e/tidb-cluster || true
[ -d tests/images/e2e/tidb-backup ] && rm -r tests/images/e2e/tidb-backup || true
Expand All @@ -61,19 +72,22 @@ e2e-docker: e2e-build
cp -r charts/tidb-cluster tests/images/e2e
cp -r charts/tidb-backup tests/images/e2e
cp -r manifests tests/images/e2e
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-operator-e2e:latest" tests/images/e2e
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-operator-e2e:${IMAGE_TAG}" tests/images/e2e

e2e-build: e2e-setup
$(GO) -ldflags '$(LDFLAGS)' -o tests/images/e2e/bin/e2e tests/cmd/e2e/main.go

e2e:
./hack/e2e.sh

stability-test-build:
$(GO) -ldflags '$(LDFLAGS)' -o tests/images/stability-test/bin/stability-test tests/cmd/stability/*.go

stability-test-docker: stability-test-build
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-operator-stability-test:latest" tests/images/stability-test
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-operator-stability-test:${IMAGE_TAG}" tests/images/stability-test

stability-test-push: stability-test-docker
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator-stability-test:latest"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-operator-stability-test:${IMAGE_TAG}"

fault-trigger:
$(GO) -ldflags '$(LDFLAGS)' -o tests/images/fault-trigger/bin/fault-trigger tests/cmd/fault-trigger/*.go
Expand Down Expand Up @@ -139,16 +153,16 @@ cli:
$(GO) -ldflags '$(LDFLAGS)' -o tkctl cmd/tkctl/main.go

debug-docker-push: debug-build-docker
docker push "${DOCKER_REGISTRY}/pingcap/debug-launcher:latest"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-control:latest"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-debug:latest"
docker push "${DOCKER_REGISTRY}/pingcap/debug-launcher:${IMAGE_TAG}"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-control:${IMAGE_TAG}"
docker push "${DOCKER_REGISTRY}/pingcap/tidb-debug:${IMAGE_TAG}"

debug-build-docker: debug-build
docker build -t "${DOCKER_REGISTRY}/pingcap/debug-launcher:latest" misc/images/debug-launcher
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-control:latest" misc/images/tidb-control
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-debug:latest" misc/images/tidb-debug
docker build -t "${DOCKER_REGISTRY}/pingcap/debug-launcher:${IMAGE_TAG}" misc/images/debug-launcher
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-control:${IMAGE_TAG}" misc/images/tidb-control
docker build -t "${DOCKER_REGISTRY}/pingcap/tidb-debug:${IMAGE_TAG}" misc/images/tidb-debug

debug-build:
$(GO) -ldflags '$(LDFLAGS)' -o misc/images/debug-launcher/bin/debug-launcher misc/cmd/debug-launcher/main.go

.PHONY: check check-setup check-all build e2e-build debug-build cli
.PHONY: check check-setup check-all build e2e-build debug-build cli e2e
14 changes: 14 additions & 0 deletions charts/tidb-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,17 @@ drainer-config: |-
{{- define "drainer-configmap.data-digest" -}}
{{ include "drainer-configmap.data" . | sha256sum | trunc 8 }}
{{- end -}}

{{/*
Encapsulate tikv-importer configmap data for consistent digest calculation
*/}}
{{- define "importer-configmap.data" -}}
config-file: |-
{{- if .Values.importer.config }}
{{ .Values.importer.config | indent 2 }}
{{- end -}}
{{- end -}}

{{- define "importer-configmap.data-digest" -}}
{{ include "importer-configmap.data" . | sha256sum | trunc 8 }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ done
-config=/etc/drainer/drainer.toml \
-disable-detect={{ .Values.binlog.drainer.disableDetect | default false }} \
-initial-commit-ts={{ .Values.binlog.drainer.initialCommitTs | default 0 }} \
-data-dir=/data \
-log-file=
6 changes: 4 additions & 2 deletions charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ then
tail -f /dev/null
fi

# Use HOSTNAME if POD_NAME is unset for backward compatibility.
POD_NAME=${POD_NAME:-$HOSTNAME}
# the general form of variable PEER_SERVICE_NAME is: "<clusterName>-pd-peer"
cluster_name=`echo ${PEER_SERVICE_NAME} | sed 's/-pd-peer//'`
domain="${HOSTNAME}.${PEER_SERVICE_NAME}.${NAMESPACE}.svc"
domain="${POD_NAME}.${PEER_SERVICE_NAME}.${NAMESPACE}.svc"
discovery_url="${cluster_name}-discovery.${NAMESPACE}.svc:10261"
encoded_domain_url=`echo ${domain}:2380 | base64 | tr "\n" " " | sed "s/ //g"`

Expand All @@ -57,7 +59,7 @@ while true; do
done

ARGS="--data-dir=/var/lib/pd \
--name=${HOSTNAME} \
--name=${POD_NAME} \
--peer-urls=http://0.0.0.0:2380 \
--advertise-peer-urls=http://${domain}:2380 \
--client-urls=http://0.0.0.0:2379 \
Expand Down
1 change: 1 addition & 0 deletions charts/tidb-cluster/templates/scripts/_start_pump.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -euo pipefail
-L={{ .Values.binlog.pump.logLevel | default "info" }} \
-advertise-addr=`echo ${HOSTNAME}`.{{ template "cluster.name" . }}-pump:8250 \
-config=/etc/pump/pump.toml \
-data-dir=/data \
-log-file=

if [ $? == 0 ]; then
Expand Down
4 changes: 3 additions & 1 deletion charts/tidb-cluster/templates/scripts/_start_tikv.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ then
tail -f /dev/null
fi

# Use HOSTNAME if POD_NAME is unset for backward compatibility.
POD_NAME=${POD_NAME:-$HOSTNAME}
ARGS="--pd=${CLUSTER_NAME}-pd:2379 \
--advertise-addr=${HOSTNAME}.${HEADLESS_SERVICE_NAME}.${NAMESPACE}.svc:20160 \
--advertise-addr=${POD_NAME}.${HEADLESS_SERVICE_NAME}.${NAMESPACE}.svc:20160 \
--addr=0.0.0.0:20160 \
--status-addr=0.0.0.0:20180 \
--data-dir=/var/lib/tikv \
Expand Down
15 changes: 15 additions & 0 deletions charts/tidb-cluster/templates/tidb-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ spec:
annotations:
{{ toYaml .Values.pd.annotations | indent 6 }}
{{- end }}
{{- if .Values.pd.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.pd.podSecurityContext | indent 6}}
{{- end }}
hostNetwork: {{ .Values.pd.hostNetwork }}
tikv:
replicas: {{ .Values.tikv.replicas }}
image: {{ .Values.tikv.image }}
Expand All @@ -66,8 +71,13 @@ spec:
{{- if .Values.tikv.annotations }}
annotations:
{{ toYaml .Values.tikv.annotations | indent 6 }}
{{- end }}
{{- if .Values.tikv.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.tikv.podSecurityContext | indent 6}}
{{- end }}
maxFailoverCount: {{ .Values.tikv.maxFailoverCount | default 3 }}
hostNetwork: {{ .Values.tikv.hostNetwork }}
tidb:
replicas: {{ .Values.tidb.replicas }}
image: {{ .Values.tidb.image }}
Expand All @@ -87,6 +97,11 @@ spec:
annotations:
{{ toYaml .Values.tidb.annotations | indent 6 }}
{{- end }}
{{- if .Values.tidb.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.tidb.podSecurityContext | indent 6}}
{{- end }}
hostNetwork: {{ .Values.tidb.hostNetwork }}
binlogEnabled: {{ .Values.binlog.pump.create | default false }}
maxFailoverCount: {{ .Values.tidb.maxFailoverCount | default 3 }}
separateSlowLog: {{ .Values.tidb.separateSlowLog | default false }}
Expand Down
2 changes: 1 addition & 1 deletion charts/tidb-cluster/templates/tidb-initializer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ spec:
- -c
- |
{{ tuple "scripts/_initialize_tidb_users.py.tpl" . | include "helm-toolkit.utils.template" | indent 10 }}
volumeMounts:
{{- if and (ne .Values.timezone "UTC") (ne .Values.timezone "") }}
env:
- name: TZ
value: {{ .Values.timezone | default "UTC" }}
{{- end }}
volumeMounts:
- name: password
mountPath: /etc/tidb/password
readOnly: true
Expand Down
14 changes: 14 additions & 0 deletions charts/tidb-cluster/templates/tikv-importer-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.importer.create }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "cluster.name" . }}-importer-{{ template "importer-configmap.data-digest" . }}
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
data:
{{ include "importer-configmap.data" . | indent 2 }}
{{- end }}
Loading

0 comments on commit baace6b

Please sign in to comment.