need another beer
This commit is contained in:
commit
608ffdac49
3 changed files with 51 additions and 0 deletions
6
Readme.md
Normal file
6
Readme.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
Just a really dirty script to ignore all kubernetes includet release stuff and do it on your own.
|
||||
|
||||
|
||||
You dont want to do it, you REALLY dont want to use this.
|
||||
|
||||
Just be ashamed that this exists!
|
44
release.py
Normal file
44
release.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
from kubernetes import client, config
|
||||
import sys
|
||||
import time
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Call this script with 2 paramters -> release.py <NAMESPACE> <DEPLOYMENT>")
|
||||
sys.exit(2)
|
||||
|
||||
namespace = sys.argv[1]
|
||||
deployment = sys.argv[2]
|
||||
|
||||
print("Redeploy "+namespace+"/"+deployment)
|
||||
|
||||
config.load_kube_config()
|
||||
v1 = client.CoreV1Api()
|
||||
|
||||
def getPods():
|
||||
pods = []
|
||||
v1 = client.CoreV1Api()
|
||||
ret = v1.list_pod_for_all_namespaces(watch=False)
|
||||
for i in ret.items:
|
||||
if i.status.phase == "Running":
|
||||
if i.metadata.namespace == namespace:
|
||||
if i.metadata.name[0:len(deployment) + 1] == deployment+"-":
|
||||
pods.append(i)
|
||||
return pods
|
||||
|
||||
toRemovePods = getPods()
|
||||
podsCount = len(toRemovePods);
|
||||
print("Found "+str(podsCount)+" Pods")
|
||||
|
||||
for pod in toRemovePods:
|
||||
v1.delete_namespaced_pod(pod.metadata.name, pod.metadata.namespace)
|
||||
time.sleep(5)
|
||||
print("Waiting until Pod is back")
|
||||
currentPodCount = len(getPods())
|
||||
print("Current there are "+str(currentPodCount)+" Pods")
|
||||
while currentPodCount < podsCount:
|
||||
sys.stdout.write(".")
|
||||
time.sleep(1)
|
||||
currentPodCount = len(getPods())
|
||||
sys.stdout.write(" - Done\n")
|
||||
|
||||
print("Done")
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
kubernetes==10.0.0
|
Loading…
Reference in a new issue