Skip to content

Commit 95460f7

Browse files
author
Power Cloud Robot
authored
Merge pull request ppc64le-cloud#62 from Rajalakshmi-Girish/e2e-node-prereq
Add k8s-node-remote playbook
2 parents 520f124 + d161df7 commit 95460f7

File tree

8 files changed

+165
-8
lines changed

8 files changed

+165
-8
lines changed

group_vars/all

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,11 @@ calico_installation_type: manifest
6666

6767
##### List of images to be prepulled #####
6868
prepull_images: []
69+
70+
##### ETCD version #####
71+
etcd_version: v3.5.9
72+
73+
##### Bridge CNI Configurations #####
74+
cni_plugins_version: v1.3.0
75+
cni_plugins_url: https://github.com/containernetworking/plugins/releases/download
76+
cni_plugins_tarball: "cni-plugins-linux-{{ ansible_architecture }}-{{ cni_plugins_version }}.tgz"

k8s-node-remote.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- name: Install prerequisites and run e2e node tests
2+
hosts:
3+
- masters
4+
roles:
5+
- disable-swap-selinux
6+
- install-bridge-cni
7+
- install-etcd
8+
- runtime
9+
- download-k8s
10+
- k8s-node
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- name: Disable SWAP since kubernetes can't work with swap enabled (1/2)
2+
shell: |
3+
swapoff -a
4+
5+
- name: Disable SWAP in fstab since kubernetes can't work with swap enabled (2/2)
6+
replace:
7+
path: /etc/fstab
8+
regexp: '^([^#].*?\sswap\s+sw\s+.*)$'
9+
replace: '# \1'
10+
11+
- name: Disable SELinux
12+
shell: |
13+
setenforce 0
14+
sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
- name: Create cni directory
2+
file:
3+
path: /opt/cni/bin
4+
state: directory
5+
6+
- name: Download and setup cni plugins
7+
unarchive:
8+
src: "{{ cni_plugins_url }}/{{ cni_plugins_version }}/{{ cni_plugins_tarball }}"
9+
dest: "/opt/cni/bin"
10+
remote_src: yes
11+
extra_opts:
12+
- --strip-components=1
13+
retries: 3
14+
delay: 5
15+
16+
- name: Create a /etc/cni/net.d dir
17+
file:
18+
path: /etc/cni/net.d
19+
state: directory
20+
mode: '0755'
21+
22+
- name: Generate 10-bridge-net.conflist file
23+
template:
24+
src: 10-bridge-net.conflist.j2
25+
dest: /etc/cni/net.d/10-bridge-net.conflist
26+
mode: '0644'
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"cniVersion": "1.0.0",
3+
"name": "bridge-net",
4+
"plugins": [
5+
{
6+
"type": "bridge",
7+
"bridge": "cni0",
8+
"isGateway": true,
9+
"ipMasq": true,
10+
"promiscMode": true,
11+
"ipam": {
12+
"type": "host-local",
13+
"ranges": [
14+
[{
15+
"subnet": "10.88.0.0/16"
16+
}],
17+
[{
18+
"subnet": "2001:db8:4860::/64"
19+
}]
20+
],
21+
"routes": [
22+
{ "dst": "0.0.0.0/0" },
23+
{ "dst": "::/0" }
24+
]
25+
}
26+
},
27+
{
28+
"type": "portmap",
29+
"capabilities": {"portMappings": true},
30+
"externalSetMarkChain": "KUBE-MARK-MASQ"
31+
}
32+
]
33+
}

roles/install-etcd/files/etcd.service

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Etcd Server
3+
4+
[Service]
5+
ExecStart=/usr/local/bin/etcd
6+
7+
[Install]
8+
WantedBy=multi-user.target

roles/install-etcd/tasks/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
- name: Download and setup etcd
2+
unarchive:
3+
src: "https://storage.googleapis.com/etcd/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-{{ ansible_architecture }}.tar.gz"
4+
dest: "/usr/local/bin"
5+
remote_src: yes
6+
extra_opts:
7+
- --strip-components=1
8+
retries: 3
9+
delay: 5
10+
11+
- name: Create the etcd.service file on nodes.
12+
copy:
13+
src: etcd.service
14+
dest: /etc/systemd/system/etcd.service
15+
mode: '0644'
16+
17+
- name: Enable and start etcd server on node
18+
systemd:
19+
name: etcd
20+
state: started
21+
enabled: True

roles/k8s-node/tasks/main.yml

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
1-
- name: Disable SELinux
2-
selinux:
3-
state: disabled
4-
5-
- name: Run the node-e2e tests
6-
command: ginkgo --focus="\[NodeConformance\]" --skip="\[Flaky\]|\[Slow\]|\[Serial\]" --nodes=8 /usr/local/bin/e2e_node.test -- --k8s-bin-dir /usr/local/bin --test.timeout=1h5m0s --kubelet-flags="--cgroups-per-qos=true --cgroup-root=/ --cgroup-driver={{ cgroup_driver }}"
7-
args:
8-
chdir: /tmp
1+
- name: change systemd cgroup driver to default cgroupfs
2+
replace:
3+
path: /etc/containerd/config.toml
4+
regexp: 'SystemdCgroup = true'
5+
replace: 'SystemdCgroup = false'
6+
7+
- name: Restart containerd service
8+
systemd:
9+
name: containerd
10+
state: restarted
11+
12+
- name: Install prereq packages
13+
yum:
14+
name: "{{ packages }}"
15+
state: present
16+
vars:
17+
packages:
18+
- git
19+
- make
20+
- gcc
21+
22+
- name: Capture the commit ID
23+
set_fact:
24+
commit: "{{ build_version | regex_search('(?<=\\+)(.*)') }}"
25+
26+
- name: Clone a kubernetes github repo
27+
git:
28+
repo: https://github.com/kubernetes/kubernetes
29+
dest: /kubernetes/
30+
version: "{{ commit }}"
31+
clone: yes
32+
update: yes
33+
34+
- name: Create a shell script
35+
copy:
36+
content: |
37+
#!/bin/bash
38+
set -o errexit
39+
40+
echo 'This is a script to run e2e-node tests'
41+
pushd /kubernetes
42+
make test-e2e-node FOCUS="\[NodeConformance\]" SKIP="\[Flaky\]|\[Slow\]|\[Serial\]"
43+
popd
44+
dest: /make-test-e2e-node.sh
45+
mode: '0755'

0 commit comments

Comments
 (0)