소스 검색

Refactor etcd image

Simplify logic for etcd_image
Michael Gugino 7 년 전
부모
커밋
85efc9cffc

+ 6 - 0
roles/etcd/defaults/main.yaml

@@ -6,6 +6,12 @@ r_etcd_common_backup_sufix_name: ''
 r_etcd_common_etcd_runtime: "docker"
 r_etcd_common_embedded_etcd: false
 
+osm_etcd_image: 'registry.access.redhat.com/rhel7/etcd'
+etcd_image_dict:
+  origin: "registry.fedoraproject.org/f26/etcd"
+  openshift-enterprise: "{{ osm_etcd_image }}"
+etcd_image: "{{ etcd_image_dict[openshift_deployment_type | default('origin')] }}"
+
 # etcd run on a host => use etcdctl command directly
 # etcd run as a docker container => use docker exec
 # etcd run as a runc container => use runc exec

+ 1 - 1
roles/etcd/tasks/main.yml

@@ -20,7 +20,7 @@
 
 - block:
   - name: Pull etcd container
-    command: docker pull {{ openshift.etcd.etcd_image }}
+    command: docker pull {{ etcd_image }}
     register: pull_result
     changed_when: "'Downloaded newer image' in pull_result.stdout"
 

+ 2 - 2
roles/etcd/tasks/system_container.yml

@@ -5,7 +5,7 @@
     tasks_from: proxy
 
 - name: Pull etcd system container
-  command: atomic pull --storage=ostree {{ openshift.etcd.etcd_image }}
+  command: atomic pull --storage=ostree {{ etcd_image }}
   register: pull_result
   changed_when: "'Pulling layer' in pull_result.stdout"
 
@@ -57,7 +57,7 @@
 - name: Install or Update Etcd system container package
   oc_atomic_container:
     name: etcd
-    image: "{{ openshift.etcd.etcd_image }}"
+    image: "{{ etcd_image }}"
     state: latest
     values:
       - ETCD_DATA_DIR=/var/lib/etcd

+ 1 - 1
roles/etcd/templates/etcd.docker.service

@@ -7,7 +7,7 @@ PartOf={{ openshift.docker.service_name }}.service
 [Service]
 EnvironmentFile={{ etcd_conf_file }}
 ExecStartPre=-/usr/bin/docker rm -f {{ etcd_service }}
-ExecStart=/usr/bin/docker run --name {{ etcd_service }} --rm -v {{ etcd_data_dir }}:{{ etcd_data_dir }}:z -v {{ etcd_conf_dir }}:{{ etcd_conf_dir }}:ro --env-file={{ etcd_conf_file }} --net=host --entrypoint=/usr/bin/etcd {{ openshift.etcd.etcd_image }}
+ExecStart=/usr/bin/docker run --name {{ etcd_service }} --rm -v {{ etcd_data_dir }}:{{ etcd_data_dir }}:z -v {{ etcd_conf_dir }}:{{ etcd_conf_dir }}:ro --env-file={{ etcd_conf_file }} --net=host --entrypoint=/usr/bin/etcd {{ etcd_image }}
 ExecStop=/usr/bin/docker stop {{ etcd_service }}
 SyslogIdentifier=etcd_container
 Restart=always

+ 0 - 4
roles/openshift_etcd_facts/tasks/main.yml

@@ -1,5 +1 @@
 ---
-- openshift_facts:
-    role: etcd
-    local_facts:
-      etcd_image: "{{ osm_etcd_image | default(None) }}"

+ 0 - 4
roles/openshift_facts/library/openshift_facts.py

@@ -1630,7 +1630,6 @@ def set_container_facts_if_unset(facts):
         cli_image = master_image
         node_image = 'openshift3/node'
         ovs_image = 'openshift3/openvswitch'
-        etcd_image = 'registry.access.redhat.com/rhel7/etcd'
         pod_image = 'openshift3/ose-pod'
         router_image = 'openshift3/ose-haproxy-router'
         registry_image = 'openshift3/ose-docker-registry'
@@ -1640,7 +1639,6 @@ def set_container_facts_if_unset(facts):
         cli_image = master_image
         node_image = 'openshift/node'
         ovs_image = 'openshift/openvswitch'
-        etcd_image = 'registry.access.redhat.com/rhel7/etcd'
         pod_image = 'openshift/origin-pod'
         router_image = 'openshift/origin-haproxy-router'
         registry_image = 'openshift/origin-docker-registry'
@@ -1667,8 +1665,6 @@ def set_container_facts_if_unset(facts):
         facts['common']['registry_image'] = registry_image
     if 'deployer_image' not in facts['common']:
         facts['common']['deployer_image'] = deployer_image
-    if 'etcd' in facts and 'etcd_image' not in facts['etcd']:
-        facts['etcd']['etcd_image'] = etcd_image
     if 'master' in facts and 'master_image' not in facts['master']:
         facts['master']['master_image'] = master_image
         facts['master']['master_system_image'] = master_image