summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/control-plane/tasks/net_cilium.yml
blob: 4d535ed43c1720ff4cc21f39f8682a055eff251c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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