[kubernetes] Create actions to recreate pods and restart containers

This patch adds actions to KubernetesPod class which allow to
recreate a pod (delete it and create new one) and to restart docker
containers on minion nodes.

Change-Id: Ia03b27d72662700fb302960adba9dae20203b597
Closes-bug: #1466359
This commit is contained in:
Valerii Kovalchuk
2016-04-20 15:46:48 +03:00
parent b46d49af09
commit 3c3371f270
5 changed files with 79 additions and 0 deletions

View File

@@ -329,3 +329,21 @@ Methods:
- $.kubernetesCluster.scaleRc(rcName => $._getReplicationControllerId(), newSize => $.replicas)
Else:
- $._environment.reporter.report($this, 'Cannot scale Pod up')
recreatePod:
Usage: Action
Body:
- $._environment.reporter.report($this, 'Recreating Pod {0}'.format($.name))
- $.kubernetesCluster.deletePods(dict(id => $._getPodName()))
- If: $.replicas = 0
Then:
- $._loadCurrentPodDefinition()
- $.kubernetesCluster.createPod(definition => $._podDefinition, isNew => true)
- $._environment.reporter.report($this, 'Pod {0} recreated'.format($.name))
restartContainers:
Usage: Action
Body:
- $.kubernetesCluster.restartContainers(podName => $._getPodName())