summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2016-06-08 16:59:54 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2017-02-10 10:53:43 +0100
commit595f0f307aeb78de499891f21b99057a6e6b17f0 (patch)
tree2e4179deabde8c08b8a403cd69ea654fcc18d326
parentfc96d8d22f6c277b599e6e2fa4e9cc06814a9460 (diff)
downloadopenshift-595f0f307aeb78de499891f21b99057a6e6b17f0.tar.gz
openshift-595f0f307aeb78de499891f21b99057a6e6b17f0.tar.bz2
openshift-595f0f307aeb78de499891f21b99057a6e6b17f0.tar.xz
openshift-595f0f307aeb78de499891f21b99057a6e6b17f0.zip
atomic-openshift: install as a system container
Use use_system_containers=true in the inventory file alternatively you can select each component as: use_openvswitch_system_container=true use_node_system_container=true use_master_system_container=true system_images_registry holds the registry from where to fetch system containers. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--roles/openshift_facts/defaults/main.yml2
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py3
-rw-r--r--roles/openshift_facts/tasks/main.yml7
-rw-r--r--roles/openshift_master/tasks/main.yml4
-rw-r--r--roles/openshift_master/tasks/system_container.yml17
-rw-r--r--roles/openshift_master/tasks/systemd_units.yml6
-rw-r--r--roles/openshift_node/tasks/main.yml2
-rw-r--r--roles/openshift_node/tasks/node_system_container.yml19
-rw-r--r--roles/openshift_node/tasks/openvswitch_system_container.yml19
-rw-r--r--roles/openshift_node/tasks/systemd_units.yml26
10 files changed, 97 insertions, 8 deletions
diff --git a/roles/openshift_facts/defaults/main.yml b/roles/openshift_facts/defaults/main.yml
new file mode 100644
index 000000000..28b388560
--- /dev/null
+++ b/roles/openshift_facts/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+use_system_containers: false
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index ec2942b69..7a0642cce 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1785,11 +1785,14 @@ def set_container_facts_if_unset(facts):
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
if 'node' in facts:
if 'node_image' not in facts['node']:
facts['node']['node_image'] = node_image
+ facts['node']['node_system_image'] = node_image
if 'ovs_image' not in facts['node']:
facts['node']['ovs_image'] = ovs_image
+ facts['node']['ovs_system_image'] = ovs_image
if safe_get_bool(facts['common']['is_containerized']):
facts['common']['admin_binary'] = '/usr/local/bin/oadm'
diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml
index b7b521f1a..bf1a94e85 100644
--- a/roles/openshift_facts/tasks/main.yml
+++ b/roles/openshift_facts/tasks/main.yml
@@ -9,6 +9,9 @@
l_is_atomic: "{{ ostree_booted.stat.exists }}"
- set_fact:
l_is_containerized: "{{ (l_is_atomic | bool) or (containerized | default(false) | bool) }}"
+ l_is_openvswitch_system_container: "{{ (use_openvswitch_system_container | default(use_system_containers) | bool) }}"
+ l_is_node_system_container: "{{ (use_node_system_container | default(use_system_containers) | bool) }}"
+ l_is_master_system_container: "{{ (use_master_system_container | default(use_system_containers) | bool) }}"
- name: Ensure various deps are installed
package: name={{ item }} state=present
@@ -27,6 +30,10 @@
hostname: "{{ openshift_hostname | default(None) }}"
ip: "{{ openshift_ip | default(None) }}"
is_containerized: "{{ l_is_containerized | default(None) }}"
+ is_openvswitch_system_container: "{{ l_is_openvswitch_system_container | default(false) }}"
+ is_node_system_container: "{{ l_is_node_system_container | default(false) }}"
+ is_master_system_container: "{{ l_is_master_system_container | default(false) }}"
+ system_images_registry: "{{ system_images_registry | default('') }}"
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) }}"
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 9cd6b6c81..2ef61cddf 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -131,6 +131,10 @@
- name: Install the systemd units
include: systemd_units.yml
+- name: Install Master system container
+ include: system_container.yml
+ when: openshift.common.is_containerized | bool and openshift.common.is_master_system_container | bool
+
- name: Create session secrets file
template:
dest: "{{ openshift.master.session_secrets_file }}"
diff --git a/roles/openshift_master/tasks/system_container.yml b/roles/openshift_master/tasks/system_container.yml
new file mode 100644
index 000000000..25c179e71
--- /dev/null
+++ b/roles/openshift_master/tasks/system_container.yml
@@ -0,0 +1,17 @@
+---
+- name: Pre-pull master system container image
+ command: >
+ atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Pulling layer' in pull_result.stdout"
+
+- name: Uninstall Master system container package
+ command: >
+ atomic uninstall {{ openshift.common.service_type }}-master
+ failed_when: False
+ when: openshift.common.version != openshift_version
+
+- name: Install Master system container package
+ command: >
+ atomic install --system --name={{ openshift.common.service_type }}-master {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
+ when: openshift.common.version != openshift_version
diff --git a/roles/openshift_master/tasks/systemd_units.yml b/roles/openshift_master/tasks/systemd_units.yml
index 39ea42ab3..4ab98cbbb 100644
--- a/roles/openshift_master/tasks/systemd_units.yml
+++ b/roles/openshift_master/tasks/systemd_units.yml
@@ -20,14 +20,14 @@
docker pull {{ openshift.master.master_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
- when: openshift.common.is_containerized | bool
+ when: openshift.common.is_containerized | bool and not openshift.common.is_master_system_container | bool
# workaround for missing systemd unit files
- name: Create the systemd unit files
template:
src: "master_docker/master.docker.service.j2"
dest: "{{ containerized_svc_dir }}/{{ openshift.common.service_type }}-master.service"
- when: openshift.common.is_containerized | bool and (openshift.master.ha is not defined or not openshift.master.ha | bool)
+ when: openshift.common.is_containerized | bool and (openshift.master.ha is not defined or not openshift.master.ha | bool and not openshift.common.is_master_system_container | bool)
register: create_master_unit_file
- command: systemctl daemon-reload
@@ -132,7 +132,7 @@
dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
src: master_docker/master.docker.service.j2
register: install_result
- when: openshift.common.is_containerized | bool and openshift.master.ha is defined and not openshift.master.ha | bool
+ when: openshift.common.is_containerized | bool and openshift.master.ha is defined and not openshift.master.ha | bool and not openshift.common.is_master_system_container | bool
- name: Preserve Master Proxy Config options
command: grep PROXY /etc/sysconfig/{{ openshift.common.service_type }}-master
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index e970c4cd1..3e888b77f 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -69,7 +69,7 @@
- name: Persist net.ipv4.ip_forward sysctl entry
sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes
-- name: Start and enable openvswitch docker service
+- name: Start and enable openvswitch service
systemd:
name: openvswitch.service
enabled: yes
diff --git a/roles/openshift_node/tasks/node_system_container.yml b/roles/openshift_node/tasks/node_system_container.yml
new file mode 100644
index 000000000..759792b8b
--- /dev/null
+++ b/roles/openshift_node/tasks/node_system_container.yml
@@ -0,0 +1,19 @@
+---
+- name: Pre-pull node system container image
+ command: >
+ atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Pulling layer' in pull_result.stdout"
+
+- name: Uninstall Node system container package
+ command: >
+ atomic uninstall {{ openshift.common.service_type }}-node
+ failed_when: False
+ when: openshift.common.version != openshift_version | bool
+
+- name: Install Node system container package
+ command: >
+ atomic install --system --name={{ openshift.common.service_type }}-node {{ openshift.common.system_images_registry }}/{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
+ register: install_node_result
+ changed_when: "'Extracting' in pull_result.stdout"
+ when: openshift.common.version != openshift_version | bool
diff --git a/roles/openshift_node/tasks/openvswitch_system_container.yml b/roles/openshift_node/tasks/openvswitch_system_container.yml
new file mode 100644
index 000000000..12d62be69
--- /dev/null
+++ b/roles/openshift_node/tasks/openvswitch_system_container.yml
@@ -0,0 +1,19 @@
+---
+- name: Pre-pull OpenVSwitch system container image
+ command: >
+ atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Pulling layer' in pull_result.stdout"
+
+- name: Uninstall OpenvSwitch system container package
+ command: >
+ atomic uninstall openvswitch
+ failed_when: False
+ when: openshift.common.version != openshift_version | bool
+
+- name: Install OpenvSwitch system container package
+ command: >
+ atomic install --system --name=openvswitch {{ openshift.common.system_images_registry }}/{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
+ when: openshift.common.version != openshift_version | bool
+ notify:
+ - restart docker
diff --git a/roles/openshift_node/tasks/systemd_units.yml b/roles/openshift_node/tasks/systemd_units.yml
index 5243a87fe..941fd1d28 100644
--- a/roles/openshift_node/tasks/systemd_units.yml
+++ b/roles/openshift_node/tasks/systemd_units.yml
@@ -7,14 +7,14 @@
docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
- when: openshift.common.is_containerized | bool
+ when: openshift.common.is_containerized | bool and not openshift.common.is_node_system_container | bool
- name: Pre-pull openvswitch image
command: >
docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
- when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool
+ when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool and not openshift.common.is_node_system_container | bool
- name: Install Node dependencies docker service file
template:
@@ -28,7 +28,9 @@
dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
src: openshift.docker.node.service
register: install_node_result
- when: openshift.common.is_containerized | bool
+ when:
+ - openshift.common.is_containerized | bool
+ - not openshift.common.is_node_system_container | bool
- name: Create the openvswitch service env file
template:
@@ -39,6 +41,19 @@
notify:
- restart openvswitch
+- name: Install Node system container
+ include: node_system_container.yml
+ when:
+ - openshift.common.is_containerized | bool
+ - openshift.common.is_node_system_container | bool
+
+- name: Install OpenvSwitch system containers
+ include: openvswitch_system_container.yml
+ when:
+ - openshift.common.use_openshift_sdn | default(true) | bool
+ - openshift.common.is_containerized | bool
+ - openshift.common.is_openvswitch_system_container | bool
+
# May be a temporary workaround.
# https://bugzilla.redhat.com/show_bug.cgi?id=1331590
- name: Create OpenvSwitch service.d directory
@@ -58,7 +73,10 @@
template:
dest: "/etc/systemd/system/openvswitch.service"
src: openvswitch.docker.service
- when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | default(true) | bool
+ when:
+ - openshift.common.is_containerized | bool
+ - openshift.common.use_openshift_sdn | default(true) | bool
+ - not openshift.common.is_openvswitch_system_container | bool
notify:
- restart openvswitch