Merge pull request #6377 from nikhiljindal/kubevtl

Updating components to use v1beta3
This commit is contained in:
Brian Grant
2015-04-03 15:58:09 -07:00
16 changed files with 40 additions and 35 deletions

View File

@@ -58,7 +58,7 @@ until [[ ${all_running} == 1 ]]; do
echo "All pods never 'Running' in time." >&2
exit 1
fi
statuses=($(${KUBECTL} get pods --template='{{range.items}}{{.currentState.status}} {{end}}'))
statuses=($(${KUBECTL} get pods --template='{{range.items}}{{.currentState.status}} {{end}}' --api-version=v1beta1))
# Ensure that we have enough pods.
echo "Found ${#statuses[@]} pods with statuses: ${statuses[@]}" >&2

View File

@@ -152,6 +152,7 @@ function query_pods() {
for i in $(seq 1 10); do
pods_unsorted=($(${KUBECTL} get pods -o template \
'--template={{range.items}}{{.id}} {{end}}' \
'--api-version=v1beta1' \
-l name="$1"))
found="${#pods_unsorted[*]}"
if [[ "${found}" == "$2" ]]; then
@@ -185,7 +186,7 @@ function wait_for_pods() {
echo "Waiting for ${pods_needed} pods to become 'running'"
pods_needed="$2"
for id in ${pods_sorted}; do
status=$(${KUBECTL} get pods "${id}" -o template --template='{{.currentState.status}}')
status=$(${KUBECTL} get pods "${id}" -o template --template='{{.currentState.status}}' --api-version=v1beta1)
if [[ "${status}" == "Running" ]]; then
pods_needed=$((pods_needed-1))
fi
@@ -311,9 +312,9 @@ svc1_pods=$(query_pods "${svc1_name}" "${svc1_count}")
svc2_pods=$(query_pods "${svc2_name}" "${svc2_count}")
# Get the portal IPs.
svc1_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc1_name}")
svc1_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc1_name}" --api-version=v1beta1)
test -n "${svc1_ip}" || error "Service1 IP is blank"
svc2_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc2_name}")
svc2_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc2_name}" --api-version=v1beta1)
test -n "${svc2_ip}" || error "Service2 IP is blank"
if [[ "${svc1_ip}" == "${svc2_ip}" ]]; then
error "Portal IPs conflict: ${svc1_ip}"
@@ -383,7 +384,7 @@ wait_for_pods "${svc3_name}" "${svc3_count}"
svc3_pods=$(query_pods "${svc3_name}" "${svc3_count}")
# Get the portal IP.
svc3_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc3_name}")
svc3_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc3_name}" --api-version=v1beta1)
test -n "${svc3_ip}" || error "Service3 IP is blank"
echo "Verifying the portals from the host"
@@ -439,7 +440,7 @@ wait_for_pods "${svc4_name}" "${svc4_count}"
svc4_pods=$(query_pods "${svc4_name}" "${svc4_count}")
# Get the portal IP.
svc4_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc4_name}")
svc4_ip=$(${KUBECTL} get services -o template '--template={{.portalIP}}' "${svc4_name}" --api-version=v1beta1)
test -n "${svc4_ip}" || error "Service4 IP is blank"
if [[ "${svc4_ip}" == "${svc2_ip}" || "${svc4_ip}" == "${svc3_ip}" ]]; then
error "Portal IPs conflict: ${svc4_ip}"

View File

@@ -125,7 +125,7 @@ for version in "${kube_api_versions[@]}"; do
-s "http://127.0.0.1:${API_PORT}"
--match-server-version
)
[ "$(kubectl get minions -t $'{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta1" ]
[ "$(kubectl get minions -t $'{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ]
else
kube_flags=(
-s "http://127.0.0.1:${API_PORT}"
@@ -134,17 +134,17 @@ for version in "${kube_api_versions[@]}"; do
)
[ "$(kubectl get minions -t $'{{ .apiVersion }}' "${kube_flags[@]}")" == "${version}" ]
fi
id_field=".id"
labels_field=".labels"
service_selector_field=".selector"
rc_replicas_field=".desiredState.replicas"
port_field=".port"
if [ "$version" = "v1beta3" ]; then
id_field=".metadata.name"
labels_field=".metadata.labels"
service_selector_field=".spec.selector"
rc_replicas_field=".spec.replicas"
port_field="(index .spec.ports 0).port"
id_field=".metadata.name"
labels_field=".metadata.labels"
service_selector_field=".spec.selector"
rc_replicas_field=".spec.replicas"
port_field="(index .spec.ports 0).port"
if [ "${version}" = "v1beta1" ] || [ "${version}" = "v1beta2" ]; then
id_field=".id"
labels_field=".labels"
service_selector_field=".selector"
rc_replicas_field=".desiredState.replicas"
port_field=".port"
fi
# Passing no arguments to create is an error