From 6575595891f71e7d9b9ac929b9ba58117a65e17b Mon Sep 17 00:00:00 2001
From: Eric Wolinetz <ewolinet@redhat.com>
Date: Mon, 6 Nov 2017 15:53:55 -0600
Subject: Updating logging components image defaulting pattern to match
 openshift_logging pattern

---
 roles/openshift_logging_fluentd/defaults/main.yml           |  2 --
 .../openshift_logging_fluentd/tasks/determine_version.yaml  | 10 +++++-----
 roles/openshift_logging_fluentd/tasks/main.yaml             | 13 +++++++++++++
 roles/openshift_logging_fluentd/vars/default_images.yml     |  3 +++
 .../openshift_logging_fluentd/vars/openshift-enterprise.yml |  3 +++
 5 files changed, 24 insertions(+), 7 deletions(-)
 create mode 100644 roles/openshift_logging_fluentd/vars/default_images.yml
 create mode 100644 roles/openshift_logging_fluentd/vars/openshift-enterprise.yml

(limited to 'roles/openshift_logging_fluentd')

diff --git a/roles/openshift_logging_fluentd/defaults/main.yml b/roles/openshift_logging_fluentd/defaults/main.yml
index 861935c99..9b58e4456 100644
--- a/roles/openshift_logging_fluentd/defaults/main.yml
+++ b/roles/openshift_logging_fluentd/defaults/main.yml
@@ -1,7 +1,5 @@
 ---
 ### General logging settings
-openshift_logging_fluentd_image_prefix: "{{ openshift_logging_image_prefix | default(__openshift_logging_image_prefix) }}"
-openshift_logging_fluentd_image_version: "{{ openshift_logging_image_version | default('latest') }}"
 openshift_logging_fluentd_image_pull_secret: "{{ openshift_hosted_logging_image_pull_secret | default('') }}"
 openshift_logging_fluentd_master_url: "https://kubernetes.default.svc.{{ openshift.common.dns_domain }}"
 openshift_logging_fluentd_namespace: logging
diff --git a/roles/openshift_logging_fluentd/tasks/determine_version.yaml b/roles/openshift_logging_fluentd/tasks/determine_version.yaml
index a1ba71b1b..6848eb512 100644
--- a/roles/openshift_logging_fluentd/tasks/determine_version.yaml
+++ b/roles/openshift_logging_fluentd/tasks/determine_version.yaml
@@ -1,16 +1,16 @@
 ---
 # debating making this a module instead?
 - fail:
-    msg: Missing version to install provided by 'openshift_logging_image_version'
-  when: not openshift_logging_image_version or openshift_logging_image_version == ''
+    msg: Missing version to install provided by 'openshift_logging_fluentd_image_version'
+  when: not openshift_logging_fluentd_image_version or openshift_logging_fluentd_image_version == ''
 
 - set_fact:
     fluentd_version: "{{ __latest_fluentd_version }}"
-  when: openshift_logging_image_version == 'latest'
+  when: openshift_logging_fluentd_image_version == 'latest'
 
 # should we just assume that we will have the correct major version?
-- set_fact: fluentd_version="{{ openshift_logging_image_version | regex_replace('^v?(?P<major>\d)\.(?P<minor>\d).*$', '3_\\g<minor>') }}"
-  when: openshift_logging_image_version != 'latest'
+- set_fact: fluentd_version="{{ openshift_logging_fluentd_image_version | regex_replace('^v?(?P<major>\d)\.(?P<minor>\d).*$', '3_\\g<minor>') }}"
+  when: openshift_logging_fluentd_image_version != 'latest'
 
 - fail:
     msg: Invalid version specified for Fluentd
diff --git a/roles/openshift_logging_fluentd/tasks/main.yaml b/roles/openshift_logging_fluentd/tasks/main.yaml
index 2f89c3f9f..b99b8ee9d 100644
--- a/roles/openshift_logging_fluentd/tasks/main.yaml
+++ b/roles/openshift_logging_fluentd/tasks/main.yaml
@@ -34,6 +34,19 @@
     msg: WARNING Use of openshift_logging_mux_client_mode=minimal is not recommended due to current scaling issues
   when: openshift_logging_mux_client_mode is defined and openshift_logging_mux_client_mode == 'minimal'
 
+- name: Set default image variables based on deployment_type
+  include_vars: "{{ var_file_name }}"
+  with_first_found:
+    - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
+    - "default_images.yml"
+  loop_control:
+    loop_var: var_file_name
+
+- name: Set fluentd image facts
+  set_fact:
+    openshift_logging_fluentd_image_prefix: "{{ openshift_logging_fluentd_image_prefix | default(__openshift_logging_fluentd_image_prefix) }}"
+    openshift_logging_fluentd_image_version: "{{ openshift_logging_fluentd_image_version | default(__openshift_logging_fluentd_image_version) }}"
+
 - include: determine_version.yaml
 
 # allow passing in a tempdir
diff --git a/roles/openshift_logging_fluentd/vars/default_images.yml b/roles/openshift_logging_fluentd/vars/default_images.yml
new file mode 100644
index 000000000..6d127b730
--- /dev/null
+++ b/roles/openshift_logging_fluentd/vars/default_images.yml
@@ -0,0 +1,3 @@
+---
+__openshift_logging_fluentd_image_prefix: "{{ openshift_logging_image_prefix | default('docker.io/openshift/origin-') }}"
+__openshift_logging_fluentd_image_version: "{{ openshift_logging_image_version | default('latest') }}"
diff --git a/roles/openshift_logging_fluentd/vars/openshift-enterprise.yml b/roles/openshift_logging_fluentd/vars/openshift-enterprise.yml
new file mode 100644
index 000000000..d0c74f1fb
--- /dev/null
+++ b/roles/openshift_logging_fluentd/vars/openshift-enterprise.yml
@@ -0,0 +1,3 @@
+---
+__openshift_logging_fluentd_image_prefix: "{{ openshift_logging_image_prefix | default('registry.access.redhat.com/openshift3/') }}"
+__openshift_logging_fluentd_image_version: "{{ openshift_logging_image_version | default ('v3.7') }}"
-- 
cgit v1.2.3