mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 03:33:26 +00:00
Add per-service env vars for *_SERVICE_HOST
As a replacement of a single SERVICE_HOST variable, offer a FOO_SERVICE_HOST variable. This will help ease the transition to ip-per-service, where there is no longer a single service host. # *** ERROR: *** Some files are missing the required boilerplate # header from hooks/boilerplate.txt: # examples/guestbook/redis-slave/run.sh # # Your commit will be aborted unless you fix these. # COMMIT_BLOCKED_ON_BOILERPLATE
This commit is contained in:
@@ -149,7 +149,7 @@ redisSlaveController brendanburns/redis-slave name=redisslave 2
|
||||
The redis slave configures itself by looking for the Kubernetes service environment variables in the container environment. In particular, the redis slave is started with the following command:
|
||||
|
||||
```shell
|
||||
redis-server --slaveof $SERVICE_HOST $REDISMASTER_SERVICE_PORT
|
||||
redis-server --slaveof ${REDISMASTER_SERVICE_HOST:-$SERVICE_HOST} $REDISMASTER_SERVICE_PORT
|
||||
```
|
||||
|
||||
Once that's up you can list the pods in the cluster, to verify that the master and slaves are running:
|
||||
@@ -270,7 +270,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
if ($_GET['cmd'] == 'set') {
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => getenv('REDISMASTER_SERVICE_PORT'),
|
||||
]);
|
||||
$client->set($_GET['key'], $_GET['value']);
|
||||
@@ -283,7 +283,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
}
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => $read_port,
|
||||
]);
|
||||
|
||||
|
@@ -12,7 +12,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
if ($_GET['cmd'] == 'set') {
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => getenv('REDISMASTER_SERVICE_PORT'),
|
||||
]);
|
||||
$client->set($_GET['key'], $_GET['value']);
|
||||
@@ -25,7 +25,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
}
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => $read_port,
|
||||
]);
|
||||
|
||||
|
@@ -12,7 +12,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
if ($_GET['cmd'] == 'set') {
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => getenv('REDISMASTER_SERVICE_PORT'),
|
||||
]);
|
||||
$client->set($_GET['key'], $_GET['value']);
|
||||
@@ -25,7 +25,7 @@ if (isset($_GET['cmd']) === true) {
|
||||
}
|
||||
$client = new Predis\Client([
|
||||
'scheme' => 'tcp',
|
||||
'host' => getenv('SERVICE_HOST'),
|
||||
'host' => getenv('REDISMASTER_SERVICE_HOST') ?: getenv('SERVICE_HOST'),
|
||||
'port' => $read_port,
|
||||
]);
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
redis-server --slaveof $SERVICE_HOST $REDISMASTER_SERVICE_PORT
|
||||
redis-server --slaveof ${REDISMASTER_SERVICE_HOST:-$SERVICE_HOST} $REDISMASTER_SERVICE_PORT
|
||||
|
Reference in New Issue
Block a user