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
This commit is contained in:
Ryan Hallisey 2014-12-22 21:40:34 +00:00
parent 31e4fa1937
commit 8229c1f6c3
22 changed files with 70 additions and 19 deletions

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:
@ -50,6 +52,6 @@ desiredState:
name: ceilometer-alarm
id: ceilometer-1
version: v1beta1
id: ceilometer
id: ceilometer-controller
labels:
name: ceilometer-controller

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
volumes:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
volumes:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
volumes:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
volumes:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:
@ -43,6 +45,6 @@ desiredState:
privileged: true
id: nova-1
version: v1beta1
id: nova
id: nova-controller
labels:
name: nova-controller

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:
@ -7,6 +9,6 @@ desiredState:
- containerPort: 5672
id: rabbitmq-1
version: v1beta1
id: rabbitmq-master
id: rabbitmq
labels:
name: rabbitmq-master
name: rabbitmq

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -1,3 +1,5 @@
apiVersion: v1beta1
kind: Pod
desiredState:
manifest:
containers:

View File

@ -30,14 +30,14 @@ desiredState:
value: novadbpassword
- name: KEYSTONE_ADMIN_TOKEN
value: ADMINTOKEN
id: nova-compute-controller
id: nova-compute
version: v1beta1
labels:
name: nova-compute
replicaSelector:
name: nova-compute
replicas: 6
id: nova-compute-controller
id: nova-compute
kind: ReplicationController
labels:
name: nova-compute

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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