Skip to content

Commit ce99394

Browse files
authored
compelete docker compose prompt (#120)
* feat(compose): comelete compose prompt * fix(kuber): remove lb * feat(compose): compelete compose prompt * nothing * fix(compose): totally restructre docker compose generator * fix(compose): directory builder * fix(compose): compelete compose generation allgorithm * fix(compose): edit default values for documentation * feat(compose): add union type input for networks
1 parent 2525686 commit ce99394

File tree

42 files changed

+1413
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1413
-326
lines changed

app/directory_generators/ansible_generator.py

Lines changed: 793 additions & 199 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Hello! It looks like you entered just the letter "M." How can I assist you today?

app/media/MyAnsible/group_vars/all

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# General
22
install_ansible_modules: "true"
33
disable_transparent_huge_pages: "true"
4+
45
setup_interface: "false"
56

67
# Network Calico see here for more details https://github.com/projectcalico/calico/releases
@@ -28,15 +29,9 @@ k8s_version: "1.31.2" # see here https://kubernetes.io/releases/patch-releases/
2829
# CRI
2930
cri_socket: unix:///var/run/containerd/containerd.sock
3031

31-
# VRRP and HAProxy
32-
interface_name: "enp0s8"
33-
virtual_ip: "192.168.178.100"
34-
haproxy_frontend_password: "password"
35-
3632
# Ansible Connection
37-
3833
ansible_user: root
3934
ansible_port: 22
4035
ansible_python_interpreter: "/usr/bin/python3"
41-
domain="devopsgpt.com"
42-
apiserver_url="devopsgpt.com"
36+
domain: "devopsgpt.com"
37+
apiserver_url: "devopsgpt.com"

app/media/MyAnsible/hosts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[all]
22
string private_ip=x.x.x.x
33
string private_ip=x.x.x.x
4-
string private_ip=x.x.x.x
54

65
[k8s]
76
string
@@ -12,6 +11,3 @@ string
1211

1312
[k8s_workers]
1413
string
15-
16-
[lb]
17-
string

app/media/MyAnsible/kubernetes_playbook.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,35 @@
44
gather_facts: yes
55
any_errors_fatal: true
66
tags: [preinstall]
7+
8+
- hosts: k8s
9+
roles:
10+
- role: k8s
11+
gather_facts: yes
12+
any_errors_fatal: true
13+
tags: [k8s]
14+
15+
- hosts: k8s
16+
roles:
17+
- role: init_k8s
18+
gather_facts: yes
19+
any_errors_fatal: true
20+
tags: [init_k8s]
21+
22+
- hosts: k8s_masters
23+
roles:
24+
- role: preinstall
25+
- role: k8s
26+
- role: join_master
27+
gather_facts: yes
28+
any_errors_fatal: true
29+
tags: [join_master]
30+
31+
- hosts: k8s_workers
32+
roles:
33+
- role: preinstall
34+
- role: k8s
35+
- role: join_worker
36+
gather_facts: yes
37+
any_errors_fatal: true
38+
tags: [join_worker]

app/media/MyAnsible/roles/init_k8s/defaults/main.yml

Whitespace-only changes.

app/media/MyAnsible/roles/init_k8s/files/sample.sh

Whitespace-only changes.

app/media/MyAnsible/roles/init_k8s/handlers/main.yml

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
- block:
2+
- name: Check if Calico CRDs exist
3+
command: kubectl get crd felixconfigurations.crd.projectcalico.org
4+
register: calico_crd_check
5+
ignore_errors: true
6+
delegate_to: "{{ groups['k8s_masters'][0] }}"
7+
8+
- block:
9+
- name: Apply CNI plugin (Calico)
10+
command: kubectl create -f {{ calico_operator_url }}
11+
retries: 3
12+
delay: 3
13+
14+
- name: Apply CNI plugin (Calico)
15+
command: kubectl create -f {{ calico_crd_url }}
16+
retries: 3
17+
delay: 3
18+
delegate_to: "{{ groups['k8s_masters'][0] }}"
19+
when: calico_crd_check.rc != 0
20+
run_once: true
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
- name: Init cluster | Check if kubeadm has already run
2+
stat:
3+
path: "/var/lib/kubelet/config.yaml"
4+
register: kubeadm_already_run
5+
when: inventory_hostname == groups['k8s_masters'][0]
6+
delegate_to: "{{ groups['k8s_masters'][0] }}"
7+
8+
- block:
9+
- name: Init cluster | Copy kubeadmcnf.yaml
10+
template:
11+
src: kubeadmcnf.yml.j2
12+
dest: /root/kubeadmcnf.yaml
13+
14+
- name: Init cluster | Initiate cluster on node groups['kube_master'][0]
15+
shell: kubeadm init --config=/root/kubeadmcnf.yaml
16+
register: kubeadm_init
17+
# Retry is because upload config sometimes fails
18+
until: kubeadm_init is succeeded or "field is immutable" in kubeadm_init.stderr
19+
notify: Restart kubelet
20+
21+
when: inventory_hostname == groups['k8s_masters'][0] and not kubeadm_already_run.stat.exists
22+
delegate_to: "{{ groups['k8s_masters'][0] }}"
23+
24+
- block:
25+
- name: Create kubectl directory
26+
file:
27+
path: /root/.kube
28+
state: directory
29+
30+
- name: Configure kubectl
31+
copy:
32+
src: /etc/kubernetes/admin.conf
33+
dest: /root/.kube/config
34+
remote_src: yes
35+
36+
- name: Fetch kubeconfig
37+
fetch:
38+
src: /etc/kubernetes/admin.conf
39+
dest: kubeconfig/
40+
flat: yes
41+
when: inventory_hostname == groups['k8s_masters'][0]
42+
delegate_to: "{{ groups['k8s_masters'][0] }}"
43+
44+
- name: Sleep for 300 seconds and reboot the Master1 server
45+
wait_for:
46+
timeout: 300
47+
delegate_to: localhost
48+
49+
- name: Reboot the servers
50+
command: reboot
51+
async: 1
52+
poll: 0
53+
# ignore_errors: yes
54+
delegate_to: "{{ groups['k8s_masters'][0] }}"
55+
56+
- name: Sleep for 300 seconds to Master1 up and running
57+
wait_for:
58+
timeout: 300
59+
delegate_to: localhost
60+
# when: use_iran == "true"
61+
62+
- name: Example Task After Reboot
63+
debug:
64+
msg: "Server back online and ready for tasks."

0 commit comments

Comments
 (0)