Switch to github.com/golang/dep for vendoring
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
d6ab91be27
commit
8e5b17cf13
15431 changed files with 3971413 additions and 8881 deletions
130
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/README.md
generated
vendored
Normal file
130
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/README.md
generated
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
RethinkDB Cluster on Kubernetes
|
||||
==============================
|
||||
|
||||
Setting up a [rethinkdb](http://rethinkdb.com/) cluster on [kubernetes](http://kubernetes.io)
|
||||
|
||||
**Features**
|
||||
|
||||
* Auto configuration cluster by querying info from k8s
|
||||
* Simple
|
||||
|
||||
Quick start
|
||||
-----------
|
||||
|
||||
**Step 1**
|
||||
|
||||
Rethinkdb will discover its peer using endpoints provided by kubernetes service,
|
||||
so first create a service so the following pod can query its endpoint
|
||||
|
||||
```sh
|
||||
$kubectl create -f examples/storage/rethinkdb/driver-service.yaml
|
||||
```
|
||||
|
||||
check out:
|
||||
|
||||
```sh
|
||||
$kubectl get services
|
||||
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
|
||||
rethinkdb-driver 10.0.27.114 <none> 28015/TCP db=rethinkdb 10m
|
||||
[...]
|
||||
```
|
||||
|
||||
**Step 2**
|
||||
|
||||
start the first server in the cluster
|
||||
|
||||
```sh
|
||||
$kubectl create -f examples/storage/rethinkdb/rc.yaml
|
||||
```
|
||||
|
||||
Actually, you can start servers as many as you want at one time, just modify the `replicas` in `rc.ymal`
|
||||
|
||||
check out again:
|
||||
|
||||
```sh
|
||||
$kubectl get pods
|
||||
NAME READY REASON RESTARTS AGE
|
||||
[...]
|
||||
rethinkdb-rc-r4tb0 1/1 Running 0 1m
|
||||
```
|
||||
|
||||
**Done!**
|
||||
|
||||
|
||||
---
|
||||
|
||||
Scale
|
||||
-----
|
||||
|
||||
You can scale up your cluster using `kubectl scale`. The new pod will join to the existing cluster automatically, for example
|
||||
|
||||
|
||||
```sh
|
||||
$kubectl scale rc rethinkdb-rc --replicas=3
|
||||
scaled
|
||||
|
||||
$kubectl get pods
|
||||
NAME READY REASON RESTARTS AGE
|
||||
[...]
|
||||
rethinkdb-rc-f32c5 1/1 Running 0 1m
|
||||
rethinkdb-rc-m4d50 1/1 Running 0 1m
|
||||
rethinkdb-rc-r4tb0 1/1 Running 0 3m
|
||||
```
|
||||
|
||||
Admin
|
||||
-----
|
||||
|
||||
You need a separate pod (labeled as role:admin) to access Web Admin UI
|
||||
|
||||
```sh
|
||||
kubectl create -f examples/storage/rethinkdb/admin-pod.yaml
|
||||
kubectl create -f examples/storage/rethinkdb/admin-service.yaml
|
||||
```
|
||||
|
||||
find the service
|
||||
|
||||
```console
|
||||
$kubectl get services
|
||||
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
|
||||
[...]
|
||||
rethinkdb-admin 10.0.131.19 104.197.19.120 8080/TCP db=rethinkdb,role=admin 10m
|
||||
rethinkdb-driver 10.0.27.114 <none> 28015/TCP db=rethinkdb 20m
|
||||
```
|
||||
|
||||
We request an external load balancer in the [admin-service.yaml](admin-service.yaml) file:
|
||||
|
||||
```
|
||||
type: LoadBalancer
|
||||
```
|
||||
|
||||
The external load balancer allows us to access the service from outside the firewall via an external IP, 104.197.19.120 in this case.
|
||||
|
||||
Note that you may need to create a firewall rule to allow the traffic, assuming you are using Google Compute Engine:
|
||||
|
||||
```console
|
||||
$ gcloud compute firewall-rules create rethinkdb --allow=tcp:8080
|
||||
```
|
||||
|
||||
Now you can open a web browser and access to *http://104.197.19.120:8080* to manage your cluster.
|
||||
|
||||
|
||||
|
||||
**Why not just using pods in replicas?**
|
||||
|
||||
This is because kube-proxy will act as a load balancer and send your traffic to different server,
|
||||
since the ui is not stateless when playing with Web Admin UI will cause `Connection not open on server` error.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
**BTW**
|
||||
|
||||
* `gen_pod.sh` is using to generate pod templates for my local cluster,
|
||||
the generated pods which is using `nodeSelector` to force k8s to schedule containers to my designate nodes, for I need to access persistent data on my host dirs. Note that one needs to label the node before 'nodeSelector' can work, see this [tutorial](../../../docs/user-guide/node-selection/)
|
||||
|
||||
* see [antmanler/rethinkdb-k8s](https://github.com/antmanler/rethinkdb-k8s) for detail
|
||||
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
29
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/admin-pod.yaml
generated
vendored
Normal file
29
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/admin-pod.yaml
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
db: rethinkdb
|
||||
role: admin
|
||||
name: rethinkdb-admin
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/google_containers/rethinkdb:1.16.0_1
|
||||
name: rethinkdb
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: admin-port
|
||||
- containerPort: 28015
|
||||
name: driver-port
|
||||
- containerPort: 29015
|
||||
name: cluster-port
|
||||
volumeMounts:
|
||||
- mountPath: /data/rethinkdb_data
|
||||
name: rethinkdb-storage
|
||||
volumes:
|
||||
- name: rethinkdb-storage
|
||||
emptyDir: {}
|
14
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/admin-service.yaml
generated
vendored
Normal file
14
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/admin-service.yaml
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
db: rethinkdb
|
||||
name: rethinkdb-admin
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
db: rethinkdb
|
||||
role: admin
|
12
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/driver-service.yaml
generated
vendored
Normal file
12
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/driver-service.yaml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
db: rethinkdb
|
||||
name: rethinkdb-driver
|
||||
spec:
|
||||
ports:
|
||||
- port: 28015
|
||||
targetPort: 28015
|
||||
selector:
|
||||
db: rethinkdb
|
73
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/gen-pod.sh
generated
vendored
Executable file
73
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/gen-pod.sh
generated
vendored
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
: ${VERSION:=1.16.0}
|
||||
|
||||
readonly NAME=${1-}
|
||||
if [[ -z "${NAME}" ]]; then
|
||||
echo -e "\033[1;31mName must be specified\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ADMIN=""
|
||||
if [[ ${NAME} == "admin" ]]; then
|
||||
ADMIN="role: admin"
|
||||
fi
|
||||
|
||||
NODE=""
|
||||
# One needs to label a node with the same key/value pair,
|
||||
# i.e., 'kubectl label nodes <node-name> name=${2}'
|
||||
if [[ ! -z "${2-}" ]]; then
|
||||
NODE="nodeSelector: { name: ${2} }"
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
${ADMIN}
|
||||
db: rethinkdb
|
||||
name: rethinkdb-${NAME}-${VERSION}
|
||||
namespace: rethinkdb
|
||||
spec:
|
||||
containers:
|
||||
- image: antmanler/rethinkdb:${VERSION}
|
||||
name: rethinkdb
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: admin-port
|
||||
protocol: TCP
|
||||
- containerPort: 28015
|
||||
name: driver-port
|
||||
protocol: TCP
|
||||
- containerPort: 29015
|
||||
name: cluster-port
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- mountPath: /data/rethinkdb_data
|
||||
name: rethinkdb-storage
|
||||
${NODE}
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /data/db/rethinkdb
|
||||
name: rethinkdb-storage
|
||||
EOF
|
27
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/image/Dockerfile
generated
vendored
Normal file
27
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/image/Dockerfile
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
# 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 rethinkdb:1.16.0
|
||||
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq curl && \
|
||||
rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && \
|
||||
curl -L http://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && \
|
||||
chmod u+x /usr/bin/jq
|
||||
|
||||
COPY ./run.sh /usr/bin/run.sh
|
||||
RUN chmod u+x /usr/bin/run.sh
|
||||
|
||||
CMD "/usr/bin/run.sh"
|
44
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/image/run.sh
generated
vendored
Normal file
44
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/image/run.sh
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/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.
|
||||
|
||||
set -o pipefail
|
||||
|
||||
echo Checking for other nodes
|
||||
IP=""
|
||||
if [[ -n "${KUBERNETES_SERVICE_HOST}" ]]; then
|
||||
|
||||
POD_NAMESPACE=${POD_NAMESPACE:-default}
|
||||
MYHOST=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
echo My host: ${MYHOST}
|
||||
|
||||
URL="https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}/api/v1/namespaces/${POD_NAMESPACE}/endpoints/rethinkdb-driver"
|
||||
echo "Endpont url: ${URL}"
|
||||
echo "Looking for IPs..."
|
||||
token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||
# try to pick up first different ip from endpoints
|
||||
IP=$(curl -s ${URL} --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt --header "Authorization: Bearer ${token}" \
|
||||
| jq -s -r --arg h "${MYHOST}" '.[0].subsets | .[].addresses | [ .[].ip ] | map(select(. != $h)) | .[0]') || exit 1
|
||||
[[ "${IP}" == null ]] && IP=""
|
||||
fi
|
||||
|
||||
if [[ -n "${IP}" ]]; then
|
||||
ENDPOINT="${IP}:29015"
|
||||
echo "Join to ${ENDPOINT}"
|
||||
exec rethinkdb --bind all --join ${ENDPOINT}
|
||||
else
|
||||
echo "Start single instance"
|
||||
exec rethinkdb --bind all
|
||||
fi
|
38
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/rc.yaml
generated
vendored
Normal file
38
vendor/k8s.io/kubernetes/examples/storage/rethinkdb/rc.yaml
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
labels:
|
||||
db: rethinkdb
|
||||
name: rethinkdb-rc
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
db: rethinkdb
|
||||
role: replicas
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
db: rethinkdb
|
||||
role: replicas
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/google_containers/rethinkdb:1.16.0_1
|
||||
name: rethinkdb
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: admin-port
|
||||
- containerPort: 28015
|
||||
name: driver-port
|
||||
- containerPort: 29015
|
||||
name: cluster-port
|
||||
volumeMounts:
|
||||
- mountPath: /data/rethinkdb_data
|
||||
name: rethinkdb-storage
|
||||
volumes:
|
||||
- name: rethinkdb-storage
|
||||
emptyDir: {}
|
Loading…
Add table
Add a link
Reference in a new issue