Przeglądaj źródła

Add gte check for 3.2, update version checks to gte

Jason DeTiberus 9 lat temu
rodzic
commit
3e80073b3b

+ 1 - 1
playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml

@@ -258,7 +258,7 @@
       openshift_master_certs_no_etcd:
       - admin.crt
       - master.kubelet-client.crt
-      - "{{ 'master.proxy-client.crt' if openshift.common.version_greater_than_3_1_or_1_1 else omit }}"
+      - "{{ 'master.proxy-client.crt' if openshift.common.version_gte_3_1_or_1_1 else omit }}"
       - master.server.crt
       - openshift-master.crt
       - openshift-registry.crt

+ 1 - 1
playbooks/common/openshift-master/config.yml

@@ -150,7 +150,7 @@
       openshift_master_certs_no_etcd:
       - admin.crt
       - master.kubelet-client.crt
-      - "{{ 'master.proxy-client.crt' if openshift.common.version_greater_than_3_1_or_1_1 else omit }}"
+      - "{{ 'master.proxy-client.crt' if openshift.common.version_gte_3_1_or_1_1 else omit }}"
       - master.server.crt
       - openshift-master.crt
       - openshift-registry.crt

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

@@ -8,7 +8,7 @@
   when: openshift_use_openshift_sdn | default(false) | bool and openshift_use_nuage | default(false) | bool
 
 - fail:
-   msg: Nuage sdn can not be used with flannel 
+   msg: Nuage sdn can not be used with flannel
   when: openshift_use_flannel | default(false) | bool and openshift_use_nuage | default(false) | bool
 
 - fail:
@@ -49,7 +49,7 @@
 # For enterprise versions < 3.1 and origin versions < 1.1 we want to set the
 # hostname by default.
 - set_fact:
-    set_hostname_default: "{{ not openshift.common.version_greater_than_3_1_or_1_1 }}"
+    set_hostname_default: "{{ not openshift.common.version_gte_3_1_or_1_1 }}"
 
 - name: Set hostname
   command: >

+ 1 - 1
roles/openshift_examples/defaults/main.yml

@@ -6,7 +6,7 @@ openshift_examples_load_db_templates: true
 openshift_examples_load_xpaas: "{{ openshift_deployment_type != 'origin' }}"
 openshift_examples_load_quickstarts: true
 
-content_version: "{{ 'v1.1' if openshift.common.version_greater_than_3_1_or_1_1 else 'v1.0' }}"
+content_version: "{{ 'v1.1' if openshift.common.version_gte_3_1_or_1_1 else 'v1.0' }}"
 
 examples_base: "{{ openshift.common.config_base if openshift.common.is_containerized else '/usr/share/openshift' }}/examples"
 image_streams_base: "{{ examples_base }}/image-streams"

+ 15 - 11
roles/openshift_facts/library/openshift_facts.py

@@ -720,7 +720,7 @@ def set_deployment_facts_if_unset(facts):
 
 def set_version_facts_if_unset(facts):
     """ Set version facts. This currently includes common.version and
-        common.version_greater_than_3_1_or_1_1.
+        common.version_gte_3_1_or_1_1.
 
         Args:
             facts (dict): existing facts
@@ -732,16 +732,20 @@ def set_version_facts_if_unset(facts):
         facts['common']['version'] = version = get_openshift_version()
         if version is not None:
             if deployment_type == 'origin':
-                version_gt_3_1_or_1_1 = LooseVersion(version) > LooseVersion('1.0.6')
-                version_gt_3_1_1_or_1_1_1 = LooseVersion(version) > LooseVersion('1.1.1')
+                version_gte_3_1_or_1_1 = LooseVersion(version) >= LooseVersion('1.1.0')
+                version_gte_3_1_1_or_1_1_1 = LooseVersion(version) >= LooseVersion('1.1.1')
+                version_gte_3_2_or_1_2 = LooseVersion(version) >= LooseVersion('1.1.2')
             else:
-                version_gt_3_1_or_1_1 = LooseVersion(version) > LooseVersion('3.0.2.900')
-                version_gt_3_1_1_or_1_1_1 = LooseVersion(version) > LooseVersion('3.1.1')
+                version_gte_3_1_or_1_1 = LooseVersion(version) >= LooseVersion('3.1.0')
+                version_gte_3_1_1_or_1_1_1 = LooseVersion(version) >= LooseVersion('3.1.1')
+                version_gte_3_2_or_1_2 = LooseVersion(version) >= LooseVersion('3.2.0')
         else:
-            version_gt_3_1_or_1_1 = True
-            version_gt_3_1_1_or_1_1_1 = True
-        facts['common']['version_greater_than_3_1_or_1_1'] = version_gt_3_1_or_1_1
-        facts['common']['version_greater_than_3_1_1_or_1_1_1'] = version_gt_3_1_1_or_1_1_1
+            version_gte_3_1_or_1_1 = True
+            version_gte_3_1_1_or_1_1_1 = True
+            version_gte_3_2_or_1_2 = True
+        facts['common']['version_gte_3_1_or_1_1'] = version_gte_3_1_or_1_1
+        facts['common']['version_gte_3_1_1_or_1_1_1'] = version_gte_3_1_1_or_1_1_1
+        facts['common']['version_gte_3_2_or_1_2'] = version_gte_3_2_or_1_2
 
     return facts
 
@@ -756,12 +760,12 @@ def set_manageiq_facts_if_unset(facts):
             OpenShiftFactsInternalError:
     """
     if 'common' not in facts:
-        if 'version_greater_than_3_1_or_1_1' not in facts['common']:
+        if 'version_gte_3_1_or_1_1' not in facts['common']:
             raise OpenShiftFactsInternalError(
                 "Invalid invocation: The required facts are not set"
             )
     if 'use_manageiq' not in facts['common']:
-        facts['common']['use_manageiq'] = facts['common']['version_greater_than_3_1_or_1_1']
+        facts['common']['use_manageiq'] = facts['common']['version_gte_3_1_or_1_1']
 
     return facts
 

+ 6 - 6
roles/openshift_manageiq/tasks/main.yaml

@@ -1,7 +1,7 @@
 ---
 - fail:
     msg: "The openshift_manageiq role requires OpenShift Enterprise 3.1 or Origin 1.1."
-  when: not openshift.common.version_greater_than_3_1_or_1_1 | bool
+  when: not openshift.common.version_gte_3_1_or_1_1 | bool
 
 - name: Copy Configuration to temporary conf
   command: >
@@ -9,7 +9,7 @@
   changed_when: false
 
 - name: Add Managment Infrastructure project
-  command: > 
+  command: >
     {{ openshift.common.admin_binary }} new-project
     management-infra
     --description="Management Infrastructure"
@@ -20,9 +20,9 @@
 
 - name: Create Service Account
   shell: >
-    echo {{ manageiq_service_account | to_json | quote }} | 
-    {{ openshift.common.client_binary }} create 
-    -n management-infra 
+    echo {{ manageiq_service_account | to_json | quote }} |
+    {{ openshift.common.client_binary }} create
+    -n management-infra
     --config={{manage_iq_tmp_conf}}
     -f -
   register: osmiq_create_service_account
@@ -32,7 +32,7 @@
 - name: Create Cluster Role
   shell: >
     echo {{ manageiq_cluster_role | to_json | quote }} |
-    {{ openshift.common.client_binary }} create 
+    {{ openshift.common.client_binary }} create
     --config={{manage_iq_tmp_conf}}
     -f -
   register: osmiq_create_cluster_role

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

@@ -15,7 +15,7 @@
   when: openshift_master_ha | bool and ((openshift_master_cluster_method is not defined) or (openshift_master_cluster_method is defined and openshift_master_cluster_method not in ["native", "pacemaker"]))
 - fail:
     msg: "'native' high availability is not supported for the requested OpenShift version"
-  when: openshift_master_ha | bool and openshift_master_cluster_method == "native" and not openshift.common.version_greater_than_3_1_or_1_1 | bool
+  when: openshift_master_ha | bool and openshift_master_cluster_method == "native" and not openshift.common.version_gte_3_1_or_1_1 | bool
 - fail:
     msg: "openshift_master_cluster_password must be set for multi-master installations"
   when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and (openshift_master_cluster_password is not defined or not openshift_master_cluster_password)

+ 2 - 2
roles/openshift_master/templates/master.yaml.v1.j2

@@ -1,5 +1,5 @@
 apiLevels:
-{% if not openshift.common.version_greater_than_3_1_or_1_1 | bool %}
+{% if not openshift.common.version_gte_3_1_or_1_1 | bool %}
 - v1beta3
 {% endif %}
 - v1
@@ -91,7 +91,7 @@ kubeletClientInfo:
   port: 10250
 {% if openshift.master.embedded_kube | bool %}
 kubernetesMasterConfig:
-{% if not openshift.common.version_greater_than_3_1_or_1_1 | bool %}
+{% if not openshift.common.version_gte_3_1_or_1_1 | bool %}
   apiLevels:
   - v1beta3
   - v1

+ 1 - 1
roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.service.j2

@@ -7,7 +7,7 @@ Before={{ openshift.common.service_type }}-node.service
 Requires=network.target
 
 [Service]
-{% if openshift.common.version_greater_than_3_1_1_or_1_1_1 | bool %}
+{% if openshift.common.version_gte_3_1_1_or_1_1_1 | bool %}
 Type=notify
 {% else %}
 Type=simple

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

@@ -39,7 +39,7 @@
     state: hard
   with_nested:
   - masters_needing_certs
-  - "{{ master_certificates | union(master_31_certificates) if openshift.common.version_greater_than_3_1_or_1_1 | bool else master_certificates }}"
+  - "{{ master_certificates | union(master_31_certificates) if openshift.common.version_gte_3_1_or_1_1 | bool else master_certificates }}"
 
 - name: Create the master certificates if they do not already exist
   command: >

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

@@ -17,7 +17,7 @@
       # TODO: Replace this with a lookup or filter plugin.
       dns_ip: "{{ openshift_dns_ip
                   | default(openshift_master_cluster_vip
-                  | default(None if openshift.common.version_greater_than_3_1_or_1_1 | bool else openshift_node_first_master_ip | default(None, true), true), true) }}"
+                  | default(None if openshift.common.version_gte_3_1_or_1_1 | bool else openshift_node_first_master_ip | default(None, true), true), true) }}"
   - role: node
     local_facts:
       annotations: "{{ openshift_node_annotations | default(none) }}"