From 8229c1f6c3448f5b00d04cdf3928ca5776a44ff8 Mon Sep 17 00:00:00 2001 From: Ryan Hallisey Date: Mon, 22 Dec 2014 21:40:34 +0000 Subject: Start and stop scripts are outdated after Kubernetes update Kubernetes no longer uses 'kubecfg', but rather 'kubectl'. Therefore, the way that pods and services are being created needs to be changed. In order to create a pod, the parameter 'kind' needs to be set to 'pod' in the yaml file and the api version specified. The stop script now reads from k8s/{pod,service,replication}/ in order to stop all the started pods, services, and replication controllers. Change-Id: Ibd39fa402e9df883df83272c3aefbb69009dfbd2 --- tools/start-all-pods | 2 +- tools/start-all-replications | 3 +-- tools/start-all-services | 2 +- tools/stop-all-pods | 21 ++++++++++++++++++--- tools/stop-all-replications | 10 +++++++--- tools/stop-all-services | 9 ++++++--- 6 files changed, 34 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/start-all-pods b/tools/start-all-pods index 089de7678..72c580781 100755 --- a/tools/start-all-pods +++ b/tools/start-all-pods @@ -18,6 +18,6 @@ horizon ' for pod in $pods; do - kubecfg -c "k8s/pod/${pod}-pod.yaml" create pods + kubectl create -f "k8s/pod/${pod}-pod.yaml" done diff --git a/tools/start-all-replications b/tools/start-all-replications index b88572f4a..a605d4fb7 100755 --- a/tools/start-all-replications +++ b/tools/start-all-replications @@ -7,7 +7,6 @@ nova-compute ' for svc in $services; do - kubecfg -c "k8s/replication/${svc}-replication.yaml" create \ - replicationControllers + kubectl create -f "k8s/replication/${svc}-replication.yaml" done diff --git a/tools/start-all-services b/tools/start-all-services index a78e9b186..3c073465f 100755 --- a/tools/start-all-services +++ b/tools/start-all-services @@ -22,6 +22,6 @@ horizon ' for svc in $services; do - kubecfg -c "k8s/service/${svc}-service.yaml" create services + kubectl create -f "k8s/service/${svc}-service.yaml" done diff --git a/tools/stop-all-pods b/tools/stop-all-pods index 4fe4b80d7..2a2d7d3ab 100755 --- a/tools/stop-all-pods +++ b/tools/stop-all-pods @@ -1,6 +1,21 @@ #!/bin/sh -kubecfg list pods | - awk 'NR>2 {print $1}' | - xargs -i kubecfg delete pods/{} +cd $(git rev-parse --show-toplevel) +# Delete the replication is not cleaning up its pods +# These pods need to be deleted according to their UUID +uuids=$(kubectl get pods -o json | jq '.[][].id' 2>/dev/null | grep -o -E '"[a-fA-F|0-9|\-]*' | cut -c 2- | grep '\-') + +for uuid in $uuids; do + if [ $uuid ]; then + kubectl delete pod $uuid + fi +done + +pods=$(kubectl get pods -o json| jq '.[][].id' 2>/dev/null) +# Removes quotes from jquery +pods=${pods//\"/} + +for pod in $pods; do + kubectl delete -f "k8s/pod/${pod}-pod.yaml" 2>/dev/null +done diff --git a/tools/stop-all-replications b/tools/stop-all-replications index aa2dc5954..6bea193fd 100755 --- a/tools/stop-all-replications +++ b/tools/stop-all-replications @@ -1,6 +1,10 @@ #!/bin/sh -kubecfg list replicationControllers | - awk 'NR>2 {print $1}' | - xargs -i kubecfg delete replicationControllers/{} +cd $(git rev-parse --show-toplevel) + +replication_ctrs=$(kubectl get replicationController | awk 'NR>1 {print $1}') + +for replication_ctr in $replication_ctrs; do + kubectl delete -f "k8s/replication/${replication_ctr}-replication.yaml" +done diff --git a/tools/stop-all-services b/tools/stop-all-services index c76c24439..df5ce86d3 100755 --- a/tools/stop-all-services +++ b/tools/stop-all-services @@ -1,6 +1,9 @@ #!/bin/sh -kubecfg list services | - awk 'NR>2 {print $1}' | - xargs -i kubecfg delete services/{} +cd $(git rev-parse --show-toplevel) +services=$(kubectl get services | awk 'NR>1 {print $1}') + +for service in $services; do + kubectl delete -f "k8s/service/${service}-service.yaml" 2>/dev/null +done -- cgit v1.2.3