Przeglądaj źródła

Merge pull request #6201 from mgugino-upstream-stage/system-reg

Fix system_images_registry variable
Michael Gugino 7 lat temu
rodzic
commit
f983b99d4a

+ 0 - 15
playbooks/init/facts.yml

@@ -103,20 +103,6 @@
         or (openshift_use_node_system_container | default(False)) | bool
         or (openshift_use_master_system_container | default(False)) | bool
 
-  - name: Default system_images_registry to a enterprise registry
-    set_fact:
-      system_images_registry: "registry.access.redhat.com"
-    when:
-    - system_images_registry is not defined
-    - openshift_deployment_type == "openshift-enterprise"
-
-  - name: Default system_images_registry to community registry
-    set_fact:
-      system_images_registry: "docker.io"
-    when:
-    - system_images_registry is not defined
-    - openshift_deployment_type == "origin"
-
   - name: Gather Cluster facts and set is_containerized if needed
     openshift_facts:
       role: common
@@ -129,7 +115,6 @@
         is_containerized: "{{ l_is_containerized | default(None) }}"
         is_openvswitch_system_container: "{{ l_is_openvswitch_system_container | default(false) }}"
         is_master_system_container: "{{ l_is_master_system_container | default(false) }}"
-        system_images_registry: "{{ system_images_registry }}"
         public_hostname: "{{ openshift_public_hostname | default(None) }}"
         public_ip: "{{ openshift_public_ip | default(None) }}"
         portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"

+ 5 - 0
roles/openshift_cli/defaults/main.yml

@@ -1 +1,6 @@
 ---
+system_images_registry_dict:
+  openshift-enterprise: "registry.access.redhat.com"
+  origin: "docker.io"
+
+system_images_registry: "{{ system_images_registry_dict[openshift_deployment_type | default('origin')] }}"

+ 2 - 2
roles/openshift_cli/tasks/main.yml

@@ -28,13 +28,13 @@
 - block:
   - name: Pull CLI Image
     command: >
-      atomic pull --storage ostree {{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.common.cli_image }}:{{ openshift_image_tag }}
+      atomic pull --storage ostree {{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.common.cli_image }}:{{ openshift_image_tag }}
     register: pull_result
     changed_when: "'Pulling layer' in pull_result.stdout"
 
   - name: Copy client binaries/symlinks out of CLI image for use on the host
     openshift_container_binary_sync:
-      image: "{{ '' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.common.cli_image }}"
+      image: "{{ '' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.common.cli_image }}"
       tag: "{{ openshift_image_tag }}"
       backend: "atomic"
   when:

+ 6 - 0
roles/openshift_master/defaults/main.yml

@@ -7,6 +7,12 @@ openshift_master_debug_level: "{{ debug_level | default(2) }}"
 r_openshift_master_firewall_enabled: "{{ os_firewall_enabled | default(True) }}"
 r_openshift_master_use_firewalld: "{{ os_firewall_use_firewalld | default(False) }}"
 
+system_images_registry_dict:
+  openshift-enterprise: "registry.access.redhat.com"
+  origin: "docker.io"
+
+system_images_registry: "{{ system_images_registry_dict[openshift_deployment_type | default('origin')] }}"
+
 openshift_node_ips: []
 r_openshift_master_clean_install: false
 r_openshift_master_etcd3_storage: false

+ 3 - 3
roles/openshift_master/tasks/system_container.yml

@@ -6,7 +6,7 @@
 
 - name: Pre-pull master system container image
   command: >
-    atomic pull --storage=ostree {{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
+    atomic pull --storage=ostree {{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
   register: l_pull_result
   changed_when: "'Pulling layer' in l_pull_result.stdout"
 
@@ -18,7 +18,7 @@
 - name: Install or Update HA api master system container
   oc_atomic_container:
     name: "{{ openshift.common.service_type }}-master-api"
-    image: "{{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}"
+    image: "{{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}"
     state: latest
     values:
     - COMMAND=api
@@ -26,7 +26,7 @@
 - name: Install or Update HA controller master system container
   oc_atomic_container:
     name: "{{ openshift.common.service_type }}-master-controllers"
-    image: "{{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}"
+    image: "{{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}"
     state: latest
     values:
     - COMMAND=controllers

+ 6 - 0
roles/openshift_node/defaults/main.yml

@@ -9,6 +9,12 @@ l_is_node_system_container: "{{ (openshift_use_node_system_container | default(o
 openshift_deployment_type: "{{ openshift_deployment_type | default('origin') }}"
 openshift_service_type: "{{ 'origin' if openshift_deployment_type == 'origin' else 'atomic-openshift' }}"
 
+system_images_registry_dict:
+  openshift-enterprise: "registry.access.redhat.com"
+  origin: "docker.io"
+
+system_images_registry: "{{ system_images_registry_dict[openshift_deployment_type | default('origin')] }}"
+
 openshift_image_tag: ''
 
 default_r_openshift_node_image_prep_packages:

+ 2 - 2
roles/openshift_node/tasks/node_system_container.yml

@@ -6,14 +6,14 @@
 
 - name: Pre-pull node system container image
   command: >
-    atomic pull --storage=ostree {{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
+    atomic pull --storage=ostree {{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
   register: pull_result
   changed_when: "'Pulling layer' in pull_result.stdout"
 
 - name: Install or Update node system container
   oc_atomic_container:
     name: "{{ openshift.common.service_type }}-node"
-    image: "{{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}"
+    image: "{{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}"
     values:
     - "DNS_DOMAIN={{ openshift.common.dns_domain }}"
     - "DOCKER_SERVICE={{ openshift.docker.service_name }}.service"

+ 2 - 2
roles/openshift_node/tasks/openvswitch_system_container.yml

@@ -17,14 +17,14 @@
 
 - name: Pre-pull OpenVSwitch system container image
   command: >
-    atomic pull --storage=ostree {{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
+    atomic pull --storage=ostree {{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
   register: pull_result
   changed_when: "'Pulling layer' in pull_result.stdout"
 
 - name: Install or Update OpenVSwitch system container
   oc_atomic_container:
     name: openvswitch
-    image: "{{ 'docker:' if openshift.common.system_images_registry == 'docker' else openshift.common.system_images_registry + '/' }}{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}"
+    image: "{{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}"
     state: latest
     values:
       - "DOCKER_SERVICE={{ l_service_name }}"