2021-03-24 04:46:06 +08:00
|
|
|
---
|
|
|
|
- name: Cilium | Ensure BPFFS mounted
|
2023-06-26 18:15:45 +08:00
|
|
|
ansible.posix.mount:
|
2021-03-24 04:46:06 +08:00
|
|
|
fstype: bpf
|
|
|
|
path: /sys/fs/bpf
|
|
|
|
src: bpffs
|
|
|
|
state: mounted
|
|
|
|
|
|
|
|
- name: Cilium | Create Cilium certs directory
|
|
|
|
file:
|
|
|
|
dest: "{{ cilium_cert_dir }}"
|
|
|
|
state: directory
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0750"
|
2021-03-24 04:46:06 +08:00
|
|
|
owner: root
|
|
|
|
group: root
|
2022-01-17 01:29:28 +08:00
|
|
|
when:
|
2022-02-09 06:04:35 +08:00
|
|
|
- cilium_identity_allocation_mode == "kvstore"
|
2021-03-24 04:46:06 +08:00
|
|
|
|
|
|
|
- name: Cilium | Link etcd certificates for cilium
|
|
|
|
file:
|
|
|
|
src: "{{ etcd_cert_dir }}/{{ item.s }}"
|
|
|
|
dest: "{{ cilium_cert_dir }}/{{ item.d }}"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2021-03-24 04:46:06 +08:00
|
|
|
state: hard
|
2024-08-28 13:30:56 +08:00
|
|
|
force: true
|
2021-04-30 23:09:59 +08:00
|
|
|
loop:
|
2021-03-24 04:46:06 +08:00
|
|
|
- {s: "{{ kube_etcd_cacert_file }}", d: "ca_cert.crt"}
|
|
|
|
- {s: "{{ kube_etcd_cert_file }}", d: "cert.crt"}
|
|
|
|
- {s: "{{ kube_etcd_key_file }}", d: "key.pem"}
|
2022-01-17 01:29:28 +08:00
|
|
|
when:
|
2022-02-09 06:04:35 +08:00
|
|
|
- cilium_identity_allocation_mode == "kvstore"
|
2021-03-24 04:46:06 +08:00
|
|
|
|
2021-04-30 23:09:59 +08:00
|
|
|
- name: Cilium | Create hubble dir
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/hubble"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0755"
|
2021-04-30 23:09:59 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
|
|
|
- cilium_hubble_install
|
|
|
|
|
2021-03-24 04:46:06 +08:00
|
|
|
- name: Cilium | Create Cilium node manifests
|
|
|
|
template:
|
2022-05-11 21:23:04 +08:00
|
|
|
src: "{{ item.name }}/{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item.name }}-{{ item.file }}"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2021-04-30 23:09:59 +08:00
|
|
|
loop:
|
2022-05-11 21:23:04 +08:00
|
|
|
- {name: cilium, file: config.yml, type: cm}
|
|
|
|
- {name: cilium-operator, file: crb.yml, type: clusterrolebinding}
|
|
|
|
- {name: cilium-operator, file: cr.yml, type: clusterrole}
|
|
|
|
- {name: cilium, file: crb.yml, type: clusterrolebinding}
|
|
|
|
- {name: cilium, file: cr.yml, type: clusterrole}
|
|
|
|
- {name: cilium, file: secret.yml, type: secret, when: "{{ cilium_encryption_enabled and cilium_encryption_type == 'ipsec' }}"}
|
|
|
|
- {name: cilium, file: ds.yml, type: ds}
|
|
|
|
- {name: cilium-operator, file: deploy.yml, type: deploy}
|
|
|
|
- {name: cilium-operator, file: sa.yml, type: sa}
|
|
|
|
- {name: cilium, file: sa.yml, type: sa}
|
2021-03-24 04:46:06 +08:00
|
|
|
register: cilium_node_manifests
|
|
|
|
when:
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
2021-04-19 17:06:36 +08:00
|
|
|
- item.when | default(True) | bool
|
2021-03-24 04:46:06 +08:00
|
|
|
|
2021-04-30 23:09:59 +08:00
|
|
|
- name: Cilium | Create Cilium Hubble manifests
|
|
|
|
template:
|
2022-05-11 21:23:04 +08:00
|
|
|
src: "{{ item.name }}/{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/hubble/{{ item.name }}-{{ item.file }}"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2021-04-30 23:09:59 +08:00
|
|
|
loop:
|
2022-05-11 21:23:04 +08:00
|
|
|
- {name: hubble, file: config.yml, type: cm}
|
|
|
|
- {name: hubble, file: crb.yml, type: clusterrolebinding}
|
|
|
|
- {name: hubble, file: cr.yml, type: clusterrole}
|
|
|
|
- {name: hubble, file: cronjob.yml, type: cronjob, when: "{{ cilium_hubble_tls_generate }}"}
|
|
|
|
- {name: hubble, file: deploy.yml, type: deploy}
|
|
|
|
- {name: hubble, file: job.yml, type: job, when: "{{ cilium_hubble_tls_generate }}"}
|
|
|
|
- {name: hubble, file: sa.yml, type: sa}
|
|
|
|
- {name: hubble, file: service.yml, type: service}
|
2021-04-30 23:09:59 +08:00
|
|
|
register: cilium_hubble_manifests
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
|
|
|
- cilium_enable_hubble and cilium_hubble_install
|
|
|
|
- item.when | default(True) | bool
|
|
|
|
|
2021-03-24 04:46:06 +08:00
|
|
|
- name: Cilium | Enable portmap addon
|
|
|
|
template:
|
|
|
|
src: 000-cilium-portmap.conflist.j2
|
|
|
|
dest: /etc/cni/net.d/000-cilium-portmap.conflist
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2021-03-24 04:46:06 +08:00
|
|
|
when: cilium_enable_portmap
|
2022-10-31 08:02:45 +08:00
|
|
|
|
|
|
|
- name: Cilium | Copy Ciliumcli binary from download dir
|
|
|
|
copy:
|
2024-01-16 12:23:00 +08:00
|
|
|
src: "{{ local_release_dir }}/cilium"
|
2022-10-31 08:02:45 +08:00
|
|
|
dest: "{{ bin_dir }}/cilium"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0755"
|
2024-08-28 13:30:56 +08:00
|
|
|
remote_src: true
|