Browse Source

Merge pull request #8495 from vrutkovs/etcd-livenessprove-ip

etcd: use etcdctl cluster-health cmd for liveness probe
OpenShift Merge Robot 6 years ago
parent
commit
ed37b6d3b5
2 changed files with 23 additions and 3 deletions
  1. 4 3
      roles/etcd/files/etcd.yaml
  2. 19 0
      roles/etcd/tasks/static.yml

+ 4 - 3
roles/etcd/files/etcd.yaml

@@ -31,12 +31,13 @@ spec:
      - mountPath: /var/lib/etcd/
        name: master-data
     livenessProbe:
-      tcpSocket:
-        port: 2379
+      exec:
+      initialDelaySeconds: 15
+      timeoutSeconds: 10
   volumes:
   - name: master-config
     hostPath:
       path: /etc/etcd/
   - name: master-data
     hostPath:
-      path: /var/lib/etcd
+      path: /var/lib/etcd

+ 19 - 0
roles/etcd/tasks/static.yml

@@ -54,6 +54,25 @@
   with_items:
   - etcd.yaml
 
+- name: Set etcd host as a probe target host
+  yedit:
+    src: "{{ mktemp.stdout }}/{{ item }}"
+    edits:
+    - key: spec.containers[0].livenessProbe.exec.command
+      value:
+      - "etcdctl"
+      - "--cert-file"
+      - "{{ etcd_peer_cert_file }}"
+      - "--key-file"
+      - "{{ etcd_peer_key_file }}"
+      - "--ca-file"
+      - "{{ etcd_peer_ca_file }}"
+      - "-C"
+      - "{{ etcd_peer_url_scheme }}://{{ etcd_ip }}:{{ etcd_client_port }}"
+      - "cluster-health"
+  with_items:
+  - etcd.yaml
+
 - name: Deploy etcd static pod
   copy:
     remote_src: true