Merge "KubeADM: Move shell commands to use bash and set env vars"

This commit is contained in:
Zuul 2017-11-20 23:56:20 +00:00 committed by Gerrit Code Review
commit a2449cebcb
5 changed files with 28 additions and 4 deletions

View File

@ -29,6 +29,8 @@
- name: clean | kube | removing any old docker containers
ignore_errors: yes
shell: MY_CONTAINER_ID=$(docker inspect --format {% raw %}'{{ .Id }}'{% endraw %} "{{ my_container_name }}"); docker ps --all --no-trunc --quiet | awk '!'"/${MY_CONTAINER_ID}/ { print \$1 }" | xargs -r -l1 -P16 docker rm -f
args:
executable: /bin/bash
- name: clean | kube | remove any mounts
ignore_errors: yes
@ -36,6 +38,8 @@
for MOUNT in $(findmnt --df --output TARGET | grep "^/var/lib/kubelet"); do
umount --force $MOUNT
done
args:
executable: /bin/bash
- name: clean | kube | remove dirs
file:

View File

@ -84,17 +84,25 @@
delegate_to: 127.0.0.1
block:
- name: wait for kube api
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; python /usr/bin/test-kube-api.py
shell: python /usr/bin/test-kube-api.py
register: task_result
until: task_result.rc == 0
retries: 120
delay: 5
environment:
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
args:
executable: /bin/bash
- name: wait for node to come online
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '\(^Ready\)\|\(^NotReady\)'
shell: kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '\(^Ready\)\|\(^NotReady\)'
register: task_result
until: task_result.rc == 0
retries: 120
delay: 5
environment:
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
args:
executable: /bin/bash
- include_tasks: wait-for-kube-system-namespace.yaml
- name: deploying kube-proxy
@ -107,11 +115,15 @@
delegate_to: 127.0.0.1
block:
- name: wait for node to be ready
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '^Ready'
shell: kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '^Ready'
register: task_result
until: task_result.rc == 0
retries: 120
delay: 5
environment:
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
args:
executable: /bin/bash
- include_tasks: wait-for-kube-system-namespace.yaml
# - name: deploying kube-dns addon

View File

@ -14,8 +14,12 @@
- name: wait for kube pods to all be running in kube-system namespace
delegate_to: 127.0.0.1
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; /usr/bin/test-kube-pods-ready kube-system
shell: /usr/bin/test-kube-pods-ready kube-system
register: task_result
until: task_result.rc == 0
retries: 120
delay: 5
environment:
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
args:
executable: /bin/bash

View File

@ -56,6 +56,8 @@
- name: docker | getting cgroup driver info
shell: docker info | awk '/^Cgroup Driver:/ { print $NF }'
register: docker_cgroup_driver
args:
executable: /bin/bash
- name: setting kublet cgroup driver
set_fact:
kubelet_cgroup_driver: "{{ docker_cgroup_driver.stdout }}"

View File

@ -47,3 +47,5 @@
until: task_result.rc == 0
retries: 120
delay: 5
args:
executable: /bin/bash