Skip to content
This repository has been archived by the owner on Aug 10, 2019. It is now read-only.

Commit

Permalink
Changes pod ids to be monotonically increasing
Browse files Browse the repository at this point in the history
  • Loading branch information
vsreekanti authored and cw75 committed Sep 20, 2018
1 parent b1d53d3 commit be28a44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions k8s/add_nodes.sh
Expand Up @@ -31,13 +31,14 @@ while [ "$MON_IPS" = "" ]; do
done

get_prev_num() {
NUM_PREV=`kubectl get pods -l role=$1 | wc -l` > /dev/null 2>&1
NUM_PODS=`kubectl get pods -l role=$1 | wc -l`

if [ $NUM_PREV -gt 0 ]; then
((NUM_PREV--))
if [ $NUM_PODS -eq 0 ]; then
echo 0
else
NUM_PREV=`kubectl get pods -l role=$1 | cut -d' ' -f1 | cut -d'-' -f3 | grep -v NAME | sort -nr | head -n 1`
echo $NUM_PREV
fi

echo $NUM_PREV
}

add_servers() {
Expand Down Expand Up @@ -120,7 +121,7 @@ add_pods() {
fi

# set the IPs of other system components
sed -i "s|MGMT_IP_DUMMY|$MGMT_IP|g" yaml/pods/monitoring-pod.yml tmp.yml
sed -i "s|MGMT_IP_DUMMY|$MGMT_IP|g" tmp.yml
sed -i "s|ROUTING_IPS_DUMMY|\"$ROUTING_IPS\"|g" tmp.yml
sed -i "s|MON_IPS_DUMMY|$MON_IPS|g" tmp.yml
sed -i "s|SEED_IP_DUMMY|$SEED_IP|g" tmp.yml
Expand Down
2 changes: 1 addition & 1 deletion k8s/kops_server.py
Expand Up @@ -60,7 +60,7 @@ def run():
ip = args[1]
count = subprocess.check_output('./get_restart_count.sh ' + ip,
shell=True)
logging.info('Returning restart count ' + count + ' for IP ' + ip + '.')
logging.info('Returning restart count ' + str(count, 'utf-8') + ' for IP ' + ip + '.')
request_pull_socket.send_string(str(count, 'utf-8'))
else:
logging.info('Unknown argument type: %s.' % (args[0]))
Expand Down

0 comments on commit be28a44

Please sign in to comment.