Skip to content

Commit

Permalink
fix 99.clean.yml不应该删除harbor相关
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Aug 31, 2018
1 parent 520a33d commit 37bcbbf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
9 changes: 8 additions & 1 deletion 99.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,14 @@
- "/etc/haproxy"
- "/etc/keepalived"

- hosts: all
- hosts:
- kube-master
- new-master
- kube-node
- new-node
- deploy
- etcd
- lb
tasks:
- name: stop and disable chrony
service: name={{ item }} state=stopped enabled=no
Expand Down
2 changes: 1 addition & 1 deletion roles/calico/templates/calico.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ spec:
# Choose which controllers to run.
- name: ENABLED_CONTROLLERS
value: policy,profile,workloadendpoint,node
# if hosts have multiple net interfaces, set following two ENVs
{% if NODE_WITH_MULTIPLE_NETWORKS == 'true' %}
# if hosts have multiple net interfaces, set following two ENVs
- name: KUBERNETES_SERVICE_HOST
value: "{{ MASTER_IP }}"
- name: KUBERNETES_SERVICE_PORT
Expand Down
38 changes: 37 additions & 1 deletion roles/cluster-addon/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@
register: pod_info
run_once: true

- name: 获取已下载离线镜像信息
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- block:
- name: 尝试推送离线{{ dns_backend }}镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ dns_offline }} dest=/opt/kube/images/{{ dns_offline }}

when: 'dns_offline in download_info.stdout'

- name: 获取{{ dns_backend }}离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info

- name: 导入{{ dns_backend }}的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ dns_offline }}"
when: 'dns_offline in image_info.stdout'

- name: 创建{{ dns_backend }}部署
shell: "{{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/{{ dns_backend }}"
Expand All @@ -35,9 +47,15 @@
- block:
- name: 尝试推送离线 metrics-server镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ metricsserver_offline }} dest=/opt/kube/images/{{ metricsserver_offline }}
when: 'metricsserver_offline in download_info.stdout'

- name: 获取metrics-server离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info

- name: 导入 metrics-server的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ metricsserver_offline }}"
when: 'metricsserver_offline in image_info.stdout'

- name: 创建 metrics-server部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/metrics-server"
Expand All @@ -49,9 +67,15 @@
- block:
- name: 尝试推送离线 dashboard镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ dashboard_offline }} dest=/opt/kube/images/{{ dashboard_offline }}
when: 'dashboard_offline in download_info.stdout'

- name: 获取dashboard离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info

- name: 导入 dashboard的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ dashboard_offline }}"
when: 'dashboard_offline in image_info.stdout'

- name: 创建 dashboard部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard"
Expand All @@ -63,9 +87,15 @@
- block:
- name: 尝试推送离线 traefik镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ traefik_offline }} dest=/opt/kube/images/{{ traefik_offline }}
when: 'traefik_offline in download_info.stdout'

- name: 获取traefik离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info

- name: 导入 traefik的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ traefik_offline }}"
when: 'traefik_offline in image_info.stdout'

- name: 创建 traefik部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik-ingress.yaml"
Expand All @@ -77,9 +107,15 @@
- block:
- name: 尝试推送离线 heapster镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ heapster_offline }} dest=/opt/kube/images/{{ heapster_offline }}
when: 'heapster_offline in download_info.stdout'

- name: 获取heapster离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info

- name: 导入 heapster的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ heapster_offline }}"
when: 'heapster_offline in image_info.stdout'

- name: 创建 heapster部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster/heapster.yaml"
Expand Down
2 changes: 1 addition & 1 deletion roles/flannel/templates/kube-flannel.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# if hosts have multiple net interfaces, set following two ENVs
{% if NODE_WITH_MULTIPLE_NETWORKS == 'true' %}
# if hosts have multiple net interfaces, set following two ENVs
- name: KUBERNETES_SERVICE_HOST
value: "{{ MASTER_IP }}"
#value: "{{ KUBE_APISERVER.split(':')[1].lstrip('/') }}"
Expand Down

0 comments on commit 37bcbbf

Please sign in to comment.