From 4b394fc566333d4d9f4bc789b03b9a68c22bb028 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Mon, 7 Mar 2016 13:35:46 -0500 Subject: Support openshift_image_tag This is the containerized openshift_pkg_version equivalent. Originally I was hoping to reuse openshift_pkg_version for containerized installs but the fact that it's very coupled to yum made that pretty ugly. However, I did opt to rely on the previously existing 'openshift_version' variable. Containerized and RPM installs can both use that variable and it will be set appropriately if either openshift_pkg_version or openshift_image_tag are set. I suspect someday containerized installs will be the only option and I didn't can to have thinkgs like openshift_pkg_version and openshift_image_tag in the playbooks anymore the necessary. --- roles/openshift_cli/templates/openshift.j2 | 2 +- roles/openshift_cli/vars/main.yml | 2 ++ roles/openshift_facts/library/openshift_facts.py | 2 +- roles/openshift_master/templates/atomic-openshift-master.j2 | 2 +- .../templates/native-cluster/atomic-openshift-master-api.j2 | 2 +- .../templates/native-cluster/atomic-openshift-master-controllers.j2 | 2 +- roles/openshift_master/vars/main.yml | 2 +- roles/openshift_node/tasks/main.yml | 2 +- roles/openshift_node/templates/openvswitch.sysconfig.j2 | 2 +- roles/openshift_node/vars/main.yml | 2 +- 10 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 roles/openshift_cli/vars/main.yml (limited to 'roles') diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index f969a4bab..437e08aab 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -5,7 +5,7 @@ fi cmd=`basename $0` user=`id -u` group=`id -g` -image_tag={{ image_tag | default(openshift.common.image_tag) }} +image_tag={{ openshift_version }} >&2 echo """ ================================================================================ diff --git a/roles/openshift_cli/vars/main.yml b/roles/openshift_cli/vars/main.yml new file mode 100644 index 000000000..4d0c87497 --- /dev/null +++ b/roles/openshift_cli/vars/main.yml @@ -0,0 +1,2 @@ +--- +openshift_version: "{{ openshift_image_tag | default(openshift.common.image_tag) | default('') }}" diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 71e3284af..596e4f894 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -916,7 +916,7 @@ def get_openshift_version(facts, cli_image=None): if container is not None: exit_code, output, _ = module.run_command(['docker', 'exec', container, 'openshift', 'version']) - # if for some reason the container is installed by not running + # if for some reason the container is installed but not running # we'll fall back to using docker run later in this method. if exit_code == 0: version = parse_openshift_version(output) diff --git a/roles/openshift_master/templates/atomic-openshift-master.j2 b/roles/openshift_master/templates/atomic-openshift-master.j2 index 9342614a3..8602a492e 100644 --- a/roles/openshift_master/templates/atomic-openshift-master.j2 +++ b/roles/openshift_master/templates/atomic-openshift-master.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized %} -IMAGE_VERSION={{ openshift.common.image_tag }} +IMAGE_VERSION={{ openshift_version }} {% endif %} # Proxy configuration diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 index cfa3b3bfc..f953de404 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.api_port }} --master={{ openshift.master.loopback_api_url }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized %} -IMAGE_VERSION={{ openshift.common.image_tag }} +IMAGE_VERSION={{ openshift_version }} {% endif %} # Proxy configuration diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 index 0b86f5f6b..30da9d396 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.controllers_port }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized %} -IMAGE_VERSION={{ openshift.common.image_tag }} +IMAGE_VERSION={{ openshift_version }} {% endif %} # Proxy configuration diff --git a/roles/openshift_master/vars/main.yml b/roles/openshift_master/vars/main.yml index fe88c3c16..6b5a73238 100644 --- a/roles/openshift_master/vars/main.yml +++ b/roles/openshift_master/vars/main.yml @@ -6,7 +6,7 @@ loopback_context_string: "current-context: {{ openshift.master.loopback_context_ openshift_master_scheduler_conf: "{{ openshift_master_config_dir }}/scheduler.json" openshift_master_session_secrets_file: "{{ openshift_master_config_dir }}/session-secrets.yaml" openshift_master_policy: "{{ openshift_master_config_dir }}/policy.json" -openshift_version: "{{ openshift_pkg_version | default('') }}" +openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag) | default(openshift.common.image_tag) | default('') }}" ha_svc_template_path: "{{ 'docker-cluster' if openshift.common.is_containerized | bool else 'native-cluster' }}" ha_svc_svc_dir: "{{ '/etc/systemd/system' if openshift.common.is_containerized | bool else '/usr/lib/systemd/system' }}" diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 71ed9ba08..b87c2aa21 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -110,7 +110,7 @@ - regex: '^CONFIG_FILE=' line: "CONFIG_FILE={{ openshift_node_config_file }}" - regex: '^IMAGE_VERSION=' - line: "IMAGE_VERSION=v{{ openshift.common.version.split('-')[0] }}" + line: "IMAGE_VERSION={{ openshift_version }}" notify: - restart node diff --git a/roles/openshift_node/templates/openvswitch.sysconfig.j2 b/roles/openshift_node/templates/openvswitch.sysconfig.j2 index 190ffd51b..1f8c20e07 100644 --- a/roles/openshift_node/templates/openvswitch.sysconfig.j2 +++ b/roles/openshift_node/templates/openvswitch.sysconfig.j2 @@ -1 +1 @@ -IMAGE_VERSION={{ openshift.common.image_tag }} +IMAGE_VERSION={{ openshift_version }} diff --git a/roles/openshift_node/vars/main.yml b/roles/openshift_node/vars/main.yml index 43dc50ca8..28582baf1 100644 --- a/roles/openshift_node/vars/main.yml +++ b/roles/openshift_node/vars/main.yml @@ -1,4 +1,4 @@ --- openshift_node_config_dir: "{{ openshift.common.config_base }}/node" openshift_node_config_file: "{{ openshift_node_config_dir }}/node-config.yaml" -openshift_version: "{{ openshift_pkg_version | default('') }}" +openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag) | default(openshift.common.image_tag) | default('') }}" -- cgit v1.2.3