From f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 11 Mar 2018 19:56:38 +0100 Subject: Various fixes before moving to hardware installation --- anslib/ansible-role-ntp | 1 + anslib/link_vars.sh | 1 + anslib/openshift-ansible | 2 +- .../etcd-ds-rh1538446-openshift-undefined.patch | 11 ++++ ...glusterfs-ds-use_cluster_local_for_heketi.patch | 24 ++++++++ ...networkmanager-ds-use-openshift-interface.patch | 47 ++++++++++++++++ anslib/patches/openshift-ds-update371.patch | 45 +++++++++++++++ anslib/patches/registry-ds-glusterfs-fixes.patch | 61 +++++++++++++++++++++ .../registry-ds-glusterfs-storageclass.patch | 64 ++++++++++++++++++++++ 9 files changed, 255 insertions(+), 1 deletion(-) create mode 160000 anslib/ansible-role-ntp create mode 100644 anslib/patches/etcd-ds-rh1538446-openshift-undefined.patch create mode 100644 anslib/patches/glusterfs-ds-use_cluster_local_for_heketi.patch create mode 100644 anslib/patches/networkmanager-ds-use-openshift-interface.patch create mode 100644 anslib/patches/openshift-ds-update371.patch create mode 100644 anslib/patches/registry-ds-glusterfs-fixes.patch create mode 100644 anslib/patches/registry-ds-glusterfs-storageclass.patch (limited to 'anslib') diff --git a/anslib/ansible-role-ntp b/anslib/ansible-role-ntp new file mode 160000 index 0000000..47b40d4 --- /dev/null +++ b/anslib/ansible-role-ntp @@ -0,0 +1 @@ +Subproject commit 47b40d48fce51c79630feeac84659824a746d4aa diff --git a/anslib/link_vars.sh b/anslib/link_vars.sh index 01a9fe9..651c09c 100755 --- a/anslib/link_vars.sh +++ b/anslib/link_vars.sh @@ -24,3 +24,4 @@ function mklink_func { export -f mklink_func find openshift-ansible/playbooks -mindepth 0 -maxdepth 2 -type d -print0 | xargs -0 -L 1 -I {} bash -c 'mklink_func "$@"' _ {} +find openshift-ansible/playbooks/common/openshift-cluster/upgrades -mindepth 0 -maxdepth 1 -type d -print0 | xargs -0 -L 1 -I {} bash -c 'mklink_func "$@"' _ {} diff --git a/anslib/openshift-ansible b/anslib/openshift-ansible index d1fcbd7..22d3a96 160000 --- a/anslib/openshift-ansible +++ b/anslib/openshift-ansible @@ -1 +1 @@ -Subproject commit d1fcbd7a9a8511b895f9a163f7fa2a7bc0d72f2b +Subproject commit 22d3a96deaf74b7aa9aa021a73ef39e2b4da3378 diff --git a/anslib/patches/etcd-ds-rh1538446-openshift-undefined.patch b/anslib/patches/etcd-ds-rh1538446-openshift-undefined.patch new file mode 100644 index 0000000..2301072 --- /dev/null +++ b/anslib/patches/etcd-ds-rh1538446-openshift-undefined.patch @@ -0,0 +1,11 @@ +diff --git a/roles/openshift_etcd_facts/tasks/main.yml b/roles/openshift_etcd_facts/tasks/main.yml +index 86546f4..bda0606 100644 +--- a/roles/openshift_etcd_facts/tasks/main.yml ++++ b/roles/openshift_etcd_facts/tasks/main.yml +@@ -1,2 +1,6 @@ + --- ++- openshift_facts: ++ role: etcd ++ local_facts: {} ++ + - import_tasks: set_etcd_ca_host.yml diff --git a/anslib/patches/glusterfs-ds-use_cluster_local_for_heketi.patch b/anslib/patches/glusterfs-ds-use_cluster_local_for_heketi.patch new file mode 100644 index 0000000..75a8a43 --- /dev/null +++ b/anslib/patches/glusterfs-ds-use_cluster_local_for_heketi.patch @@ -0,0 +1,24 @@ +diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml +index 4928e86..b8f3cab 100644 +--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml ++++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_common.yml +@@ -293,7 +293,8 @@ + + - name: Determine StorageClass heketi URL + set_fact: +- glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}" ++ glusterfs_heketi_route: "heketi-{{ glusterfs_name }}.{{ glusterfs_namespace }}.svc.cluster.local:8080" ++# glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}" + when: + - glusterfs_heketi_is_native + +@@ -344,7 +345,8 @@ + + - name: Determine StorageClass heketi URL + set_fact: +- glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}" ++ glusterfs_heketi_route: "heketi-{{ glusterfs_name }}.{{ glusterfs_namespace }}.svc.cluster.local:8080" ++# glusterfs_heketi_route: "{{ heketi_route.results.results[0]['spec']['host'] }}" + when: + - glusterfs_heketi_is_native + - glusterfs_heketi_route is not defined diff --git a/anslib/patches/networkmanager-ds-use-openshift-interface.patch b/anslib/patches/networkmanager-ds-use-openshift-interface.patch new file mode 100644 index 0000000..687be8a --- /dev/null +++ b/anslib/patches/networkmanager-ds-use-openshift-interface.patch @@ -0,0 +1,47 @@ +diff --git a/roles/openshift_node/files/bootstrap.yml b/roles/openshift_node/files/bootstrap.yml +index ea28064..df95ba3 100644 +--- a/roles/openshift_node/files/bootstrap.yml ++++ b/roles/openshift_node/files/bootstrap.yml +@@ -8,7 +8,7 @@ + lines: + - regex: ^listen-address + state: present +- line: "listen-address={{ ansible_default_ipv4.address }}" ++ line: "listen-address={{ openshift_dns_ip }}" + node_dns: + file: /etc/dnsmasq.d/node-dnsmasq.conf + lines: +diff --git a/roles/openshift_node/files/networkmanager/99-origin-dns.sh b/roles/openshift_node/files/networkmanager/99-origin-dns.sh +index acf3e2f..16129a2 100755 +--- a/roles/openshift_node/files/networkmanager/99-origin-dns.sh ++++ b/roles/openshift_node/files/networkmanager/99-origin-dns.sh +@@ -43,10 +43,25 @@ if [[ $2 =~ ^(up|dhcp4-change|dhcp6-change)$ ]]; then + ###################################################################### + # couldn't find an existing method to determine if the interface owns the + # default route +- def_route=$(/sbin/ip route list match 0.0.0.0/0 | awk '{print $3 }') +- def_route_int=$(/sbin/ip route get to ${def_route} | awk '{print $3}') +- def_route_ip=$(/sbin/ip route get to ${def_route} | awk '{print $5}') +- if [[ ${DEVICE_IFACE} == ${def_route_int} ]]; then ++ #SDS ++ #def_route=$(/sbin/ip route list match 0.0.0.0/0 | awk '{print $3 }') ++ #def_route_int=$(/sbin/ip route get to ${def_route} | awk '{print $3}') ++ #def_route_ip=$(/sbin/ip route get to ${def_route} | awk '{print $5}') ++ #EDS ++ def_route_ip=$(cat /etc/hosts | grep openshift_dns_ip | awk '{ print $1 }') ++ [ -n "$def_route_ip" ] && def_route_int=$(ip -o addr show | grep ${def_route_ip} | awk '{ print $2 }') ++ if [ -z "$def_route_ip" -o -z "$def_route_int" ]; then ++ def_route=$(/sbin/ip route list match 0.0.0.0/0 | awk '{print $3 }') ++ def_route_int=$(/sbin/ip route get to ${def_route} | awk '{print $3}' | head -n 1) ++ def_route_ip=$(/sbin/ip -f inet addr show dev ${def_route_int} scope global up | grep -Po 'inet \K[\d.]+' | head -n 1) ++ fi ++ ++ def_routes=$(/sbin/ip route list match 0.0.0.0/0 | awk '{print $3 }') ++ def_routes_int=$(for r in ${def_routes}; do /sbin/ip route get to ${r} | awk '{print $3}'; done) ++ interfaces="${def_route_int} ${def_routes_int}" ++ ++ if [[ "${interfaces}" =~ (^|[[:space:]])${DEVICE_IFACE}($|[[:space:]]) ]]; then ++# if [[ ${DEVICE_IFACE} == ${def_route_int} ]]; then + if [ ! -f /etc/dnsmasq.d/origin-dns.conf ]; then + cat << EOF > /etc/dnsmasq.d/origin-dns.conf + no-resolv diff --git a/anslib/patches/openshift-ds-update371.patch b/anslib/patches/openshift-ds-update371.patch new file mode 100644 index 0000000..a6beff3 --- /dev/null +++ b/anslib/patches/openshift-ds-update371.patch @@ -0,0 +1,45 @@ +diff --git a/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml +index cc2ec27..6c4ccf8 100644 +--- a/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml ++++ b/playbooks/common/openshift-cluster/upgrades/v3_7/upgrade.yml +@@ -12,7 +12,7 @@ + - pre_upgrade + tasks: + - set_fact: +- openshift_upgrade_target: '3.7' ++ openshift_upgrade_target: '3.7.1' + openshift_upgrade_min: '3.6' + + - import_playbook: ../pre/config.yml +diff --git a/roles/openshift_repos/templates/CentOS-OpenShift-Origin371.repo.j2 b/roles/openshift_repos/templates/CentOS-OpenShift-Origin371.repo.j2 +new file mode 100644 +index 0000000..10b49c0 +--- /dev/null ++++ b/roles/openshift_repos/templates/CentOS-OpenShift-Origin371.repo.j2 +@@ -0,0 +1,26 @@ ++[centos-openshift-origin371] ++name=CentOS OpenShift Origin ++baseurl={{ ands_repo_url }}/openshift371/ ++enabled=1 ++gpgcheck=0 ++ ++[centos-openshift-origin37-testing] ++name=CentOS OpenShift Origin Testing ++baseurl=http://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin37/ ++enabled={{ 1 if openshift_repos_enable_testing else 0 }} ++gpgcheck=0 ++gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS ++ ++[centos-openshift-origin37-debuginfo] ++name=CentOS OpenShift Origin DebugInfo ++baseurl=http://debuginfo.centos.org/centos/7/paas/x86_64/ ++enabled=0 ++gpgcheck=1 ++gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS ++ ++[centos-openshift-origin37-source] ++name=CentOS OpenShift Origin Source ++baseurl=http://vault.centos.org/centos/7/paas/Source/openshift-origin37/ ++enabled=0 ++gpgcheck=1 ++gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS diff --git a/anslib/patches/registry-ds-glusterfs-fixes.patch b/anslib/patches/registry-ds-glusterfs-fixes.patch new file mode 100644 index 0000000..65f30e5 --- /dev/null +++ b/anslib/patches/registry-ds-glusterfs-fixes.patch @@ -0,0 +1,61 @@ +diff --git a/roles/openshift_hosted/tasks/registry.yml b/roles/openshift_hosted/tasks/registry.yml +index bc4d81e..4720095 100644 +diff --git a/roles/openshift_hosted/tasks/registry_storage.yml b/roles/openshift_hosted/tasks/registry_storage.yml +index aa66a78..e1b8c4e 100644 +diff --git a/roles/openshift_hosted/tasks/storage/glusterfs.yml b/roles/openshift_hosted/tasks/storage/glusterfs.yml +index 7223a5a..3465b6c 100644 +--- a/roles/openshift_hosted/tasks/storage/glusterfs.yml ++++ b/roles/openshift_hosted/tasks/storage/glusterfs.yml +@@ -35,7 +35,7 @@ + mount: + state: mounted + fstype: glusterfs +- src: "{% if 'glusterfs_registry' in groups and groups['glusterfs_registry'] | length > 0 %}{% set node = groups.glusterfs_registry[0] %}{% elif 'glusterfs' in groups and groups['glusterfs'] | length > 0 %}{% set node = groups.glusterfs[0] %}{% endif %}{% if openshift_hosted_registry_storage_glusterfs_ips is defined and openshift_hosted_registry_storage_glusterfs_ips|length > 0 %}{{ openshift_hosted_registry_storage_glusterfs_ips[0] }}{% elif 'glusterfs_hostname' in hostvars[node] %}{{ hostvars[node].glusterfs_hostname }}{% elif 'openshift' in hostvars[node] %}{{ hostvars[node].openshift.node.nodename }}{% else %}{{ node }}{% endif %}:/{{ openshift.hosted.registry.storage.glusterfs.path }}" ++ src: "{% if 'glusterfs_registry' in groups and groups['glusterfs_registry'] | length > 0 %}{% set node = groups.glusterfs_registry[0] %}{% elif 'glusterfs' in groups and groups['glusterfs'] | length > 0 %}{% set node = groups.glusterfs[0] %}{% endif %}{% if openshift_hosted_registry_storage_glusterfs_ips is defined and openshift_hosted_registry_storage_glusterfs_ips|length > 0 %}{{ openshift_hosted_registry_storage_glusterfs_ips[0] }}{% elif 'glusterfs_hostname' in hostvars[node] %}{{ hostvars[node].glusterfs_hostname }}{% elif 'openshift' in hostvars[node] %}{{ hostvars[node].openshift.node.nodename }}{% else %}{{ node }}{% endif %}:/{{ openshift_hosted_registry_storage_glusterfs_path }}" + name: "{{ mktemp.stdout }}" + + - name: Set registry volume permissions +@@ -49,10 +49,11 @@ + - block: + - name: Activate registry maintenance mode + oc_env: ++ kind: dc + namespace: "{{ openshift_hosted_registry_namespace }}" + name: "{{ openshift_hosted_registry_name }}" + env_vars: +- - REGISTRY_STORAGE_MAINTENANCE_READONLY_ENABLED: 'true' ++ REGISTRY_STORAGE_MAINTENANCE_READONLY_ENABLED: 'true' + + - name: Get first registry pod name + set_fact: +@@ -72,11 +73,12 @@ + + - name: Deactivate registry maintenance mode + oc_env: ++ kind: dc + namespace: "{{ openshift_hosted_registry_namespace }}" + name: "{{ openshift_hosted_registry_name }}" + state: absent + env_vars: +- - REGISTRY_STORAGE_MAINTENANCE_READONLY_ENABLED: 'true' ++ REGISTRY_STORAGE_MAINTENANCE_READONLY_ENABLED: 'true' + when: openshift_hosted_registry_storage_glusterfs_swap + + - name: Unmount registry volume and clean up mount point/fstab +diff --git a/roles/openshift_persistent_volumes/tasks/main.yml b/roles/openshift_persistent_volumes/tasks/main.yml +index b1d9c8c..1c32a67 100644 +diff --git a/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 b/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 +index ca8b747..ce15533 100644 +--- a/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 ++++ b/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 +@@ -12,7 +12,7 @@ items: + resources: + requests: + storage: "{{ claim.capacity }}" +-{% if claim.storageclass is not None %} ++{% if claim.storageclass is defined and claim.storageclass is not none %} + storageClassName: "{{ claim.storageclass }}" + {% endif %} + {% endfor %} +diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml +index e91e130..f3562b6 100644 diff --git a/anslib/patches/registry-ds-glusterfs-storageclass.patch b/anslib/patches/registry-ds-glusterfs-storageclass.patch new file mode 100644 index 0000000..a189091 --- /dev/null +++ b/anslib/patches/registry-ds-glusterfs-storageclass.patch @@ -0,0 +1,64 @@ +diff --git a/roles/openshift_hosted/tasks/registry.yml b/roles/openshift_hosted/tasks/registry.yml +index bc4d81e..4720095 100644 +--- a/roles/openshift_hosted/tasks/registry.yml ++++ b/roles/openshift_hosted/tasks/registry.yml +@@ -112,6 +112,7 @@ + when: + - openshift_hosted_registry_storage_glusterfs_ips|length > 0 + - openshift_hosted_registry_storage_kind | default(none) in ['glusterfs'] ++ - openshift_hosted_registry_storage_class is not defined + + - name: Create OpenShift registry + oc_adm_registry: +diff --git a/roles/openshift_hosted/tasks/registry_storage.yml b/roles/openshift_hosted/tasks/registry_storage.yml +index aa66a78..e1b8c4e 100644 +--- a/roles/openshift_hosted/tasks/registry_storage.yml ++++ b/roles/openshift_hosted/tasks/registry_storage.yml +@@ -2,3 +2,4 @@ + - include_tasks: storage/glusterfs.yml + when: + - openshift_hosted_registry_storage_kind | default(none) == 'glusterfs' or openshift_hosted_registry_storage_glusterfs_swap ++ - openshift_hosted_registry_storage_class is not defined +diff --git a/roles/openshift_hosted/tasks/storage/glusterfs.yml b/roles/openshift_hosted/tasks/storage/glusterfs.yml +index 7223a5a..3465b6c 100644 +diff --git a/roles/openshift_persistent_volumes/tasks/main.yml b/roles/openshift_persistent_volumes/tasks/main.yml +index b1d9c8c..1c32a67 100644 +--- a/roles/openshift_persistent_volumes/tasks/main.yml ++++ b/roles/openshift_persistent_volumes/tasks/main.yml +@@ -23,7 +23,21 @@ + - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-claim" + capacity: "{{ openshift_hosted_registry_storage_volume_size }}" + access_modes: "{{ openshift_hosted_registry_storage_access_modes }}" +- when: openshift_hosted_registry_storage_glusterfs_swap | default(False) ++ when: ++ - openshift_hosted_registry_storage_glusterfs_swap | default(False) ++ - openshift_hosted_registry_storage_class is not defined ++ ++ ++- set_fact: ++ glusterfs_pv: [] ++ glusterfs_pvc: ++ - name: "{{ openshift_hosted_registry_storage_volume_name }}-claim" ++ storageclass: "{{ openshift_hosted_registry_storage_class }}" ++ capacity: "{{ openshift_hosted_registry_storage_volume_size }}" ++ access_modes: "{{ openshift_hosted_registry_storage_access_modes }}" ++ when: ++ - openshift_hosted_registry_storage_class is defined ++ + + - name: create standard pv and pvc lists + # generate_pv_pvcs_list is a custom action module defined in +diff --git a/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 b/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2 +index ca8b747..ce15533 100644 +diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml +index e91e130..f3562b6 100644 +--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml ++++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml +@@ -12,4 +12,6 @@ + + - name: Create GlusterFS registry volume + command: "{{ glusterfs_heketi_client }} volume create --size={{ openshift_hosted_registry_storage_volume_size | replace('Gi','') }} --name={{ openshift_hosted_registry_storage_glusterfs_path }}" +- when: "openshift_hosted_registry_storage_glusterfs_path not in registry_volume.stdout" ++ when: ++ - "openshift_hosted_registry_storage_glusterfs_path not in registry_volume.stdout" ++ - "openshift_hosted_registry_storage_class is not defined" -- cgit v1.2.1