From c719aab312718bd557c8fc00284671bf18c3dc2a Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Mon, 22 Aug 2016 14:45:42 +0200 Subject: [PATCH 1/3] Adjust collect-info playbook Cleanup collected artifacts, drop unrelated files/commands. Always install gitinfos script to binaries for external use. Signed-off-by: Bogdan Dobrelya --- roles/kubernetes/preinstall/tasks/main.yml | 6 ++++++ scripts/collect-info.yaml | 19 +++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index dcc925627..2a93129b1 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -1,4 +1,10 @@ --- +- name: 'GIT | Install script for collecting git info' + template: + src: "{{ role_path }}/gen-gitinfos.sh" + dest: "{{ bin_dir }}/gen-gitinfos.sh" + mode: a+rwx + - include: gitinfos.yml when: run_gitinfos diff --git a/scripts/collect-info.yaml b/scripts/collect-info.yaml index 95eb7a9d8..67d4c8b35 100644 --- a/scripts/collect-info.yaml +++ b/scripts/collect-info.yaml @@ -7,11 +7,9 @@ debug: false commands: - name: git_info - cmd: cat {kargo,.}/.git/logs/HEAD + cmd: find . -type d -name .git -execdir sh -c 'gen-gitinfos.sh global|head -12' \; - name: timedate_info cmd: timedatectl status - - name: boots_info - cmd: journalctl --list-boots --utc --no-pager - name: space_info cmd: df -h - name: kernel_info @@ -28,10 +26,10 @@ cmd: ps auxf | grep -v ]$ - name: systemctl_info cmd: systemctl status + - name: systemctl_failed_info + cmd: systemctl --state=failed --no-pager - name: k8s_info cmd: kubectl get all --all-namespaces -o wide - - name: k8s_dump_info - cmd: kubectl get all --all-namespaces -o yaml - name: errors_info cmd: journalctl -p err --utc --no-pager @@ -43,10 +41,6 @@ - /var/log/kern.log - inventory/inventory.ini - cluster.yml - - kargo/kargo_default_ubuntu.yaml - - kargo/kargo_default_debian.yaml - - kargo/kargo_default_common.yaml - - kargo/inventory/inventory.cfg tasks: - name: Storing commands output @@ -68,4 +62,9 @@ with_items: "{{logs}}" - name: Pack results and logs - local_action: shell GZIP=-9 tar cvzf logs.tar.gz -C /tmp collect-info + local_action: shell GZIP=-9 tar --remove-files -cvzf logs.tar.gz -C /tmp collect-info + run_once: true + + - name: Clean up collected command outputs + file: path={{ item.name }} state=absent + with_items: "{{commands}}" From 333b4f33d62c6cfab4eff6b132a599de8deef90c Mon Sep 17 00:00:00 2001 From: Smana Date: Wed, 24 Aug 2016 12:36:25 +0200 Subject: [PATCH 2/3] Revert "Fix resolv.conf search/nameserver" This reverts commit 977f82c32c3e92155538af87842e6b4fb3a59141. --- roles/dnsmasq/defaults/main.yml | 12 ------------ roles/dnsmasq/handlers/main.yml | 10 ---------- roles/dnsmasq/tasks/main.yml | 19 ++++--------------- 3 files changed, 4 insertions(+), 37 deletions(-) delete mode 100644 roles/dnsmasq/defaults/main.yml delete mode 100644 roles/dnsmasq/handlers/main.yml diff --git a/roles/dnsmasq/defaults/main.yml b/roles/dnsmasq/defaults/main.yml deleted file mode 100644 index 48b52c121..000000000 --- a/roles/dnsmasq/defaults/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# Existing search/nameserver resolvconf entries will be purged and -# ensured by this additional data: - -# Max of 4 names is allowed and no more than 256 - 17 chars total -# (a 2 is reserved for the 'default.svc.' and'svc.') -#searchdomains: -# - foo.bar.lc - -# Max of 2 is allowed here (a 1 is reserved for the dns_server) -#nameservers: -# - 127.0.0.1 diff --git a/roles/dnsmasq/handlers/main.yml b/roles/dnsmasq/handlers/main.yml deleted file mode 100644 index 95cd80cfc..000000000 --- a/roles/dnsmasq/handlers/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Dnsmasq | restart network - service: - name: >- - {% if ansible_os_family == "RedHat" -%} - network - {%- elif ansible_os_family == "Debian" -%} - networking - {%- endif %} - state: restarted - when: ansible_os_family != "CoreOS" diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index e8dc78aa8..526e162ae 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -68,17 +68,9 @@ resolvconffile: >- {%- if resolvconf.rc == 0 -%}/etc/resolvconf/resolv.conf.d/head{%- else -%}/etc/resolv.conf{%- endif -%} -- name: generate search domains to resolvconf - set_fact: - searchentries="{{ ([ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([])) | join(' ') }}" - -- name: generate nameservers to resolvconf - set_fact: - nameserverentries="{{ nameservers|default([]) + [ dns_server ] }}" - - name: Add search resolv.conf lineinfile: - line: "search {{searchentries}}" + line: "search {{ [ 'default.svc.' + dns_domain, 'svc.' + dns_domain, dns_domain ] | join(' ') }}" dest: "{{resolvconffile}}" state: present insertbefore: BOF @@ -87,13 +79,12 @@ - name: Add local dnsmasq to resolv.conf lineinfile: - line: "nameserver {{item}}" + line: "nameserver {{dns_server}}" dest: "{{resolvconffile}}" state: present insertafter: "^search.*$" backup: yes follow: yes - with_items: "{{nameserverentries}}" - name: Add options to resolv.conf lineinfile: @@ -109,13 +100,11 @@ - attempts:2 - name: disable resolv.conf modification by dhclient - copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient-enter-hooks.d/znodnsupdate mode=0755 backup=yes - notify: Dnsmasq | restart network + copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient-enter-hooks.d/nodnsupdate mode=0755 backup=yes when: ansible_os_family == "Debian" - name: disable resolv.conf modification by dhclient - copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient.d/znodnsupdate mode=u+x backup=yes - notify: Dnsmasq | restart network + copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient.d/nodnsupdate mode=u+x backup=yes when: ansible_os_family == "RedHat" - name: update resolvconf From 30ef4842f127967b8811ccf2121962e93705eac7 Mon Sep 17 00:00:00 2001 From: Smana Date: Wed, 24 Aug 2016 14:32:54 +0200 Subject: [PATCH 3/3] Revert "pass cloud provider flag in all cases, not just openstack" This reverts commit f35e5e864fe4b6f3cdd0400eff0721a8c231ed1d. --- .../master/templates/manifests/kube-apiserver.manifest.j2 | 2 -- .../templates/manifests/kube-controller-manager.manifest.j2 | 6 ++---- roles/kubernetes/node/templates/kubelet.j2 | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 index 1df850dbf..7961ac36f 100644 --- a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 @@ -35,8 +35,6 @@ spec: {% if cloud_provider is defined and cloud_provider == "openstack" %} - --cloud-provider={{ cloud_provider }} - --cloud-config={{ kube_config_dir }}/cloud_config -{% elif cloud_provider is defined %} - - --cloud-provider={{ cloud_provider }} {% endif %} - 2>&1 >> {{ kube_log_dir }}/kube-apiserver.log volumeMounts: diff --git a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 index 0195e5eab..32eeca0b4 100644 --- a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 @@ -17,11 +17,9 @@ spec: - --root-ca-file={{ kube_cert_dir }}/ca.pem - --enable-hostpath-provisioner={{ kube_hostpath_dynamic_provisioner }} - --v={{ kube_log_level | default('2') }} -{% if cloud_provider is defined and cloud_provider == "openstack"%} - - --cloud-provider={{cloud_provider}} +{% if cloud_provider is defined and cloud_provider == "openstack" %} + - --cloud-provider=openstack - --cloud-config={{ kube_config_dir }}/cloud_config -{% elif cloud_provider is defined %} - - --cloud-provider={{cloud_provider}} {% endif %} livenessProbe: httpGet: diff --git a/roles/kubernetes/node/templates/kubelet.j2 b/roles/kubernetes/node/templates/kubelet.j2 index 7eb76de2d..bab27305e 100644 --- a/roles/kubernetes/node/templates/kubelet.j2 +++ b/roles/kubernetes/node/templates/kubelet.j2 @@ -33,9 +33,8 @@ DOCKER_SOCKET="--docker-endpoint=unix:/var/run/weave/weave.sock" KUBE_ALLOW_PRIV="--allow-privileged=true" {% if cloud_provider is defined and cloud_provider == "openstack" %} KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }} --cloud-config={{ kube_config_dir }}/cloud_config" -{% elif cloud_provider is defined %} -KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }}" {% else %} +{# TODO: gce and aws don't need the cloud provider to be set? #} KUBELET_CLOUDPROVIDER="" {% endif %} {% if ansible_service_mgr in ["sysvinit","upstart"] %}