Skip to content

Commit bc6de32

Browse files
fholgerk8s-ci-robot
authored andcommitted
Upgrade Cilium network plugin to v1.5.5. (#5014)
* Needs an additional cilium-operator deployment. * Added option to enable hostPort mappings.
1 parent 7cf8ad4 commit bc6de32

File tree

11 files changed

+566
-213
lines changed

11 files changed

+566
-213
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Supported Components
117117
- [cni-plugins](https://github.com/containernetworking/plugins) v0.8.1
118118
- [calico](https://github.com/projectcalico/calico) v3.7.3
119119
- [canal](https://github.com/projectcalico/canal) (given calico/flannel versions)
120-
- [cilium](https://github.com/cilium/cilium) v1.3.0
120+
- [cilium](https://github.com/cilium/cilium) v1.5.5
121121
- [contiv](https://github.com/contiv/install) v1.2.1
122122
- [flanneld](https://github.com/coreos/flannel) v0.11.0
123123
- [kube-router](https://github.com/cloudnativelabs/kube-router) v0.2.5

roles/download/defaults/main.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ cni_version: "v0.8.1"
7373
weave_version: 2.5.2
7474
pod_infra_version: 3.1
7575
contiv_version: 1.2.1
76-
cilium_version: "v1.3.0"
76+
cilium_version: "v1.5.5"
7777
kube_ovn_version: "v0.6.0"
7878
kube_router_version: "v0.2.5"
7979
multus_version: "v3.1.autoconf"
@@ -237,8 +237,10 @@ contiv_ovs_image_repo: "docker.io/contiv/ovs"
237237
contiv_ovs_image_tag: "latest"
238238
cilium_image_repo: "docker.io/cilium/cilium"
239239
cilium_image_tag: "{{ cilium_version }}"
240-
cilium_init_image_repo: "docker.io/library/busybox"
241-
cilium_init_image_tag: "1.28.4"
240+
cilium_init_image_repo: "docker.io/cilium/cilium-init"
241+
cilium_init_image_tag: "2019-04-05"
242+
cilium_operator_image_repo: "docker.io/cilium/operator"
243+
cilium_operator_image_tag: "{{ cilium_version }}"
242244
kube_ovn_db_image_repo: "index.alauda.cn/alaudak8s/kube-ovn-db"
243245
kube_ovn_node_image_repo: "index.alauda.cn/alaudak8s/kube-ovn-node"
244246
kube_ovn_cni_image_repo: "index.alauda.cn/alaudak8s/kube-ovn-cni"
@@ -415,6 +417,15 @@ downloads:
415417
groups:
416418
- k8s-cluster
417419

420+
cilium_operator:
421+
enabled: "{{ kube_network_plugin == 'cilium' }}"
422+
container: true
423+
repo: "{{ cilium_operator_image_repo }}"
424+
tag: "{{ cilium_operator_image_tag }}"
425+
sha256: "{{ cilium_operator_digest_checksum|default(None) }}"
426+
groups:
427+
- k8s-cluster
428+
418429
multus:
419430
enabled: "{{ kube_network_plugin_multus }}"
420431
container: true
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
---
22
# Log-level
33
cilium_debug: false
4-
cilium_disable_ipv4: false
4+
5+
cilium_enable_ipv4: true
6+
cilium_enable_ipv6: false
57

68
# Etcd SSL dirs
79
cilium_cert_dir: /etc/cilium/certs
810
kube_etcd_cacert_file: ca.pem
911
kube_etcd_cert_file: node-{{ inventory_hostname }}.pem
1012
kube_etcd_key_file: node-{{ inventory_hostname }}-key.pem
1113

12-
# Cilium Network Policy directory
13-
cilium_policy_dir: /etc/kubernetes/policy
14-
1514
# Limits for apps
1615
cilium_memory_limit: 500M
1716
cilium_cpu_limit: 500m
@@ -20,3 +19,12 @@ cilium_cpu_requests: 100m
2019

2120
# Optional features
2221
cilium_enable_prometheus: false
22+
# Enable if you want to make use of hostPort mappings
23+
cilium_enable_portmap: false
24+
25+
# If upgrading from Cilium < 1.5, you may want to override some of these options
26+
# to prevent service disruptions. See also:
27+
# http://docs.cilium.io/en/stable/install/upgrade/#changes-that-may-require-action
28+
cilium_preallocate_bpf_maps: false
29+
cilium_tofqdns_enable_poller: false
30+
cilium_enable_legacy_services: false

roles/network_plugin/cilium/tasks/main.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- {name: cilium, file: cilium-crb.yml, type: clusterrolebinding}
3535
- {name: cilium, file: cilium-cr.yml, type: clusterrole}
3636
- {name: cilium, file: cilium-ds.yml, type: ds}
37+
- {name: cilium, file: cilium-deploy.yml, type: deploy}
3738
- {name: cilium, file: cilium-sa.yml, type: sa}
3839
register: cilium_node_manifests
3940
when:
@@ -48,7 +49,16 @@
4849
mode: 0755
4950
register: cni_bin_dir
5051

51-
- name: Cilium | Create network policy directory
52-
file:
53-
path: "{{ cilium_policy_dir }}"
54-
state: directory
52+
- name: Cilium | Copy CNI plugins
53+
unarchive:
54+
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
55+
dest: "/opt/cni/bin"
56+
mode: 0755
57+
remote_src: yes
58+
when: cilium_enable_portmap
59+
60+
- name: Cilium | Enable portmap addon
61+
template:
62+
src: 000-cilium-portmap.conflist.j2
63+
dest: /etc/cni/net.d/000-cilium-portmap.conflist
64+
when: cilium_enable_portmap
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"cniVersion": "0.3.1",
3+
"name": "cilium-portmap",
4+
"plugins": [
5+
{
6+
"type": "cilium-cni"
7+
},
8+
{
9+
"type": "portmap",
10+
"capabilities": { "portMappings": true }
11+
}
12+
]
13+
}

roles/network_plugin/cilium/templates/cilium-config.yml.j2

100755100644
Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,76 @@ data:
2525
key-file: "{{ cilium_cert_dir }}/key.pem"
2626
cert-file: "{{ cilium_cert_dir }}/cert.crt"
2727

28+
# If you want metrics enabled in all of your Cilium agents, set the port for
29+
# which the Cilium agents will have their metrics exposed.
30+
# This option deprecates the "prometheus-serve-addr" in the
31+
# "cilium-metrics-config" ConfigMap
32+
# NOTE that this will open the port on ALL nodes where Cilium pods are
33+
# scheduled.
34+
{% if cilium_enable_prometheus %}
35+
prometheus-serve-addr: ":9090"
36+
{% endif %}
37+
2838
# If you want to run cilium in debug mode change this value to true
2939
debug: "{{ cilium_debug }}"
30-
disable-ipv4: "{{ cilium_disable_ipv4 }}"
31-
# If you want to clean cilium state; change this value to true
40+
enable-ipv4: "{{ cilium_enable_ipv4 }}"
41+
enable-ipv6: "{{ cilium_enable_ipv6 }}"
42+
# If a serious issue occurs during Cilium startup, this
43+
# invasive option may be set to true to remove all persistent
44+
# state. Endpoints will not be restored using knowledge from a
45+
# prior Cilium run, so they may receive new IP addresses upon
46+
# restart. This also triggers clean-cilium-bpf-state.
3247
clean-cilium-state: "false"
33-
legacy-host-allows-world: "false"
48+
# If you want to clean cilium BPF state, set this to true;
49+
# Removes all BPF maps from the filesystem. Upon restart,
50+
# endpoints are restored with the same IP addresses, however
51+
# any ongoing connections may be disrupted briefly.
52+
# Loadbalancing decisions will be reset, so any ongoing
53+
# connections via a service may be loadbalanced to a different
54+
# backend after restart.
55+
clean-cilium-bpf-state: "false"
56+
57+
# Users who wish to specify their own custom CNI configuration file must set
58+
# custom-cni-conf to "true", otherwise Cilium may overwrite the configuration.
59+
custom-cni-conf: "false"
3460

3561
# If you want cilium monitor to aggregate tracing for packets, set this level
3662
# to "low", "medium", or "maximum". The higher the level, the less packets
3763
# that will be seen in monitor output.
3864
monitor-aggregation-level: "none"
3965

66+
# ct-global-max-entries-* specifies the maximum number of connections
67+
# supported across all endpoints, split by protocol: tcp or other. One pair
68+
# of maps uses these values for IPv4 connections, and another pair of maps
69+
# use these values for IPv6 connections.
70+
#
71+
# If these values are modified, then during the next Cilium startup the
72+
# tracking of ongoing connections may be disrupted. This may lead to brief
73+
# policy drops or a change in loadbalancing decisions for a connection.
74+
#
75+
# For users upgrading from Cilium 1.2 or earlier, to minimize disruption
76+
# during the upgrade process, comment out these options.
77+
bpf-ct-global-tcp-max: "524288"
78+
bpf-ct-global-any-max: "262144"
79+
80+
# Pre-allocation of map entries allows per-packet latency to be reduced, at
81+
# the expense of up-front memory allocation for the entries in the maps. The
82+
# default value below will minimize memory usage in the default installation;
83+
# users who are sensitive to latency may consider setting this to "true".
84+
#
85+
# This option was introduced in Cilium 1.4. Cilium 1.3 and earlier ignore
86+
# this option and behave as though it is set to "true".
87+
#
88+
# If this value is modified, then during the next Cilium startup the restore
89+
# of existing endpoints and tracking of ongoing connections may be disrupted.
90+
# This may lead to policy drops or a change in loadbalancing decisions for a
91+
# connection for some time. Endpoints may need to be recreated to restore
92+
# connectivity.
93+
#
94+
# If this option is set to "false" during an upgrade from 1.3 or earlier to
95+
# 1.4 or later, then it may cause one-time disruptions during the upgrade.
96+
preallocate-bpf-maps: "{{cilium_preallocate_bpf_maps}}"
97+
4098
# Regular expression matching compatible Istio sidecar istio-proxy
4199
# container image names
42100
sidecar-istio-proxy-image: "cilium/istio_proxy"
@@ -47,3 +105,38 @@ data:
47105
# - vxlan (default)
48106
# - geneve
49107
tunnel: "vxlan"
108+
109+
# Name of the cluster. Only relevant when building a mesh of clusters.
110+
cluster-name: default
111+
112+
# Unique ID of the cluster. Must be unique across all conneted clusters and
113+
# in the range of 1 and 255. Only relevant when building a mesh of clusters.
114+
#cluster-id: 1
115+
116+
# DNS Polling periodically issues a DNS lookup for each `matchName` from
117+
# cilium-agent. The result is used to regenerate endpoint policy.
118+
# DNS lookups are repeated with an interval of 5 seconds, and are made for
119+
# A(IPv4) and AAAA(IPv6) addresses. Should a lookup fail, the most recent IP
120+
# data is used instead. An IP change will trigger a regeneration of the Cilium
121+
# policy for each endpoint and increment the per cilium-agent policy
122+
# repository revision.
123+
#
124+
# This option is disabled by default starting from version 1.4.x in favor
125+
# of a more powerful DNS proxy-based implementation, see [0] for details.
126+
# Enable this option if you want to use FQDN policies but do not want to use
127+
# the DNS proxy.
128+
#
129+
# To ease upgrade, users may opt to set this option to "true".
130+
# Otherwise please refer to the Upgrade Guide [1] which explains how to
131+
# prepare policy rules for upgrade.
132+
#
133+
# [0] http://docs.cilium.io/en/stable/policy/language/#dns-based
134+
# [1] http://docs.cilium.io/en/stable/install/upgrade/#changes-that-may-require-action
135+
tofqdns-enable-poller: "{{cilium_tofqdns_enable_poller}}"
136+
137+
# wait-bpf-mount makes init container wait until bpf filesystem is mounted
138+
wait-bpf-mount: "false"
139+
140+
# Enable legacy services (prior v1.5) to prevent from terminating existing
141+
# connections with services when upgrading Cilium from < v1.5 to v1.5.
142+
enable-legacy-services: "{{cilium_enable_legacy_services}}"

roles/network_plugin/cilium/templates/cilium-cr.yml.j2

100755100644
Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
11
---
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
4+
metadata:
5+
name: cilium-operator
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
# to get k8s version and status
11+
- componentstatuses
12+
verbs:
13+
- get
14+
- apiGroups:
15+
- ""
16+
resources:
17+
# to automatically delete [core|kube]dns pods so that are starting to being
18+
# managed by Cilium
19+
- pods
20+
verbs:
21+
- get
22+
- list
23+
- watch
24+
- delete
25+
- apiGroups:
26+
- ""
27+
resources:
28+
# to automatically read from k8s and import the node's pod CIDR to cilium's
29+
# etcd so all nodes know how to reach another pod running in in a different
30+
# node.
31+
- nodes
32+
# to perform the translation of a CNP that contains `ToGroup` to its endpoints
33+
- services
34+
- endpoints
35+
verbs:
36+
- get
37+
- list
38+
- watch
39+
- apiGroups:
40+
- cilium.io
41+
resources:
42+
- ciliumnetworkpolicies
43+
- ciliumnetworkpolicies/status
44+
- ciliumendpoints
45+
- ciliumendpoints/status
46+
verbs:
47+
- '*'
48+
---
49+
apiVersion: rbac.authorization.k8s.io/v1
50+
kind: ClusterRole
451
metadata:
552
name: cilium
653
rules:
754
- apiGroups:
8-
- "networking.k8s.io"
55+
- networking.k8s.io
956
resources:
1057
- networkpolicies
1158
verbs:
@@ -34,19 +81,24 @@ rules:
3481
- list
3582
- watch
3683
- update
84+
- apiGroups:
85+
- ""
86+
resources:
87+
- nodes
88+
- nodes/status
89+
verbs:
90+
- patch
3791
- apiGroups:
3892
- extensions
3993
resources:
40-
- networkpolicies # FIXME remove this when we drop support for k8s NP-beta GH-1202
41-
- thirdpartyresources
4294
- ingresses
4395
verbs:
4496
- create
4597
- get
4698
- list
4799
- watch
48100
- apiGroups:
49-
- "apiextensions.k8s.io"
101+
- apiextensions.k8s.io
50102
resources:
51103
- customresourcedefinitions
52104
verbs:
@@ -63,12 +115,4 @@ rules:
63115
- ciliumendpoints
64116
- ciliumendpoints/status
65117
verbs:
66-
- "*"
67-
- apiGroups:
68-
- policy
69-
resourceNames:
70-
- privileged
71-
resources:
72-
- podsecuritypolicies
73-
verbs:
74-
- use
118+
- '*'
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
---
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRoleBinding
4+
metadata:
5+
name: cilium-operator
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: cilium-operator
10+
subjects:
11+
- kind: ServiceAccount
12+
name: cilium-operator
13+
namespace: kube-system
14+
---
15+
apiVersion: rbac.authorization.k8s.io/v1
16+
kind: ClusterRoleBinding
417
metadata:
518
name: cilium
619
roleRef:
720
apiGroup: rbac.authorization.k8s.io
821
kind: ClusterRole
922
name: cilium
1023
subjects:
11-
- kind: ServiceAccount
12-
name: cilium
13-
namespace: kube-system
14-
- kind: Group
15-
name: system:nodes
24+
- kind: ServiceAccount
25+
name: cilium
26+
namespace: kube-system
27+
- apiGroup: rbac.authorization.k8s.io
28+
kind: Group
29+
name: system:nodes

0 commit comments

Comments
 (0)