Browse Source
Overhaul Cilium manifests to match the newer versions (#8717)
Overhaul Cilium manifests to match the newer versions (#8717)
* [cilium] Separate templates for cilium, cilium-operator, and hubble installations Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Update cilium-operator templates Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Allow using custom args and mounting extra volumes for the Cilium Operator Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Update the cilium configmap to filter out the deprecated variables, and add the new variables Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Add an option to use Wireguard encryption on Cilium 1.10 and up Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Update cilium-agent templates Signed-off-by: necatican <necaticanyildirim@gmail.com> * [cilium] Bump Cilium version to 1.11.3 Signed-off-by: necatican <necaticanyildirim@gmail.com>pull/8811/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 606 additions and 192 deletions
Split View
Diff Options
-
86docs/cilium.md
-
45inventory/sample/group_vars/k8s_cluster/k8s-net-cilium.yml
-
2roles/download/defaults/main.yml
-
65roles/network_plugin/cilium/defaults/main.yml
-
4roles/network_plugin/cilium/tasks/apply.yml
-
58roles/network_plugin/cilium/tasks/check.yml
-
41roles/network_plugin/cilium/tasks/install.yml
-
130roles/network_plugin/cilium/templates/cilium-operator/cr.yml.j2
-
13roles/network_plugin/cilium/templates/cilium-operator/crb.yml.j2
-
17roles/network_plugin/cilium/templates/cilium-operator/deploy.yml.j2
-
6roles/network_plugin/cilium/templates/cilium-operator/sa.yml.j2
-
43roles/network_plugin/cilium/templates/cilium/config.yml.j2
-
134roles/network_plugin/cilium/templates/cilium/cr.yml.j2
-
13roles/network_plugin/cilium/templates/cilium/crb.yml.j2
-
135roles/network_plugin/cilium/templates/cilium/ds.yml.j2
-
6roles/network_plugin/cilium/templates/cilium/sa.yml.j2
-
0roles/network_plugin/cilium/templates/cilium/secret.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/config.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/cr.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/crb.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/cronjob.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/job.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/sa.yml.j2
-
0roles/network_plugin/cilium/templates/hubble/service.yml.j2
@ -1,4 +1,47 @@ |
|||
# see roles/network_plugin/cilium/defaults/main.yml |
|||
|
|||
# cilium_version: "v1.11.0" |
|||
# cilium_version: "v1.11.3" |
|||
# cilium_identity_allocation_mode: kvstore # kvstore or crd |
|||
|
|||
# For adding and mounting extra volumes to the cilium operator |
|||
# cilium_operator_extra_volumes: [] |
|||
# cilium_operator_extra_volume_mounts: [] |
|||
|
|||
# Name of the cluster. Only relevant when building a mesh of clusters. |
|||
# cilium_cluster_name: default |
|||
|
|||
# Unique ID of the cluster. Must be unique across all conneted clusters and |
|||
# in the range of 1 and 255. Only relevant when building a mesh of clusters. |
|||
# This value is not defined by default |
|||
# cluster-id: |
|||
|
|||
# Allows to explicitly specify the IPv4 CIDR for native routing. |
|||
# When specified, Cilium assumes networking for this CIDR is preconfigured and |
|||
# hands traffic destined for that range to the Linux network stack without |
|||
# applying any SNAT. |
|||
# Generally speaking, specifying a native routing CIDR implies that Cilium can |
|||
# depend on the underlying networking stack to route packets to their |
|||
# destination. To offer a concrete example, if Cilium is configured to use |
|||
# direct routing and the Kubernetes CIDR is included in the native routing CIDR, |
|||
# the user must configure the routes to reach pods, either manually or by |
|||
# setting the auto-direct-node-routes flag. |
|||
# cilium_native_routing_cidr: "" |
|||
|
|||
# Allows to explicitly specify the IPv6 CIDR for native routing. |
|||
# cilium_native_routing_cidr_ipv6: "" |
|||
|
|||
# Encryption |
|||
# Enable transparent network encryption. |
|||
# cilium_encryption_enabled: false |
|||
|
|||
# Encryption method. Can be either ipsec or wireguard. |
|||
# Only effective when `cilium_encryption_enabled` is set to true. |
|||
# cilium_encryption_type: "ipsec" |
|||
|
|||
# Enable encryption for pure node to node traffic. |
|||
# This option is only effective when `cilium_encryption_type` is set to `ipsec`. |
|||
# cilium_ipsec_node_encryption: "false" |
|||
|
|||
# Enables the fallback to the user-space implementation. |
|||
# This option is only effective when `cilium_encryption_type` is set to `wireguard`. |
|||
# cilium_wireguard_userspace_fallback: "false" |
@ -1,14 +1,66 @@ |
|||
--- |
|||
- name: Cilium | Check cilium_ipsec_enabled variables |
|||
- name: Cilium | Check Cilium encryption `cilium_ipsec_key` for ipsec |
|||
assert: |
|||
that: |
|||
- "cilium_ipsec_key is defined" |
|||
msg: "cilium_ipsec_key should be defined to use cilium_ipsec_enabled" |
|||
msg: "cilium_ipsec_key should be defined to enable encryption using ipsec" |
|||
when: |
|||
- cilium_ipsec_enabled |
|||
- cilium_encryption_enabled |
|||
- cilium_encryption_type == "ipsec" |
|||
- cilium_tunnel_mode in ['vxlan'] |
|||
|
|||
# TODO: Clean this task up when we drop backward compatibility support for `cilium_ipsec_enabled` |
|||
- name: Stop if `cilium_ipsec_enabled` is defined and `cilium_encryption_type` is not `ipsec` |
|||
assert: |
|||
that: cilium_encryption_type == 'ipsec' |
|||
msg: > |
|||
It is not possible to use `cilium_ipsec_enabled` when `cilium_encryption_type` is set to {{ cilium_encryption_type }}. |
|||
when: |
|||
- cilium_ipsec_enabled is defined |
|||
- cilium_ipsec_enabled |
|||
- kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool |
|||
|
|||
- name: Stop if kernel version is too low for Cilium Wireguard encryption |
|||
assert: |
|||
that: ansible_kernel.split('-')[0] is version('5.6.0', '>=') |
|||
when: |
|||
- kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool |
|||
- cilium_encryption_enabled |
|||
- cilium_encryption_type == "wireguard" |
|||
- not ignore_assert_errors |
|||
|
|||
- name: Stop if bad Cilium identity allocation mode |
|||
assert: |
|||
that: cilium_identity_allocation_mode in ['crd', 'kvstore'] |
|||
msg: "cilium_identity_allocation_mode must be either 'crd' or 'kvstore'" |
|||
|
|||
- name: Stop if bad Cilium Cluster ID |
|||
assert: |
|||
that: |
|||
- cilium_cluster_id <= 255 |
|||
- cilium_cluster_id >= 0 |
|||
msg: "'cilium_cluster_id' must be between 1 and 255" |
|||
when: cilium_cluster_id is defined |
|||
|
|||
- name: Stop if bad encryption type |
|||
assert: |
|||
that: cilium_encryption_type in ['ipsec', 'wireguard'] |
|||
msg: "cilium_encryption_type must be either 'ipsec' or 'wireguard'" |
|||
when: cilium_encryption_enabled |
|||
|
|||
- name: Stop if `cilium_encryption_type` is set to "wireguard" and cilium_version is < v1.10.0 |
|||
assert: |
|||
that: cilium_version | regex_replace('v') is version('1.10', '>') |
|||
msg: "cilium_encryption_type is set to 'wireguard' but cilium_version is < v1.10.0" |
|||
when: |
|||
- cilium_encryption_enabled |
|||
- cilium_encryption_type == "wireguard" |
|||
|
|||
# TODO: Clean this task up when we drop backward compatibility support for `cilium_ipsec_enabled` |
|||
- name: Set `cilium_encryption_type` to "ipsec" and if `cilium_ipsec_enabled` is true |
|||
set_fact: |
|||
cilium_encryption_type: ipsec |
|||
cilium_encryption_enabled: true |
|||
when: |
|||
- cilium_ipsec_enabled is defined |
|||
- cilium_ipsec_enabled |
@ -0,0 +1,13 @@ |
|||
--- |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: ClusterRoleBinding |
|||
metadata: |
|||
name: cilium-operator |
|||
roleRef: |
|||
apiGroup: rbac.authorization.k8s.io |
|||
kind: ClusterRole |
|||
name: cilium-operator |
|||
subjects: |
|||
- kind: ServiceAccount |
|||
name: cilium-operator |
|||
namespace: kube-system |
@ -0,0 +1,134 @@ |
|||
--- |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: ClusterRole |
|||
metadata: |
|||
name: cilium |
|||
rules: |
|||
- apiGroups: |
|||
- networking.k8s.io |
|||
resources: |
|||
{% if cilium_version | regex_replace('v') is version('1.7', '<') %} |
|||
- ingresses |
|||
{% endif %} |
|||
- networkpolicies |
|||
verbs: |
|||
- get |
|||
- list |
|||
- watch |
|||
- apiGroups: |
|||
- discovery.k8s.io |
|||
resources: |
|||
- endpointslices |
|||
verbs: |
|||
- get |
|||
- list |
|||
- watch |
|||
- apiGroups: |
|||
- "" |
|||
resources: |
|||
- namespaces |
|||
- services |
|||
- nodes |
|||
- endpoints |
|||
{% if cilium_version | regex_replace('v') is version('1.7', '<') %} |
|||
- componentstatuses |
|||
{% endif %} |
|||
verbs: |
|||
- get |
|||
- list |
|||
- watch |
|||
{% if cilium_version | regex_replace('v') is version('1.7', '<') %} |
|||
- apiGroups: |
|||
- extensions |
|||
resources: |
|||
- ingresses |
|||
verbs: |
|||
- create |
|||
- get |
|||
- list |
|||
- watch |
|||
{% endif %} |
|||
{% if cilium_version | regex_replace('v') is version('1.7', '>') %} |
|||
- apiGroups: |
|||
- "" |
|||
resources: |
|||
- pods/finalizers |
|||
verbs: |
|||
- update |
|||
{% endif %} |
|||
- apiGroups: |
|||
- "" |
|||
resources: |
|||
- pods |
|||
- nodes |
|||
verbs: |
|||
- get |
|||
- list |
|||
- watch |
|||
- update |
|||
- apiGroups: |
|||
- "" |
|||
resources: |
|||
- nodes |
|||
- nodes/status |
|||
verbs: |
|||
- patch |
|||
- apiGroups: |
|||
- apiextensions.k8s.io |
|||
resources: |
|||
- customresourcedefinitions |
|||
verbs: |
|||
- create |
|||
- get |
|||
- list |
|||
- watch |
|||
- update |
|||
- apiGroups: |
|||
- cilium.io |
|||
resources: |
|||
- ciliumnetworkpolicies |
|||
- ciliumnetworkpolicies/status |
|||
{% if cilium_version | regex_replace('v') is version('1.7', '>=') %} |
|||
- ciliumclusterwidenetworkpolicies |
|||
- ciliumclusterwidenetworkpolicies/status |
|||
{% endif %} |
|||
- ciliumendpoints |
|||
- ciliumendpoints/status |
|||
{% if cilium_version | regex_replace('v') is version('1.6', '>=') %} |
|||
- ciliumnodes |
|||
- ciliumnodes/status |
|||
- ciliumidentities |
|||
- ciliumidentities/status |
|||
{% endif %} |
|||
{% if cilium_version | regex_replace('v') is version('1.9', '>=') %} |
|||
- ciliumnetworkpolicies/finalizers |
|||
- ciliumclusterwidenetworkpolicies/finalizers |
|||
- ciliumendpoints/finalizers |
|||
- ciliumnodes/finalizers |
|||
- ciliumidentities/finalizers |
|||
- ciliumlocalredirectpolicies |
|||
- ciliumlocalredirectpolicies/status |
|||
- ciliumlocalredirectpolicies/finalizers |
|||
{% endif %} |
|||
{% if cilium_version | regex_replace('v') is version('1.10', '>=') %} |
|||
- ciliumegressnatpolicies |
|||
{% endif %} |
|||
{% if cilium_version | regex_replace('v') is version('1.11', '>=') %} |
|||
- ciliumendpointslices |
|||
{% endif %} |
|||
{% if cilium_version | regex_replace('v') is version('1.12', '>=') %} |
|||
- ciliumbgploadbalancerippools |
|||
- ciliumbgppeeringpolicies |
|||
{% endif %} |
|||
verbs: |
|||
- '*' |
|||
{% if cilium_version | regex_replace('v') is version('1.12', '>=') %} |
|||
- apiGroups: |
|||
- cilium.io |
|||
resources: |
|||
- ciliumclusterwideenvoyconfigs |
|||
- ciliumenvoyconfigs |
|||
verbs: |
|||
- list |
|||
- watch |
|||
{% endif %} |
@ -1,19 +1,6 @@ |
|||
--- |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: ClusterRoleBinding |
|||
metadata: |
|||
name: cilium-operator |
|||
roleRef: |
|||
apiGroup: rbac.authorization.k8s.io |
|||
kind: ClusterRole |
|||
name: cilium-operator |
|||
subjects: |
|||
- kind: ServiceAccount |
|||
name: cilium-operator |
|||
namespace: kube-system |
|||
--- |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: ClusterRoleBinding |
|||
metadata: |
|||
name: cilium |
|||
roleRef: |
@ -0,0 +1,6 @@ |
|||
--- |
|||
apiVersion: v1 |
|||
kind: ServiceAccount |
|||
metadata: |
|||
name: cilium |
|||
namespace: kube-system |
Write
Preview
Loading…
Cancel
Save