Skip to content

Commit

Permalink
Merge pull request #3582 from youtube/helm
Browse files Browse the repository at this point in the history
Update Helm Chart
  • Loading branch information
enisoc authored Jan 23, 2018
2 parents fccc652 + e9adf37 commit 5a7f4df
Show file tree
Hide file tree
Showing 14 changed files with 1,284 additions and 965 deletions.
58 changes: 58 additions & 0 deletions docker/k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM vitess/base AS base

FROM debian:stretch-slim

# Set up Vitess environment (just enough to run pre-built Go binaries)
ENV VTROOT /vt
ENV VTDATAROOT /vtdataroot
ENV VTTOP /vt/src/github.com/youtube/vitess

# Prepare directory structure.
RUN mkdir -p /vt && \
mkdir -p /vt/bin && \
mkdir -p /vt/config && \
mkdir -p /vt/web && \
mkdir -p /vtdataroot/tabletdata

# Copy CA certs for https calls
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# Copy binaries
COPY --from=base /vt/bin/mysqlctld /vt/bin/
COPY --from=base /vt/bin/vtctld /vt/bin/
COPY --from=base /vt/bin/vtctl /vt/bin/
COPY --from=base /vt/bin/vtgate /vt/bin/
COPY --from=base /vt/bin/vttablet /vt/bin/
COPY --from=base /vt/bin/vtworker /vt/bin/

# copy web admin files
COPY --from=base $VTTOP/web /vt/web/

# copy vitess config
COPY --from=base $VTTOP/config/init_db.sql /vt/config/

# mysql flavor files for db specific .cnf settings
COPY --from=base $VTTOP/config/mycnf/master_mysql56.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master_mariadb.cnf /vt/config/mycnf/

# settings for different types of instances
COPY --from=base $VTTOP/config/mycnf/default.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/replica.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/rdonly.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/backup.cnf /vt/config/mycnf/

# settings to support rbr
COPY --from=base $VTTOP/config/mycnf/rbr.cnf /vt/config/mycnf/

# add vitess user and add permissions
RUN groupadd -r --gid 999 vitess && useradd -r -g vitess --uid 999 vitess && \
chown -R vitess:vitess /vt;

# TODO: remove when https://github.com/youtube/vitess/issues/3553 is fixed
RUN apt-get update && \
apt-get upgrade -qq && \
apt-get install mysql-client -qq --no-install-recommends && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
5 changes: 4 additions & 1 deletion helm/vitess/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: v1
name: vitess
version: 0.2.0
version: 0.9.0
description: Single-Chart Vitess Cluster
keywords:
- vitess
- mysql
- maria
- mariadb
- percona
- sql
- database
- shard
Expand Down
188 changes: 186 additions & 2 deletions helm/vitess/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ It currently includes all dependencies (e.g. etcd) and Vitess components
**WARNING: This chart should be considered Alpha.
Upgrading a release of this chart may or may not delete all your data.**

## Prerequisites

* Install [etcd-operator](https://github.com/coreos/etcd-operator) in the
namespace where you plan to install this chart.

## Installing the Chart

```console
helm/vitess$ helm install .
helm/vitess$ helm install . -f site-values.yaml
```

See the [Configuration](#configuration) section below for what you need to put
in `site-values.yaml`.
You can install the chart without site values, but it will only launch a
skeleton cluster without any keyspaces (logical databases).

## Cleaning up

After deleting an installation of the chart, the PersistentVolumeClaims remain.
Expand All @@ -31,5 +41,179 @@ kubectl delete pvc -l app=vitess

## Configuration

See the comments in `values.yaml` for descriptions of the parameters.
You will need to provide a `site-values.yaml` file to specify your actual
logical database topology (e.g. whether to shard).
Here are examples of various configurations. To see additional options,
look at the default `values.yaml` file, which is well commented.

### Unsharded keyspace

```
topology:
cells:
- name: "zone1"
etcd:
replicas: 3
vtctld:
replicas: 1
vtgate:
replicas: 3
mysqlProtocol:
enabled: false
keyspaces:
- name: "unsharded-dbname"
shards:
- name: "0"
tablets:
- type: "replica"
vttablet:
replicas: 2
```

### Unsharded + sharded keyspaces

```
topology:
cells:
- name: "zone1"
...
keyspaces:
- name: "unsharded-dbname"
shards:
- name: "0"
tablets:
- type: "replica"
vttablet:
replicas: 2
- name: "sharded-db"
shards:
- name: "-80"
tablets:
- type: "replica"
vttablet:
replicas: 2
- name: "80-"
tablets:
- type: "replica"
vttablet:
replicas: 2
```

### Separate pools of replicas and rdonly tablets

```
topology:
cells:
- name: "zone1"
...
keyspaces:
- name: "unsharded-dbname"
shards:
- name: "0"
tablets:
- type: "replica"
vttablet:
replicas: 2
- type: "rdonly"
vttablet:
replicas: 2
```

### Use a custom database image and a specific Vitess release

```
topology:
cells:
...
vttablet:
vitessTag: "2.1"
mysqlImage: "percona:5.7.20"
flavor: percona
```

### Enable MySQL protocol support

```
topology:
cells:
- name: "zone1"
...
# enable or disable mysql protocol support, with accompanying auth details
mysqlProtocol:
enabled: false
username: myuser
# this is the secret that will be mounted as the user password
# kubectl create secret generic myuser_password --from-literal=password=abc123
passwordSecret: myuser-password
keyspaces:
...
```

### Enable backup/restore using Google Cloud Storage

```
topology:
cells:
...
config:
backup:
enabled: true
backup_storage_implementation: gcs
# Google Cloud Storage bucket to use for backups
gcs_backup_storage_bucket: vitess-backups
# root prefix for all backup-related object names
gcs_backup_storage_root: vtbackups
```

### Custom requests/limits

```
topology:
cells:
...
vttablet:
resources:
# common production values 2-4CPU/4-8Gi RAM
limits:
cpu: 2
memory: 4Gi
mysqlResources:
# common production values 4CPU/8-16Gi RAM
limits:
cpu: 4
memory: 8Gi
# PVC for mysql
dataVolumeClaimAnnotations:
dataVolumeClaimSpec:
# pd-ssd (Google Cloud)
# managed-premium (Azure)
# standard (AWS) - not sure what the default class is for ssd
storageClassName: "default"
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "10Gi"
```

### Custom PVC for MySQL data

```
topology:
cells:
...
vttablet:
dataVolumeClaimSpec:
# Google Cloud SSD
storageClassName: "pd-ssd"
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "100Gi"
```
Loading

0 comments on commit 5a7f4df

Please sign in to comment.