mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Update guestbook to fix given recent changes.
This commit is contained in:
parent
ccc8bc8289
commit
c38880047d
@ -12,20 +12,20 @@ if (isset($_GET['cmd']) === true) {
|
|||||||
if ($_GET['cmd'] == 'set') {
|
if ($_GET['cmd'] == 'set') {
|
||||||
$client = new Predis\Client([
|
$client = new Predis\Client([
|
||||||
'scheme' => 'tcp',
|
'scheme' => 'tcp',
|
||||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
'host' => getenv('REDIS_MASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||||
'port' => getenv('REDISMASTER_SERVICE_PORT'),
|
'port' => getenv('REDIS_MASTER_SERVICE_PORT'),
|
||||||
]);
|
]);
|
||||||
$client->set($_GET['key'], $_GET['value']);
|
$client->set($_GET['key'], $_GET['value']);
|
||||||
print('{"message": "Updated"}');
|
print('{"message": "Updated"}');
|
||||||
} else {
|
} else {
|
||||||
$read_port = getenv('REDISMASTER_SERVICE_PORT');
|
$read_port = getenv('REDIS_MASTER_SERVICE_PORT');
|
||||||
|
|
||||||
if (isset($_ENV['REDISSLAVE_SERVICE_PORT'])) {
|
if (isset($_ENV['REDISSLAVE_SERVICE_PORT'])) {
|
||||||
$read_port = getenv('REDISSLAVE_SERVICE_PORT');
|
$read_port = getenv('REDISSLAVE_SERVICE_PORT');
|
||||||
}
|
}
|
||||||
$client = new Predis\Client([
|
$client = new Predis\Client([
|
||||||
'scheme' => 'tcp',
|
'scheme' => 'tcp',
|
||||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
'host' => getenv('REDIS_MASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||||
'port' => $read_port,
|
'port' => $read_port,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
redis-server --slaveof ${REDISMASTER_SERVICE_HOST:-$SERVICE_HOST} $REDISMASTER_SERVICE_PORT
|
# Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
redis-server --slaveof ${REDIS_MASTER_SERVICE_HOST:-$SERVICE_HOST} $REDIS_MASTER_SERVICE_PORT
|
||||||
|
@ -42,8 +42,8 @@ $KUBECFG stop redisSlaveController
|
|||||||
# Needed until issue #103 gets fixed
|
# Needed until issue #103 gets fixed
|
||||||
sleep 25
|
sleep 25
|
||||||
$KUBECFG rm redisSlaveController
|
$KUBECFG rm redisSlaveController
|
||||||
$KUBECFG delete services/redismaster
|
$KUBECFG delete services/redis-master
|
||||||
$KUBECFG delete pods/redis-master-2
|
$KUBECFG delete pods/redis-master
|
||||||
|
|
||||||
POD_LIST_2=$($KUBECFG '-template={{range.items}}{{.id}} {{end}}' list pods)
|
POD_LIST_2=$($KUBECFG '-template={{range.items}}{{.id}} {{end}}' list pods)
|
||||||
echo "Pods running after shutdown: ${POD_LIST_2}"
|
echo "Pods running after shutdown: ${POD_LIST_2}"
|
||||||
|
Loading…
Reference in New Issue
Block a user