Wolfgang Kulhanek
2018-04-25 139bfdbb7ed84927a43fd5de525736829b1a5104
Enabled CRI-O for ocp-workshop. Set container-runtime=cri-o to enable
3 files modified
33 ■■■■ changed files
ansible/configs/ocp-workshop/env_vars.yml 2 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-workshop/files/hosts_template.3.9.14.j2 15 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-workshop/post_software.yml 16 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-workshop/env_vars.yml
@@ -53,6 +53,8 @@
idm_ca_url: http://ipa.opentlc.com/ipa/config/ca.crt
install_metrics: true
install_logging: true
# Values for container_runtime: docker, cri-o
container_runtime: docker
repo_version: "3.9"
docker_version: "{{ '1.12.6' if repo_version | version_compare('3.9', '<')  else '1.13.1' }}"
ansible/configs/ocp-workshop/files/hosts_template.3.9.14.j2
@@ -17,6 +17,11 @@
containerized=false
openshift_disable_check="disk_availability,memory_availability,docker_image_availability"
{% if container_runtime == "cri-o" %}
openshift_use_crio=True
openshift_crio_enable_docker_gc=True
{% endif %}
# default project node selector
osm_default_node_selector='env=users'
openshift_hosted_infra_selector="env=infra"
@@ -294,12 +299,12 @@
[nodes]
## These are the masters
{% for host in groups['masters'] %}
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','openshift_schedulable':'False','cluster': '{{guid}}', 'zone': '{{hostvars[host]['placement']}}'}"
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','openshift_schedulable':'False','cluster': '{{guid}}', 'zone': '{{hostvars[host]['placement']}}', 'runtime': '{{container_runtime}}'}"
{% endfor %}
## These are infranodes
{% for host in groups['infranodes'] %}
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'infra', 'zone': '{{hostvars[host]['placement']}}'}"
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'infra', 'zone': '{{hostvars[host]['placement']}}', 'runtime': '{{container_runtime}}'}"
{% endfor %}
## These are regular nodes
@@ -307,13 +312,13 @@
  if host not in groups['newnodes']|d([])
  and host not in groups['glusterfs']|d([])
  %}
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['placement']}}'}"
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['placement']}}', 'runtime': '{{container_runtime}}'}"
{% endfor %}
{% if groups['glusterfs']|d([])|length > 0 %}
## These are glusterfs nodes
{% for host in groups['glusterfs'] %}
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'glusterfs', 'zone': '{{hostvars[host]['placement']}}'}"
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'glusterfs', 'zone': '{{hostvars[host]['placement']}}', 'runtime': '{{container_runtime}}'}"
{% endfor %}
{% endif %}
@@ -322,7 +327,7 @@
# https://docs.openshift.com/container-platform/3.7/install_config/adding_hosts_to_existing_cluster.html
[new_nodes]
{% for host in groups['newnodes'] %}
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['placement']}}'}"
{{ hostvars[host].internaldns }} openshift_hostname={{ hostvars[host].internaldns }} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['placement']}}', 'runtime': '{{container_runtime}}'}"
{% endfor %}
{% endif %}
ansible/configs/ocp-workshop/post_software.yml
@@ -273,6 +273,22 @@
      command: "docker tag registry.access.redhat.com/openshift3/ose-recycler:latest registry.access.redhat.com/openshift3/ose-recycler:v{{ osrelease }}"
      when: osrelease | version_compare('3.7', '>=')
- name: Fix CRI-O Garbage Collection DaemonSet for OCP 3.9 and newer
  gather_facts: False
  become: yes
  hosts: masters[0]
  tasks:
    - name: Patch dockergc DaemonSet
      command: "oc patch daemonset dockergc --patch='\"spec\": { \"template\": { \"spec\": { \"containers\": [ { \"command\": [ \"/usr/bin/oc\" ], \"name\": \"dockergc\" } ] } } }' -n default"
      when:
        - osrelease | version_compare('3.9', '>=')
        - container_runtime == "cri-o"
    - name: Redeploy dockergc DaemonSet pods
      command: "oc delete pod $(oc get pods -n default|grep dockergc|awk -c '{print $1}') -n default"
      when:
        - osrelease | version_compare('3.9', '>=')
        - container_runtime == "cri-o"
# Set up Prometheus/Node Exporter/Alertmanager/Grafana
# on the OpenShift Cluster
- name: Install Prometheus and Grafana