mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
vendor files
This commit is contained in:
1
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/README.md
generated
vendored
Normal file
1
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
This file has moved to [https://github.com/kubernetes/examples/blob/master/staging/storage/mysql-galera/README.md](https://github.com/kubernetes/examples/blob/master/staging/storage/mysql-galera/README.md)
|
56
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/Dockerfile
generated
vendored
Normal file
56
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM ubuntu:trusty
|
||||
|
||||
# add our user and group first to make sure their IDs get assigned
|
||||
# consistently, regardless of whatever dependencies get added
|
||||
RUN groupadd -r mysql && useradd -r -g mysql mysql
|
||||
|
||||
ENV PERCONA_XTRADB_VERSION 5.6
|
||||
ENV MYSQL_VERSION 5.6
|
||||
ENV TERM linux
|
||||
|
||||
RUN apt-get update
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-key adv --keyserver keys.gnupg.net --recv-keys 8507EFA5
|
||||
|
||||
RUN echo "deb http://repo.percona.com/apt trusty main" > /etc/apt/sources.list.d/percona.list
|
||||
RUN echo "deb-src http://repo.percona.com/apt trusty main" >> /etc/apt/sources.list.d/percona.list
|
||||
|
||||
# the "/var/lib/mysql" stuff here is because the mysql-server
|
||||
# postinst doesn't have an explicit way to disable the
|
||||
# mysql_install_db codepath besides having a database already
|
||||
# "configured" (ie, stuff in /var/lib/mysql/mysql)
|
||||
# also, we set debconf keys to make APT a little quieter
|
||||
RUN { \
|
||||
echo percona-server-server-5.6 percona-server-server/data-dir select ''; \
|
||||
echo percona-server-server-5.6 percona-server-server/root_password password ''; \
|
||||
} | debconf-set-selections \
|
||||
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y percona-xtradb-cluster-client-"${MYSQL_VERSION}" \
|
||||
percona-xtradb-cluster-common-"${MYSQL_VERSION}" percona-xtradb-cluster-server-"${MYSQL_VERSION}" \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql && chown -R mysql:mysql /var/lib/mysql
|
||||
|
||||
VOLUME /var/lib/mysql
|
||||
|
||||
COPY my.cnf /etc/mysql/my.cnf
|
||||
COPY cluster.cnf /etc/mysql/conf.d/cluster.cnf
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
EXPOSE 3306 4444 4567 4568
|
||||
CMD ["mysqld"]
|
12
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/cluster.cnf
generated
vendored
Normal file
12
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/cluster.cnf
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
[mysqld]
|
||||
|
||||
wsrep_provider=/usr/lib/libgalera_smm.so
|
||||
wsrep_cluster_address=gcomm://
|
||||
binlog_format=ROW
|
||||
default_storage_engine=InnoDB
|
||||
innodb_autoinc_lock_mode=2
|
||||
|
||||
wsrep_sst_method=xtrabackup-v2
|
||||
wsrep_node_address=127.0.0.1
|
||||
wsrep_cluster_name=galera_kubernetes
|
||||
wsrep_sst_auth=sstuser:changethis
|
164
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/docker-entrypoint.sh
generated
vendored
Executable file
164
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/docker-entrypoint.sh
generated
vendored
Executable file
@ -0,0 +1,164 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#
|
||||
# This script does the following:
|
||||
#
|
||||
# 1. Sets up database privileges by building an SQL script
|
||||
# 2. MySQL is initially started with this script a first time
|
||||
# 3. Modify my.cnf and cluster.cnf to reflect available nodes to join
|
||||
#
|
||||
|
||||
# if NUM_NODES not passed, default to 3
|
||||
if [ -z "$NUM_NODES" ]; then
|
||||
NUM_NODES=3
|
||||
fi
|
||||
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld "$@"
|
||||
fi
|
||||
|
||||
# if the command passed is 'mysqld' via CMD, then begin processing.
|
||||
if [ "$1" = 'mysqld' ]; then
|
||||
# read DATADIR from the MySQL config
|
||||
DATADIR="$("$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }')"
|
||||
|
||||
# only check if system tables not created from mysql_install_db and permissions
|
||||
# set with initial SQL script before proceeding to build SQL script
|
||||
if [ ! -d "$DATADIR/mysql" ]; then
|
||||
# fail if user didn't supply a root password
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" ]; then
|
||||
echo >&2 'error: database is uninitialized and MYSQL_ROOT_PASSWORD not set'
|
||||
echo >&2 ' Did you forget to add -e MYSQL_ROOT_PASSWORD=... ?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# mysql_install_db installs system tables
|
||||
echo 'Running mysql_install_db ...'
|
||||
mysql_install_db --datadir="$DATADIR"
|
||||
echo 'Finished mysql_install_db'
|
||||
|
||||
# this script will be run once when MySQL first starts to set up
|
||||
# prior to creating system tables and will ensure proper user permissions
|
||||
tempSqlFile='/tmp/mysql-first-time.sql'
|
||||
cat > "$tempSqlFile" <<-EOSQL
|
||||
DELETE FROM mysql.user ;
|
||||
CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
|
||||
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
|
||||
EOSQL
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" >> "$tempSqlFile"
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then
|
||||
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" >> "$tempSqlFile"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add SST (Single State Transfer) user if Clustering is turned on
|
||||
if [ -n "$GALERA_CLUSTER" ]; then
|
||||
# this is the Single State Transfer user (SST, initial dump or xtrabackup user)
|
||||
WSREP_SST_USER=${WSREP_SST_USER:-"sst"}
|
||||
if [ -z "$WSREP_SST_PASSWORD" ]; then
|
||||
echo >&2 'error: Galera cluster is enabled and WSREP_SST_PASSWORD is not set'
|
||||
echo >&2 ' Did you forget to add -e WSREP_SST__PASSWORD=... ?'
|
||||
exit 1
|
||||
fi
|
||||
# add single state transfer (SST) user privileges
|
||||
echo "CREATE USER '${WSREP_SST_USER}'@'localhost' IDENTIFIED BY '${WSREP_SST_PASSWORD}';" >> "$tempSqlFile"
|
||||
echo "GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO '${WSREP_SST_USER}'@'localhost';" >> "$tempSqlFile"
|
||||
fi
|
||||
|
||||
echo 'FLUSH PRIVILEGES ;' >> "$tempSqlFile"
|
||||
|
||||
# Add the SQL file to mysqld's command line args
|
||||
set -- "$@" --init-file="$tempSqlFile"
|
||||
fi
|
||||
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
fi
|
||||
|
||||
# if cluster is turned on, then proceed to build cluster setting strings
|
||||
# that will be interpolated into the config files
|
||||
if [ -n "$GALERA_CLUSTER" ]; then
|
||||
# this is the Single State Transfer user (SST, initial dump or xtrabackup user)
|
||||
WSREP_SST_USER=${WSREP_SST_USER:-"sst"}
|
||||
if [ -z "$WSREP_SST_PASSWORD" ]; then
|
||||
echo >&2 'error: database is uninitialized and WSREP_SST_PASSWORD not set'
|
||||
echo >&2 ' Did you forget to add -e WSREP_SST_PASSWORD=xxx ?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# user/password for SST user
|
||||
sed -i -e "s|^wsrep_sst_auth=sstuser:changethis|wsrep_sst_auth=${WSREP_SST_USER}:${WSREP_SST_PASSWORD}|" /etc/mysql/conf.d/cluster.cnf
|
||||
|
||||
# set nodes own address
|
||||
WSREP_NODE_ADDRESS=`ip addr show | grep -E '^[ ]*inet' | grep -m1 global | awk '{ print $2 }' | sed -e 's/\/.*//'`
|
||||
if [ -n "$WSREP_NODE_ADDRESS" ]; then
|
||||
sed -i -e "s|^wsrep_node_address=.*$|wsrep_node_address=${WSREP_NODE_ADDRESS}|" /etc/mysql/conf.d/cluster.cnf
|
||||
fi
|
||||
|
||||
# if the string is not defined or it only is 'gcomm://', this means bootstrap
|
||||
if [ -z "$WSREP_CLUSTER_ADDRESS" -o "$WSREP_CLUSTER_ADDRESS" == "gcomm://" ]; then
|
||||
# if empty, set to 'gcomm://'
|
||||
# NOTE: this list does not imply membership.
|
||||
# It only means "obtain SST and join from one of these..."
|
||||
if [ -z "$WSREP_CLUSTER_ADDRESS" ]; then
|
||||
WSREP_CLUSTER_ADDRESS="gcomm://"
|
||||
fi
|
||||
|
||||
# loop through number of nodes
|
||||
for NUM in `seq 1 $NUM_NODES`; do
|
||||
NODE_SERVICE_HOST="PXC_NODE${NUM}_SERVICE_HOST"
|
||||
|
||||
# if set
|
||||
if [ -n "${!NODE_SERVICE_HOST}" ]; then
|
||||
# if not its own IP, then add it
|
||||
if [ $(expr "$HOSTNAME" : "pxc-node${NUM}") -eq 0 ]; then
|
||||
# if not the first bootstrap node add comma
|
||||
if [ $WSREP_CLUSTER_ADDRESS != "gcomm://" ]; then
|
||||
WSREP_CLUSTER_ADDRESS="${WSREP_CLUSTER_ADDRESS},"
|
||||
fi
|
||||
# append
|
||||
# if user specifies USE_IP, use that
|
||||
if [ -n "${USE_IP}" ]; then
|
||||
WSREP_CLUSTER_ADDRESS="${WSREP_CLUSTER_ADDRESS}"${!NODE_SERVICE_HOST}
|
||||
# otherwise use DNS
|
||||
else
|
||||
WSREP_CLUSTER_ADDRESS="${WSREP_CLUSTER_ADDRESS}pxc-node${NUM}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# WSREP_CLUSTER_ADDRESS is now complete and will be interpolated into the
|
||||
# cluster address string (wsrep_cluster_address) in the cluster
|
||||
# configuration file, cluster.cnf
|
||||
if [ -n "$WSREP_CLUSTER_ADDRESS" -a "$WSREP_CLUSTER_ADDRESS" != "gcomm://" ]; then
|
||||
sed -i -e "s|^wsrep_cluster_address=gcomm://|wsrep_cluster_address=${WSREP_CLUSTER_ADDRESS}|" /etc/mysql/conf.d/cluster.cnf
|
||||
fi
|
||||
fi
|
||||
|
||||
# random server ID needed
|
||||
sed -i -e "s/^server\-id=.*$/server-id=${RANDOM}/" /etc/mysql/my.cnf
|
||||
|
||||
# finally, start mysql
|
||||
exec "$@"
|
55
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/my.cnf
generated
vendored
Normal file
55
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/image/my.cnf
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
[client]
|
||||
port=3306
|
||||
socket=/var/run/mysqld/mysqld.sock
|
||||
|
||||
[mysqld_safe]
|
||||
socket=/var/run/mysqld/mysqld.sock
|
||||
nice=0
|
||||
|
||||
[mysqld]
|
||||
user=mysql
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
socket=/var/run/mysqld/mysqld.sock
|
||||
port=3306
|
||||
basedir=/usr
|
||||
datadir=/var/lib/mysql
|
||||
tmpdir=/tmp
|
||||
lc-messages-dir=/usr/share/mysql
|
||||
skip-external-locking
|
||||
|
||||
key_buffer=16M
|
||||
max_allowed_packet=16M
|
||||
thread_stack=192K
|
||||
thread_cache_size=8
|
||||
|
||||
myisam-recover=BACKUP
|
||||
#max_connections=100
|
||||
query_cache_limit=1M
|
||||
query_cache_size=16M
|
||||
slow_query_log=1
|
||||
slow_query_log_file=/var/log/mysql/mysql-slow.log
|
||||
long_query_time=2
|
||||
log-queries-not-using-indexes
|
||||
|
||||
server-id=12345
|
||||
log_bin=/var/log/mysql/mysql-bin.log
|
||||
expire_logs_days=4
|
||||
max_binlog_size=100M
|
||||
|
||||
default_storage_engine=InnoDB
|
||||
innodb_file_per_table
|
||||
innodb_log_file_size=100M
|
||||
innodb_log_buffer_size=10M
|
||||
innodb_log_files_in_group=2
|
||||
innodb_buffer_pool_instances=4
|
||||
innodb_buffer_pool_size=100M
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
quote-names
|
||||
max_allowed_packet=16M
|
||||
|
||||
[isamchk]
|
||||
key_buffer=16M
|
||||
|
||||
!includedir /etc/mysql/conf.d/
|
12
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-cluster-service.yaml
generated
vendored
Normal file
12
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-cluster-service.yaml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pxc-cluster
|
||||
labels:
|
||||
unit: pxc-cluster
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
selector:
|
||||
unit: pxc-cluster
|
57
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node1.yaml
generated
vendored
Normal file
57
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node1.yaml
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pxc-node1
|
||||
labels:
|
||||
node: pxc-node1
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
- port: 4444
|
||||
name: state-snapshot-transfer
|
||||
- port: 4567
|
||||
name: replication-traffic
|
||||
- port: 4568
|
||||
name: incremental-state-transfer
|
||||
selector:
|
||||
node: pxc-node1
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: pxc-node1
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
node: pxc-node1
|
||||
unit: pxc-cluster
|
||||
spec:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: 0.3
|
||||
image: capttofu/percona_xtradb_cluster_5_6:beta
|
||||
name: pxc-node1
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
- containerPort: 4444
|
||||
- containerPort: 4567
|
||||
- containerPort: 4568
|
||||
env:
|
||||
- name: GALERA_CLUSTER
|
||||
value: "true"
|
||||
- name: WSREP_CLUSTER_ADDRESS
|
||||
value: gcomm://
|
||||
- name: WSREP_SST_USER
|
||||
value: sst
|
||||
- name: WSREP_SST_PASSWORD
|
||||
value: sst
|
||||
- name: MYSQL_USER
|
||||
value: mysql
|
||||
- name: MYSQL_PASSWORD
|
||||
value: mysql
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: c-krit
|
58
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node2.yaml
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node2.yaml
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pxc-node2
|
||||
labels:
|
||||
node: pxc-node2
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
- port: 4444
|
||||
name: state-snapshot-transfer
|
||||
- port: 4567
|
||||
name: replication-traffic
|
||||
- port: 4568
|
||||
name: incremental-state-transfer
|
||||
selector:
|
||||
node: pxc-node2
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: pxc-node2
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
node: pxc-node2
|
||||
unit: pxc-cluster
|
||||
spec:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: 0.3
|
||||
image: capttofu/percona_xtradb_cluster_5_6:beta
|
||||
name: pxc-node2
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
- containerPort: 4444
|
||||
- containerPort: 4567
|
||||
- containerPort: 4568
|
||||
env:
|
||||
- name: GALERA_CLUSTER
|
||||
value: "true"
|
||||
- name: WSREP_CLUSTER_ADDRESS
|
||||
value: gcomm://
|
||||
- name: WSREP_SST_USER
|
||||
value: sst
|
||||
- name: WSREP_SST_PASSWORD
|
||||
value: sst
|
||||
- name: MYSQL_USER
|
||||
value: mysql
|
||||
- name: MYSQL_PASSWORD
|
||||
value: mysql
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: c-krit
|
58
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node3.yaml
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/examples/storage/mysql-galera/pxc-node3.yaml
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pxc-node3
|
||||
labels:
|
||||
node: pxc-node3
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
- port: 4444
|
||||
name: state-snapshot-transfer
|
||||
- port: 4567
|
||||
name: replication-traffic
|
||||
- port: 4568
|
||||
name: incremental-state-transfer
|
||||
selector:
|
||||
node: pxc-node3
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: pxc-node3
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
node: pxc-node3
|
||||
unit: pxc-cluster
|
||||
spec:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: 0.3
|
||||
image: capttofu/percona_xtradb_cluster_5_6:beta
|
||||
name: pxc-node3
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
- containerPort: 4444
|
||||
- containerPort: 4567
|
||||
- containerPort: 4568
|
||||
env:
|
||||
- name: GALERA_CLUSTER
|
||||
value: "true"
|
||||
- name: WSREP_CLUSTER_ADDRESS
|
||||
value: gcomm://
|
||||
- name: WSREP_SST_USER
|
||||
value: sst
|
||||
- name: WSREP_SST_PASSWORD
|
||||
value: sst
|
||||
- name: MYSQL_USER
|
||||
value: mysql
|
||||
- name: MYSQL_PASSWORD
|
||||
value: mysql
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: c-krit
|
Reference in New Issue
Block a user