Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions docker/k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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

# Create vitess user
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 vitess && useradd -r -g vitess 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 && \
apt-get clean && \
apt-get autoclean && \
apt-get autoremove
169 changes: 168 additions & 1 deletion helm/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Helm Charts
# Helm Chart

This directory contains [Helm](https://github.com/kubernetes/helm)
charts for running [Vitess](http://vitess.io) on
Expand All @@ -10,3 +10,170 @@ sources for canonical packages that we plan to publish to the official
However, you may also find them useful as a starting point for creating
customized charts for your site, or other general-purpose charts for
common cluster variations.

## Example `site-values.yaml` configurations

You will need to provide a `site-values.yaml` file in order for Vitess to properly
install. Here are examples of various configurations. To see additional options,
look at the default `values.yaml` file, which is well commented.

### Minimum config

```
topology:
cells:
- name: "datacenter-1"
keyspaces:
- name: "unsharded-dbname"
shards:
- name: "0"
tablets:
- type: "replica"
vttablet:
replicas: 2
```

### Unsharded + sharded keyspaces

```
topology:
cells:
- name: "datacenter-1"
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: "datacenter-1"
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: "datacenter-1"
# 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"
```
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
145 changes: 0 additions & 145 deletions helm/vitess/orchestrator.conf.json

This file was deleted.

Loading