Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
Signed-off-by: Aylei <rayingecho@gmail.com>
  • Loading branch information
aylei committed Apr 24, 2019
2 parents 54d0a23 + d954936 commit 4846925
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 152 deletions.
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,15 @@ check-all: lint check-static check-shadow check-gosec megacheck errcheck
check-setup:
@which retool >/dev/null 2>&1 || go get github.com/twitchtv/retool
@GO111MODULE=off retool sync
# govet doesn't work with retool for Go 1.11
# so install separately
@GO111MODULE=on CGO_ENABLED=0 go get github.com/dnephin/govet@4a96d43e39d340b63daa8bc5576985aa599885f6

check: check-setup lint check-static

check-static:
@ # Not running vet and fmt through metalinter becauase it ends up looking at vendor
@echo "gofmt checking"
gofmt -s -l -w $(FILES) 2>&1| $(FAIL_ON_STDOUT)
@echo "govet check"
govet -all $$($(PACKAGE_DIRECTORIES)) 2>&1
@echo "go vet check"
@GO111MODULE=on go vet -all $$($(PACKAGE_LIST)) 2>&1
@echo "mispell and ineffassign checking"
CGO_ENABLED=0 retool do gometalinter.v2 --disable-all \
--enable misspell \
Expand All @@ -114,8 +111,9 @@ errcheck:

# TODO: shadow check fails at the moment
check-shadow:
@echo "govet shadow checking"
govet -shadow $$($(PACKAGE_DIRECTORIES))
@echo "go vet shadow checking"
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
@GO111MODULE=on go vet -vettool=$(which shadow) $$($(PACKAGE_LIST))

lint:
@echo "linting"
Expand Down
11 changes: 9 additions & 2 deletions cmd/controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,15 @@ func main() {
informerFactory = informers.NewSharedInformerFactory(cli, resyncDuration)
kubeInformerFactory = kubeinformers.NewSharedInformerFactory(kubeCli, resyncDuration)
} else {
informerFactory = informers.NewFilteredSharedInformerFactory(cli, resyncDuration, ns, nil)
kubeInformerFactory = kubeinformers.NewFilteredSharedInformerFactory(kubeCli, resyncDuration, ns, nil)
options := []informers.SharedInformerOption{
informers.WithNamespace(ns),
}
informerFactory = informers.NewSharedInformerFactoryWithOptions(cli, resyncDuration, options...)

kubeoptions := []kubeinformers.SharedInformerOption{
kubeinformers.WithNamespace(ns),
}
kubeInformerFactory = kubeinformers.NewSharedInformerFactoryWithOptions(kubeCli, resyncDuration, kubeoptions...)
}

rl := resourcelock.EndpointsLock{
Expand Down
56 changes: 3 additions & 53 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,47 +63,11 @@ You can follow Helm official [documentation](https://helm.sh) to install Helm in
## Local Persistent Volume
Local disks are recommended to be formatted as ext4 filesystem. The local persistent volume directory must be a mount point: a whole disk mount or a [bind mount](https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount):
### Prepare local volumes
### Disk mount
See the [operations guide in sig-storage-local-static-provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/blob/master/docs/operations.md) which explains setup and cleanup of local volumes on the nodes.
Mount local ssd disks of your Kubernetes nodes at subdirectory of /mnt/disks. For example if your data disk is `/dev/nvme0n1`, you can format and mount with the following commands:
```shell
$ sudo mkdir -p /mnt/disks/disk0
$ sudo mkfs.ext4 /dev/nvme0n1
$ sudo mount -t ext4 -o nodelalloc /dev/nvme0n1 /mnt/disks/disk0
```

### Bind mount

The disadvantages of bind mount for TiDB: all the volumes has the size of the whole disk and there is no quota and isolation of bind mount volumes. If your data directory is `/data`, you can create a bind mount with the following commands:

```shell
$ sudo mkdir -p /data/local-pv01
$ sudo mkdir -p /mnt/disks/local-pv01
$ sudo mount --bind /data/local-pv01 /mnt/disks/local-pv01
```

Use this command to confirm the mount point exist:

```shell
$ mount | grep /mnt/disks/local-pv01
```

### Auto-mount on reboot

To auto-mount disks when your operating system is booted, you should edit `/etc/fstab` to include these mounting info.

Disk mount:
```shell
$ echo "/dev/nvme0n1 /mnt/disks/disk01 ext4 defaults 0 0" >> /etc/fstab
```

Bind mount:
```shell
$ echo "/data/local-pv01 /mnt/disks/local-pv01 none bind 0 0" >> /etc/fstab
```
It also provides some [best practices](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/blob/master/docs/best-practices.md) for production.
### Deploy local-static-provisioner
Expand All @@ -115,20 +79,6 @@ $ kubectl get po -n kube-system -l app=local-volume-provisioner
$ kubectl get pv | grep local-storage
```

### Remove a mount point

If we want to remove a mount point, first we need to `umount` the mount point, and then delete the related directories. For example:

```shell
$ umount /mnt/disks/local-pv01
$ rm -rf /mnt/disks/local-pv01
$ rm -rf /data/local-pv01
```

You should also delete the related entries in `/etc/fstab` at the same time, otherwise the automount may cause problems when the machine restarts.

> Note: The local-volume plugin expects paths to be stable, if you remove a previous mount-point in the discovery directory (default to `/mnt/disks/`), you should remove the PV manually to keep consistency.
## Install TiDB Operator

TiDB Operator uses [CRD](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/) to extend Kubernetes, so to use TiDB Operator, you should first create `TidbCluster` custom resource kind. This is a one-time job, namely you can only need to do this once in your Kubernetes cluster.
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
github.com/go-openapi/jsonreference v0.17.0 h1:yJW3HCkTHg7NOA+gZ83IPHzUSnUzGXhGmsdiCcMexbA=
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
Expand Down
2 changes: 1 addition & 1 deletion manifests/local-dind/dind-cluster-v1.12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ DIND_NO_PARALLEL_E2E="${DIND_NO_PARALLEL_E2E:-}"
DNS_SERVICE="${DNS_SERVICE:-coredns}"
APISERVER_PORT="${APISERVER_PORT:-8080}"
REGISTRY_PORT="${REGISTRY_PORT:-5000}"
PV_NUMS="${PV_NUMS:-4}"
PV_NUMS="${PV_NUMS:-9}"

DIND_CA_CERT_URL="${DIND_CA_CERT_URL:-}"
DIND_PROPAGATE_HTTP_PROXY="${DIND_PROPAGATE_HTTP_PROXY:-}"
Expand Down
Loading

0 comments on commit 4846925

Please sign in to comment.