зеркало из https://github.com/github/vitess-gh.git
k8s: Use Kubernetes DNS instead of service env vars.
This removes the restriction that all services used by a pod must already have been created before the pod is created. It also allows a service to be deleted and recreated without having to also recreate all pods that depend on that service.
This commit is contained in:
Родитель
8d68766949
Коммит
3786c76c6f
|
@ -45,16 +45,9 @@ spec:
|
|||
- >-
|
||||
ipaddr=$(hostname -i)
|
||||
|
||||
global_etcd=$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
|
||||
cell="{{cell}}" &&
|
||||
local_etcd_host_var="ETCD_${cell^^}_SERVICE_HOST" &&
|
||||
local_etcd_port_var="ETCD_${cell^^}_SERVICE_PORT" &&
|
||||
local_etcd=${!local_etcd_host_var}:${!local_etcd_port_var}
|
||||
|
||||
if [ "{{cell}}" != "global" ]; then
|
||||
until etcdctl -C "http://$global_etcd"
|
||||
set "/vt/cells/{{cell}}" "http://$local_etcd"; do
|
||||
until etcdctl -C "http://etcd-global:4001"
|
||||
set "/vt/cells/{{cell}}" "http://etcd-{{cell}}:4001"; do
|
||||
echo "[$(date)] waiting for global etcd to register cell '{{cell}}'";
|
||||
sleep 1;
|
||||
done;
|
||||
|
|
|
@ -98,8 +98,8 @@ def env():
|
|||
if __name__ == "__main__":
|
||||
timeout = 10 # connect timeout in seconds
|
||||
|
||||
# Get vtgate service address from Kubernetes environment.
|
||||
addr = '%s:%s' % (os.environ['VTGATE_SERVICE_HOST'], os.environ['VTGATE_SERVICE_PORT'])
|
||||
# Get vtgate service address from Kubernetes DNS.
|
||||
addr = 'vtgate:15001'
|
||||
|
||||
# Connect to vtgate.
|
||||
conn = vtgatev2.connect({'vt': [addr]}, timeout)
|
||||
|
|
|
@ -51,7 +51,7 @@ spec:
|
|||
-topo_implementation etcd
|
||||
-tablet_protocol grpc
|
||||
-tablet_manager_protocol grpc
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
{{backup_flags}}" vitess
|
||||
volumes:
|
||||
- name: syslog
|
||||
|
|
|
@ -30,7 +30,7 @@ spec:
|
|||
chown -R vitess /vt &&
|
||||
su -p -c "/vt/bin/vtgate
|
||||
-topo_implementation etcd
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
-log_dir $VTDATAROOT/tmp
|
||||
-alsologtostderr
|
||||
-port 15001
|
||||
|
|
|
@ -36,7 +36,7 @@ spec:
|
|||
chown -R vitess /vt &&
|
||||
su -p -c "/vt/bin/vtgate
|
||||
-topo_implementation etcd
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
-log_dir $VTDATAROOT/tmp
|
||||
-alsologtostderr
|
||||
-port 15001
|
||||
|
|
|
@ -43,7 +43,7 @@ spec:
|
|||
|
||||
su -p -s /bin/bash -c "/vt/bin/vttablet
|
||||
-topo_implementation etcd
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
-log_dir $VTDATAROOT/tmp
|
||||
-alsologtostderr
|
||||
-port {{port}}
|
||||
|
|
|
@ -44,7 +44,7 @@ spec:
|
|||
|
||||
su -p -s /bin/bash -c "/vt/bin/vttablet
|
||||
-topo_implementation etcd
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
-log_dir $VTDATAROOT/tmp
|
||||
-alsologtostderr
|
||||
-port {{port}}
|
||||
|
|
|
@ -25,7 +25,7 @@ spec:
|
|||
-alsologtostderr
|
||||
-port {{port}}
|
||||
-topo_implementation etcd
|
||||
-etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
|
||||
-etcd_global_addrs http://etcd-global:4001
|
||||
-min_healthy_rdonly_endpoints 1
|
||||
-cell {{cell}}
|
||||
-tablet_protocol grpc
|
||||
|
|
Загрузка…
Ссылка в новой задаче