Get conf checksum directly for localhost CP loadbalancer (#12632)

There is no need to stat the templated file, because the template module
already returns a checksum.
This commit is contained in:
Max Gautier
2025-10-24 05:57:36 +00:00
committed by GitHub
parent c6926eb2f9
commit 5acde6cfe2
4 changed files with 4 additions and 18 deletions

View File

@@ -18,14 +18,7 @@
owner: root owner: root
mode: "0755" mode: "0755"
backup: true backup: true
register: haproxy_conf
- name: Haproxy | Get checksum from config
stat:
path: "{{ haproxy_config_dir }}/haproxy.cfg"
get_attributes: false
get_checksum: true
get_mime: false
register: haproxy_stat
- name: Haproxy | Write static pod - name: Haproxy | Write static pod
template: template:

View File

@@ -18,14 +18,7 @@
owner: root owner: root
mode: "0755" mode: "0755"
backup: true backup: true
register: nginx_conf
- name: Nginx-proxy | Get checksum from config
stat:
path: "{{ nginx_config_dir }}/nginx.conf"
get_attributes: false
get_checksum: true
get_mime: false
register: nginx_stat
- name: Nginx-proxy | Write static pod - name: Nginx-proxy | Write static pod
template: template:

View File

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

View File

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