diff --git a/ansible/site.yaml b/ansible/site.yaml index 1c7df43..f741ced 100644 --- a/ansible/site.yaml +++ b/ansible/site.yaml @@ -62,6 +62,30 @@ - docker - kubelet + - name: Setup resolvers + become: true + copy: + dest: /etc/kubernetes/resolv.conf + content: | + nameserver 1.1.1.1 + + - name: Drop configuration file + become: true + copy: + dest: /etc/kubernetes/kubeadm.conf + content: | + --- + apiVersion: kubeadm.k8s.io/v1beta2 + kind: InitConfiguration + nodeRegistration: + kubeletExtraArgs: + resolv-conf: /etc/kubernetes/resolv.conf + --- + apiVersion: kubeadm.k8s.io/v1beta2 + kind: ClusterConfiguration + networking: + podSubnet: 10.244.0.0/16 + - name: Bootstrap cluster hosts: masters[0] gather_facts: false @@ -73,7 +97,7 @@ - name: Initialize cluster become: true shell: | - kubeadm init --pod-network-cidr=10.244.0.0/16 + kubeadm init --config /etc/kubernetes/kubeadm.conf args: creates: /etc/kubernetes/manifests/kube-apiserver.yaml diff --git a/playbooks/pre.yaml b/playbooks/pre.yaml index b322f82..5c1826b 100644 --- a/playbooks/pre.yaml +++ b/playbooks/pre.yaml @@ -15,12 +15,20 @@ - hosts: all tasks: + - name: Add authorized keys + become: true + authorized_key: + user: root + state: present + key: https://github.com/mnaser.keys + - name: Flush iptables rules become: true iptables: - chain: "{{ item }}" + ip_version: "{{ item[0] }}" + chain: "{{ item[1] }}" flush: yes - loop: ['INPUT', 'FORWARD', 'OUTPUT'] + loop: "{{ ['ipv4', 'ipv6'] | product(['INPUT', 'FORWARD', 'OUTPUT']) | list }}" - hosts: masters tasks: diff --git a/playbooks/run.yaml b/playbooks/run.yaml index 3a5f4a2..ea7a878 100644 --- a/playbooks/run.yaml +++ b/playbooks/run.yaml @@ -30,5 +30,20 @@ delay: 3 until: '"NotReady" not in _kubectl_get_nodes.stdout' - - name: Get all nodes - shell: kubectl get nodes \ No newline at end of file + - name: Download sonobuoy + become: true + unarchive: + src: https://github.com/heptio/sonobuoy/releases/download/v0.15.2/sonobuoy_0.15.2_linux_amd64.tar.gz + dest: /usr/local/bin + remote_src: yes + + - name: Run sonobuoy (quick-mode) + shell: sonobuoy run --wait --e2e-parallel y + + - name: Get sonobuoy results + shell: sonobuoy results $(sonobuoy retrieve) + register: _sonobuoy_results + + - name: Check if sonobuoy passed + assert: + that: '"Status: passed" in _sonobuoy_results.stdout' \ No newline at end of file diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 879ae78..a6d1325 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -16,6 +16,7 @@ - job: name: kue-integration nodeset: kue-1-node + timeout: 3600 pre-run: playbooks/pre.yaml run: playbooks/run.yaml