fix 网络插件离线镜像不存在时安装的错误信息

pull/317/head
gjmzj 2018-08-30 20:17:05 +08:00
parent 6232dc6251
commit a86bd89181
4 changed files with 40 additions and 12 deletions

View File

@ -31,21 +31,28 @@
ignore_errors: true ignore_errors: true
run_once: true run_once: true
- name: 准备 calico DaemonSet yaml文件 - name: 配置 calico DaemonSet yaml文件
template: src=calico.yaml.j2 dest=/opt/kube/kube-system/calico/calico.yaml template: src=calico.yaml.j2 dest=/opt/kube/kube-system/calico/calico.yaml
- name: 准备 calico rbac文件 - name: 配置 calico rbac
template: src=calico-rbac.yaml.j2 dest=/opt/kube/kube-system/calico/calico-rbac.yaml template: src=calico-rbac.yaml.j2 dest=/opt/kube/kube-system/calico/calico-rbac.yaml
- name: 检查是否已下载离线calico镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
# 【可选】推送离线docker 镜像,可以忽略执行错误 # 【可选】推送离线docker 镜像,可以忽略执行错误
- name: 尝试推送离线docker 镜像(若执行失败,可忽略) - name: 尝试推送离线docker 镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }} copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
when: 'item in download_info.stdout'
with_items: with_items:
- "pause_3.1.tar" - "pause_3.1.tar"
- "{{ calico_offline }}" - "{{ calico_offline }}"
ignore_errors: true ignore_errors: true
- name: 获取目录下离线镜像信息 - name: 获取calico离线镜像推送情况
command: "ls /opt/kube/images" command: "ls /opt/kube/images"
register: image_info register: image_info
@ -84,6 +91,6 @@
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'calico-node'|grep ' {{ inventory_hostname }} '|awk '{print $3}'" shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'calico-node'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status register: pod_status
until: pod_status.stdout == "Running" until: pod_status.stdout == "Running"
retries: 12 retries: 15
delay: 8 delay: 8

View File

@ -39,20 +39,27 @@
ignore_errors: true ignore_errors: true
run_once: true run_once: true
- name: 准备 cilium DaemonSet yaml文件 - name: 配置 cilium DaemonSet yaml文件
template: src=cilium.yaml.j2 dest=/opt/kube/kube-system/cilium/cilium.yaml template: src=cilium.yaml.j2 dest=/opt/kube/kube-system/cilium/cilium.yaml
tags: reconf tags: reconf
- name: 检查是否已下载离线cilium镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
# 【可选】推送离线docker 镜像,可以忽略执行错误 # 【可选】推送离线docker 镜像,可以忽略执行错误
- name: 尝试推送离线docker 镜像(若执行失败,可忽略) - name: 尝试推送离线docker 镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }} copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
when: 'item in download_info.stdout'
with_items: with_items:
- "pause_3.1.tar" - "pause_3.1.tar"
- "{{ cilium_offline }}" - "{{ cilium_offline }}"
- "{{ busybox_offline }}" - "{{ busybox_offline }}"
ignore_errors: true ignore_errors: true
- name: 获取目录下离线镜像信息 - name: 获取cilium离线镜像推送情况
command: "ls /opt/kube/images" command: "ls /opt/kube/images"
register: image_info register: image_info
@ -80,6 +87,6 @@
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'cilium'|grep ' {{ inventory_hostname }} '|awk '{print $3}'" shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'cilium'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status register: pod_status
until: pod_status.stdout == "Running" until: pod_status.stdout == "Running"
retries: 12 retries: 15
delay: 8 delay: 8

View File

@ -14,18 +14,25 @@
- loopback - loopback
- portmap - portmap
- name: 准备 flannel DaemonSet yaml文件 - name: 配置 flannel DaemonSet yaml文件
template: src=kube-flannel.yaml.j2 dest=/opt/kube/kube-system/flannel/kube-flannel.yaml template: src=kube-flannel.yaml.j2 dest=/opt/kube/kube-system/flannel/kube-flannel.yaml
- name: 检查是否已下载离线flannel镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
# 【可选】推送离线docker 镜像,可以忽略执行错误 # 【可选】推送离线docker 镜像,可以忽略执行错误
- name: 尝试推送离线docker 镜像(若执行失败,可忽略) - name: 尝试推送离线docker 镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }} copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
when: 'item in download_info.stdout'
with_items: with_items:
- "pause_3.1.tar" - "pause_3.1.tar"
- "{{ flannel_offline }}" - "{{ flannel_offline }}"
ignore_errors: true ignore_errors: true
- name: 获取目录下离线镜像信息 - name: 获取flannel离线镜像推送情况
command: "ls /opt/kube/images" command: "ls /opt/kube/images"
register: image_info register: image_info
@ -52,6 +59,6 @@
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'flannel'|grep ' {{ inventory_hostname }} '|awk '{print $3}'" shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'flannel'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status register: pod_status
until: pod_status.stdout == "Running" until: pod_status.stdout == "Running"
retries: 12 retries: 15
delay: 8 delay: 8

View File

@ -33,16 +33,23 @@
template: src=kuberouter-all.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml template: src=kuberouter-all.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml
when: 'SERVICE_PROXY == "true"' when: 'SERVICE_PROXY == "true"'
- name: 检查是否已下载离线kube-router镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
# 【可选】推送离线docker 镜像,可以忽略执行错误 # 【可选】推送离线docker 镜像,可以忽略执行错误
- name: 尝试推送离线docker 镜像(若执行失败,可忽略) - name: 尝试推送离线docker 镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }} copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
when: 'item in download_info.stdout'
with_items: with_items:
- "pause_3.1.tar" - "pause_3.1.tar"
- "{{ kuberouter_offline }}" - "{{ kuberouter_offline }}"
- "{{ busybox_offline }}" - "{{ busybox_offline }}"
ignore_errors: true ignore_errors: true
- name: 获取目录下离线镜像信息 - name: 获取kube-router离线镜像推送情况
command: "ls /opt/kube/images" command: "ls /opt/kube/images"
register: image_info register: image_info
@ -70,6 +77,6 @@
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'kube-router'|grep ' {{ inventory_hostname }} '|awk '{print $3}'" shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'kube-router'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status register: pod_status
until: pod_status.stdout == "Running" until: pod_status.stdout == "Running"
retries: 12 retries: 15
delay: 8 delay: 8