Ensure haproxy and nginx reload when config changes (#4862)

Change-Id: Ia9a41e7b1cfcb1e6acb2dbae6eecc541dce25a74
This commit is contained in:
Matthew Mosesohn 2019-06-10 15:59:08 +03:00 committed by Kubernetes Prow Robot
parent aa63eb6196
commit 3b7797b1a1
4 changed files with 24 additions and 10 deletions

View file

@ -4,11 +4,6 @@
path: "{{ kube_manifest_dir }}/nginx-proxy.yml" path: "{{ kube_manifest_dir }}/nginx-proxy.yml"
state: absent state: absent
- name: haproxy | Write static pod
template:
src: manifests/haproxy.manifest.j2
dest: "{{ kube_manifest_dir }}/haproxy.yml"
- name: haproxy | Make haproxy directory - name: haproxy | Make haproxy directory
file: file:
path: "{{ haproxy_config_dir }}" path: "{{ haproxy_config_dir }}"
@ -23,3 +18,13 @@
owner: root owner: root
mode: 0755 mode: 0755
backup: yes backup: yes
- name: haproxy | Get checksum from config
stat:
path: "{{ haproxy_config_dir }}/haproxy.cfg"
register: haproxy_stat
- name: haproxy | Write static pod
template:
src: manifests/haproxy.manifest.j2
dest: "{{ kube_manifest_dir }}/haproxy.yml"

View file

@ -4,11 +4,6 @@
path: "{{ kube_manifest_dir }}/haproxy.yml" path: "{{ kube_manifest_dir }}/haproxy.yml"
state: absent state: absent
- name: nginx-proxy | Write static pod
template:
src: manifests/nginx-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/nginx-proxy.yml"
- name: nginx-proxy | Make nginx directory - name: nginx-proxy | Make nginx directory
file: file:
path: "{{ nginx_config_dir }}" path: "{{ nginx_config_dir }}"
@ -23,3 +18,13 @@
owner: root owner: root
mode: 0755 mode: 0755
backup: yes backup: yes
- name: nginx-proxy | Get checksum from config
stat:
path: "{{ nginx_config_dir }}/nginx.conf"
register: nginx_stat
- name: nginx-proxy | Write static pod
template:
src: manifests/nginx-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/nginx-proxy.yml"

View file

@ -6,6 +6,8 @@ metadata:
labels: labels:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
k8s-app: kube-haproxy k8s-app: kube-haproxy
annotations:
haproxy-cfg-checksum: "{{ haproxy_stat.stat.checksum }}"
spec: spec:
hostNetwork: true hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet

View file

@ -6,6 +6,8 @@ metadata:
labels: labels:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
k8s-app: kube-nginx k8s-app: kube-nginx
annotations:
nginx-cfg-checksum: "{{ nginx_stat.stat.checksum }}"
spec: spec:
hostNetwork: true hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet