mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 04:52:08 +00:00
Merge pull request #3993 from satnam6502/services
Fix services.sh to swap out broken kubecfg calls
This commit is contained in:
commit
5b6eee294e
@ -87,7 +87,7 @@ function start_service() {
|
|||||||
"containers": [
|
"containers": [
|
||||||
{
|
{
|
||||||
"name": "$1",
|
"name": "$1",
|
||||||
"image": "kubernetes/serve_hostname",
|
"image": "kubernetes/serve_hostname:1.1",
|
||||||
"ports": [
|
"ports": [
|
||||||
{
|
{
|
||||||
"containerPort": 9376,
|
"containerPort": 9376,
|
||||||
@ -145,12 +145,12 @@ function stop_service() {
|
|||||||
# $2: expected pod count
|
# $2: expected pod count
|
||||||
function query_pods() {
|
function query_pods() {
|
||||||
# This fails very occasionally, so retry a bit.
|
# This fails very occasionally, so retry a bit.
|
||||||
pods_unsorted=()
|
local pods_unsorted=()
|
||||||
local i
|
local i
|
||||||
for i in $(seq 1 10); do
|
for i in $(seq 1 10); do
|
||||||
pods_unsorted=($(${KUBECFG} \
|
pods_unsorted=($(${KUBECTL} get pods -o template \
|
||||||
'-template={{range.items}}{{.id}} {{end}}' \
|
'--template={{range.items}}{{.id}} {{end}}' \
|
||||||
-l name="$1" list pods))
|
-l name="$1"))
|
||||||
found="${#pods_unsorted[*]}"
|
found="${#pods_unsorted[*]}"
|
||||||
if [[ "${found}" == "$2" ]]; then
|
if [[ "${found}" == "$2" ]]; then
|
||||||
break
|
break
|
||||||
@ -183,7 +183,7 @@ function wait_for_pods() {
|
|||||||
echo "Waiting for ${pods_needed} pods to become 'running'"
|
echo "Waiting for ${pods_needed} pods to become 'running'"
|
||||||
pods_needed="$2"
|
pods_needed="$2"
|
||||||
for id in ${pods_sorted}; do
|
for id in ${pods_sorted}; do
|
||||||
status=$(${KUBECFG} -template '{{.currentState.status}}' get "pods/${id}")
|
status=$(${KUBECTL} get pods "${id}" -o template --template='{{.currentState.status}}')
|
||||||
if [[ "${status}" == "Running" ]]; then
|
if [[ "${status}" == "Running" ]]; then
|
||||||
pods_needed=$((pods_needed-1))
|
pods_needed=$((pods_needed-1))
|
||||||
fi
|
fi
|
||||||
@ -289,13 +289,13 @@ test_node="${MINION_NAMES[0]}"
|
|||||||
master="${MASTER_NAME}"
|
master="${MASTER_NAME}"
|
||||||
|
|
||||||
# Launch some pods and services.
|
# Launch some pods and services.
|
||||||
svc1_name="service1"
|
svc1_name="service-${RANDOM}"
|
||||||
svc1_port=80
|
svc1_port=80
|
||||||
svc1_count=3
|
svc1_count=3
|
||||||
svc1_publics="192.168.1.1 192.168.1.2"
|
svc1_publics="192.168.1.1 192.168.1.2"
|
||||||
start_service "${svc1_name}" "${svc1_port}" "${svc1_count}" "${svc1_publics}"
|
start_service "${svc1_name}" "${svc1_port}" "${svc1_count}" "${svc1_publics}"
|
||||||
|
|
||||||
svc2_name="service2"
|
svc2_name="service-${RANDOM}"
|
||||||
svc2_port=80
|
svc2_port=80
|
||||||
svc2_count=3
|
svc2_count=3
|
||||||
start_service "${svc2_name}" "${svc2_port}" "${svc2_count}"
|
start_service "${svc2_name}" "${svc2_port}" "${svc2_count}"
|
||||||
|
Loading…
Reference in New Issue
Block a user