From 2ae1a0975472d47063575710223b2fa7431499c8 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 29 Nov 2017 17:04:13 +0100 Subject: crio: define and use l_is_node_system_container Signed-off-by: Giuseppe Scrivano --- roles/container_runtime/defaults/main.yml | 3 +++ roles/container_runtime/tasks/systemcontainer_crio.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/container_runtime/defaults/main.yml b/roles/container_runtime/defaults/main.yml index bd96965ac..c5a21ba46 100644 --- a/roles/container_runtime/defaults/main.yml +++ b/roles/container_runtime/defaults/main.yml @@ -81,6 +81,7 @@ l_insecure_crio_registries: "{{ '\"{}\"'.format('\", \"'.join(l2_docker_insecure l_crio_registries: "{{ l2_docker_additional_registries + ['docker.io'] }}" l_additional_crio_registries: "{{ '\"{}\"'.format('\", \"'.join(l_crio_registries)) }}" + openshift_crio_image_tag_default: "latest" l_crt_crio_image_tag_dict: @@ -127,3 +128,5 @@ l_docker_image_tag: "{{ l_crt_docker_image_tag_dict[openshift_deployment_type] } l_docker_image_default: "{{ l_docker_image_prepend }}/{{ openshift_docker_service_name }}:{{ l_docker_image_tag }}" l_docker_image: "{{ openshift_docker_systemcontainer_image_override | default(l_docker_image_default) }}" + +l_is_node_system_container: "{{ (openshift_use_node_system_container | default(openshift_use_system_containers | default(false)) | bool) }}" diff --git a/roles/container_runtime/tasks/systemcontainer_crio.yml b/roles/container_runtime/tasks/systemcontainer_crio.yml index 5ea7df650..61f122f3c 100644 --- a/roles/container_runtime/tasks/systemcontainer_crio.yml +++ b/roles/container_runtime/tasks/systemcontainer_crio.yml @@ -4,7 +4,7 @@ fail: msg='Cannot use CRI-O with node configured as a Docker container' when: - openshift.common.is_containerized | bool - - not openshift.common.is_node_system_container | bool + - not l_is_node_system_container | bool - include_tasks: common/pre.yml -- cgit v1.2.3 From 26472ab005a162cd6ae9ededa95469133e3707b7 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 10:39:03 +0100 Subject: openshift_version: add dependency to container_runtime Signed-off-by: Giuseppe Scrivano --- roles/openshift_version/meta/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml index 5d7683120..1e04c18da 100644 --- a/roles/openshift_version/meta/main.yml +++ b/roles/openshift_version/meta/main.yml @@ -13,3 +13,4 @@ galaxy_info: - cloud dependencies: - role: lib_utils +- role: container_runtime -- cgit v1.2.3 From 5ee8df87789c9ee2d177a604c19f105d0c478c64 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 10:40:16 +0100 Subject: openshift_version: define openshift_use_crio_only Signed-off-by: Giuseppe Scrivano --- roles/openshift_version/defaults/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/openshift_version/defaults/main.yml b/roles/openshift_version/defaults/main.yml index 4adf04e90..354699637 100644 --- a/roles/openshift_version/defaults/main.yml +++ b/roles/openshift_version/defaults/main.yml @@ -6,3 +6,5 @@ openshift_service_type_dict: openshift-enterprise: atomic-openshift openshift_service_type: "{{ openshift_service_type_dict[openshift_deployment_type] }}" + +openshift_use_crio_only: False -- cgit v1.2.3 From 7d7c4f3056fd3456f5e00f75da2154300f7e96ee Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 13:07:17 +0100 Subject: openshift_version: add dependency to openshift_facts Signed-off-by: Giuseppe Scrivano --- roles/openshift_version/meta/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml index 1e04c18da..2d317700a 100644 --- a/roles/openshift_version/meta/main.yml +++ b/roles/openshift_version/meta/main.yml @@ -14,3 +14,4 @@ galaxy_info: dependencies: - role: lib_utils - role: container_runtime +- role: openshift_facts -- cgit v1.2.3 From 9c29b47f788b588d6f126a73e4eb03839cfb848f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 13:52:42 +0100 Subject: container-engine: log-opts is a dictionary in the daemon.json file Signed-off-by: Giuseppe Scrivano --- filter_plugins/oo_filters.py | 8 ++++++++ roles/container_runtime/defaults/main.yml | 1 + roles/container_runtime/templates/daemon.json | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index 2cb30123e..3eaf2aed5 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -375,6 +375,13 @@ def oo_split(string, separator=','): return string.split(separator) +def oo_list_to_dict(lst, separator='='): + """ This converts a list of ["k=v"] to a dictionary {k: v}. + """ + kvs = [i.split(separator) for i in lst] + return {k: v for k, v in kvs} + + def oo_haproxy_backend_masters(hosts, port): """ This takes an array of dicts and returns an array of dicts to be used as a backend for the haproxy role @@ -969,6 +976,7 @@ class FilterModule(object): "oo_combine_dict": oo_combine_dict, "oo_dict_to_list_of_dict": oo_dict_to_list_of_dict, "oo_split": oo_split, + "oo_list_to_dict": oo_list_to_dict, "oo_filter_list": oo_filter_list, "oo_parse_heat_stack_outputs": oo_parse_heat_stack_outputs, "oo_parse_named_certificates": oo_parse_named_certificates, diff --git a/roles/container_runtime/defaults/main.yml b/roles/container_runtime/defaults/main.yml index c5a21ba46..d7eb8663f 100644 --- a/roles/container_runtime/defaults/main.yml +++ b/roles/container_runtime/defaults/main.yml @@ -59,6 +59,7 @@ docker_default_storage_path: /var/lib/docker # Set local versions of facts that must be in json format for container-daemon.json # NOTE: When jinja2.9+ is used the container-daemon.json file can move to using tojson l_docker_log_options: "{{ l2_docker_log_options | to_json }}" +l_docker_log_options_dict: "{{ l2_docker_log_options | oo_list_to_dict | to_json }}" l_docker_additional_registries: "{{ l2_docker_additional_registries | to_json }}" l_docker_blocked_registries: "{{ l2_docker_blocked_registries | to_json }}" l_docker_insecure_registries: "{{ l2_docker_insecure_registries | to_json }}" diff --git a/roles/container_runtime/templates/daemon.json b/roles/container_runtime/templates/daemon.json index 383963bd3..7c35d3080 100644 --- a/roles/container_runtime/templates/daemon.json +++ b/roles/container_runtime/templates/daemon.json @@ -8,7 +8,7 @@ {% if openshift_docker_log_driver is defined %} "log-driver": "{{ openshift_docker_log_driver }}", {%- endif %} - "log-opts": {{ l_docker_log_options }}, + "log-opts": {{ l_docker_log_options_dict }}, "runtimes": { "oci": { "path": "/usr/libexec/docker/docker-runc-current" -- cgit v1.2.3 From 5431d1228d795cf6d0f5087779ad9136b847f428 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 15:52:40 +0100 Subject: container-engine: skip openshift_docker_log_driver when it is False Signed-off-by: Giuseppe Scrivano --- roles/container_runtime/templates/daemon.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/container_runtime/templates/daemon.json b/roles/container_runtime/templates/daemon.json index 7c35d3080..1a72d812a 100644 --- a/roles/container_runtime/templates/daemon.json +++ b/roles/container_runtime/templates/daemon.json @@ -5,7 +5,7 @@ "disable-legacy-registry": false, "exec-opts": ["native.cgroupdriver=systemd"], "insecure-registries": {{ l_docker_insecure_registries }}, -{% if openshift_docker_log_driver is defined %} +{% if openshift_docker_log_driver %} "log-driver": "{{ openshift_docker_log_driver }}", {%- endif %} "log-opts": {{ l_docker_log_options_dict }}, -- cgit v1.2.3 From 40d63b7dfa8b88ad2459a86b436385612dbb2150 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Dec 2017 12:08:45 +0100 Subject: openshift_node: reintroduce restart of CRI-O. change introduced with 39cf5084f18e2e0adca46b925660a6f2c38d227c Signed-off-by: Giuseppe Scrivano --- roles/openshift_node/tasks/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index d9f3e920d..32c5f495f 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -44,6 +44,15 @@ - name: include node installer include_tasks: install.yml +- name: Restart cri-o + systemd: + name: cri-o + enabled: yes + state: restarted + when: openshift_use_crio + register: task_result + failed_when: task_result|failed and 'could not find the requested service' not in task_result.msg|lower + - name: restart NetworkManager to ensure resolv.conf is present systemd: name: NetworkManager -- cgit v1.2.3