Skip to content

Commit 9c9cd72

Browse files
author
Peter Mikus
committed
calico: experiment
Signed-off-by: Peter Mikus <peter.mikus@icloud.com> Change-Id: If891479e1060f0fe613916bc4ea3771f60ac9624
1 parent 166b4c7 commit 9c9cd72

File tree

6 files changed

+136
-13
lines changed

6 files changed

+136
-13
lines changed

fdio.infra.ansible/roles/calico/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
cloudimg_url: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
3+
cloudimg_dest: /opt/noble-server-cloudimg-amd64.img
4+
cloudimg_checksum: sha256:00786c0936a7dd91a6b07941ca60bb56652975e0e72f9dacf73c887ada420966
5+
26
kubernetes_pod_network:
37
# Calico CNI.
48
cni: "calico"
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
---
22
# file: tasks/main.yml
33

4-
- import_tasks: pre-action.yml
4+
- import_tasks: pre-setup.yml
55
tags:
6-
- calico-pre-action
6+
- calico-pre-setup
77

8-
- import_tasks: deploy.yml
9-
tags:
10-
- calico-deploy
11-
12-
- import_tasks: post-action.yml
13-
tags:
14-
- calico-post-action
15-
16-
- import_tasks: cleanup.yml
17-
tags:
18-
- calico-cleanup
8+
#- import_tasks: pre-action.yml
9+
# tags:
10+
# - calico-pre-action
11+
#
12+
#- import_tasks: deploy.yml
13+
# tags:
14+
# - calico-deploy
15+
#
16+
#- import_tasks: post-action.yml
17+
# tags:
18+
# - calico-post-action
19+
#
20+
#- import_tasks: cleanup.yml
21+
# tags:
22+
# - calico-cleanup
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# file: tasks/pre-setup.yml
3+
4+
- name: download cloud image iso with check (sha256)
5+
ansible.builtin.get_url:
6+
url: "{{ cloudimg_url }}"
7+
dest: "{{ cloudimg_dest }}"
8+
checksum: "{{ cloudimg_checksum }}"
9+
when:
10+
- calico_sut is defined
11+
- deploy_state == "present"
12+
tags:
13+
- calico-pre-setup
14+
15+
- name: upload cloud init configuration to the host
16+
ansible.builtin.template:
17+
dest: "/tmp/{{ item }}"
18+
src: "{{ item }}"
19+
loop:
20+
- "meta-data"
21+
- "network-config"
22+
- "user-data"
23+
when:
24+
- calico_sut is defined
25+
tags:
26+
- calico-pre-setup
27+
28+
- name: create cloud init configuration iso
29+
ansible.builtin.shell: |
30+
genisoimage -output seed.img -volid cidata -rational-rock -joliet /tmp/user-data /tmp/meta-data /tmp/network-config
31+
when:
32+
- calico_sut is defined
33+
- deploy_state == "present"
34+
tags:
35+
- calico-pre-setup

fdio.infra.ansible/roles/calico/templates/meta-data

Whitespace-only changes.

fdio.infra.ansible/roles/calico/templates/network-config

Whitespace-only changes.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#cloud-config
2+
3+
users:
4+
- default
5+
- name: testuser
6+
groups: sudo
7+
sudo: ['ALL=(ALL) NOPASSWD:ALL']
8+
plain_text_passwd: Csit1234
9+
lock_passwd: false
10+
chpasswd:
11+
list: |
12+
testuser:Csit1234
13+
expire: False
14+
15+
package_update: true
16+
package_upgrade: false
17+
package_reboot_if_required: false
18+
19+
packages:
20+
- gnupg2
21+
- software-properties-common
22+
- apt-transport-https
23+
- ca-certificates
24+
- jq
25+
- containerd.io
26+
- kubelet
27+
- kubeadm
28+
- kubectl
29+
30+
write_files:
31+
- path: /etc/sysctl.d/kubernetes.conf
32+
content: |
33+
net.bridge.bridge-nf-call-ip6tables = 1
34+
net.bridge.bridge-nf-call-iptables = 1
35+
net.ipv4.ip_forward = 1
36+
- path: /etc/modules-load.d/containerd.conf
37+
content: |
38+
overlay
39+
br_netfilter
40+
- path: /etc/containerd/config.toml
41+
content: |
42+
version = 2
43+
[plugins]
44+
[plugins."io.containerd.grpc.v1.cri"]
45+
[plugins."io.containerd.grpc.v1.cri".containerd]
46+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
47+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
48+
runtime_type = "io.containerd.runc.v2"
49+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
50+
SystemdCgroup = true
51+
- path: /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
52+
content: |
53+
# Enabling password authentication
54+
PasswordAuthentication yes
55+
56+
runcmd:
57+
- apt-mark hold kubelet kubeadm kubectl
58+
- systemctl enable containerd
59+
- ip -4 --json addr show | jq -r '.[] | select(.addr_info[0].local | startswith("10.1.0.")) .addr_info[0].local' > /etc/node-ip
60+
- echo "KUBELET_EXTRA_ARGS='--node-ip=$(cat /etc/node-ip) --cloud-provider=external'" > /etc/default/kubelet
61+
- systemctl daemon-reload
62+
- systemctl enable kubelet
63+
- kubeadm config images pull
64+
65+
apt:
66+
sources:
67+
kubernetes.list:
68+
source: deb https://apt.kubernetes.io/ kubernetes-xenial main
69+
keyid: FEEA9169307EA071
70+
71+
docker.list:
72+
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
73+
keyid: 8D81803C0EBFCD88
74+
75+
cloud_config_modules:
76+
- apt-configure
77+
- apt-update-upgrade
78+
- updates-check
79+
- runcmd
80+
- write-files

0 commit comments

Comments
 (0)