summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml')
-rw-r--r--roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml52
1 files changed, 52 insertions, 0 deletions
diff --git a/roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml b/roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml
new file mode 100644
index 00000000..4d535ed4
--- /dev/null
+++ b/roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml
@@ -0,0 +1,52 @@
+---
+- name: install cilium cli
+ apt:
+ name: cilium-cli
+ state: present
+
+- name: check if cilium is already installed
+ check_mode: no
+ command: cilium version
+ failed_when: false
+ changed_when: false
+ register: cilium_version_result
+
+- name: install cilium onto the cluster
+ when: "'no cilium pods found' in cilium_version_result.stdout"
+ block:
+ - name: install cilium using cli
+ command: cilium install --version "v{{ kubernetes_network_plugin_version }}" --config "{% for name,value in kubernetes_cilium_config.items() %}{{ loop.first | ternary('',',') }}{{ name }}={{ value }}{% endfor %}"
+ register: cilium_install
+
+ always:
+ - name: dump output of cilium install to log file
+ when: cilium_install.changed
+ copy:
+ content: "{{ cilium_install.stdout }}\n"
+ dest: /etc/kubernetes/network-plugin/install.log
+
+ - name: dump error output of cilium install to log file
+ when: cilium_install.changed and cilium_install.stderr
+ copy:
+ content: "{{ cilium_install.stderr }}\n"
+ dest: /etc/kubernetes/network-plugin/install.errors
+
+## TODO: enable this once we have a working deployment
+# - name: install node-local dns cache
+# when: kubernetes_enable_nodelocal_dnscache
+# block:
+# - name: generate node-local dns cache config
+# template:
+# src: net_cilium/node-local-dns.yml.j2
+# dest: /etc/kubernetes/network-plugin/node-local-dns.yml
+
+# - name: check if node-local dns cache is already installed
+# check_mode: no
+# command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/network-plugin/node-local-dns.yml
+# failed_when: false
+# changed_when: false
+# register: kube_node_local_dns_diff_result
+
+# - name: install node-local dns cache
+# when: kube_node_local_dns_diff_result.rc != 0
+# command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/network-plugin/node-local-dns.yml