Skip to content

Commit 30f0523

Browse files
authored
Support configuring file permission for the Antrea CNI configuration file (#7098)
Signed-off-by: Lan Luo <[email protected]>
1 parent f8d6115 commit 30f0523

File tree

9 files changed

+29
-1
lines changed

9 files changed

+29
-1
lines changed

build/charts/antrea/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Kubernetes: `>= 1.19.0-0`
6767
| auditLogging.maxBackups | int | `3` | MaxBackups is the maximum number of old log files to retain. If set to 0, all log files will be retained (unless MaxAge causes them to be deleted). |
6868
| auditLogging.maxSize | int | `500` | MaxSize is the maximum size in MB of a log file before it gets rotated. |
6969
| clientCAFile | string | `""` | File path of the certificate bundle for all the signers that is recognized for incoming client certificates. |
70+
| cni.configFileMode | string | `"644"` | The file permission for 10-antrea.conflist when it is installed in the CNI configuration directory on the host. |
7071
| cni.hostBinPath | string | `"/opt/cni/bin"` | Installation path of CNI binaries on the host. |
7172
| cni.plugins | object | `{"bandwidth":true,"portmap":true}` | Chained plugins to use alongside antrea-cni. |
7273
| cni.skipBinaries | list | `[]` | CNI binaries shipped with Antrea for which installation should be skipped. |

build/charts/antrea/templates/agent/daemonset.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ spec:
105105
- name: SKIP_LOADING_KERNEL_MODULES
106106
value: "1"
107107
{{- end }}
108+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
109+
# The default value will be '644' if it's empty.
110+
- name: CONFIG_FILE_MODE
111+
value: "{{ .Values.cni.configFileMode }}"
108112
volumeMounts:
109113
- name: antrea-config
110114
mountPath: /etc/antrea/antrea-cni.conflist

build/charts/antrea/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ cni:
429429
# -- CNI binaries shipped with Antrea for which installation should be
430430
# skipped.
431431
skipBinaries: []
432+
# -- The file permission for 10-antrea.conflist when it is installed in
433+
# the CNI configuration directory on the host.
434+
configFileMode: "644"
432435

433436
webhooks:
434437
labelsMutator:

build/images/scripts/install_cni

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fi
4949
# Install Antrea configuration file.
5050
# Note that it needs to be executed after installing the above binaries because container runtimes such as cri-o may
5151
# watch the conf directory and try to validate the config and binaries immediately once there is a change.
52-
install -m 644 /etc/antrea/antrea-cni.conflist /host/etc/cni/net.d/10-antrea.conflist
52+
install -m "${CONFIG_FILE_MODE:-644}" /etc/antrea/antrea-cni.conflist /host/etc/cni/net.d/10-antrea.conflist
5353

5454
# If more than one CNI config file exists, the file with the lowest name is
5555
# chosen i.e. existing 10-antrea.conf will be chosen over 10-antrea.conflist.

build/yamls/antrea-aks.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5486,6 +5486,10 @@ spec:
54865486
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
54875487
- name: SKIP_CNI_BINARIES
54885488
value: ""
5489+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
5490+
# The default value will be '644' if it's empty.
5491+
- name: CONFIG_FILE_MODE
5492+
value: "644"
54895493
volumeMounts:
54905494
- name: antrea-config
54915495
mountPath: /etc/antrea/antrea-cni.conflist

build/yamls/antrea-eks.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5485,6 +5485,10 @@ spec:
54855485
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
54865486
- name: SKIP_CNI_BINARIES
54875487
value: ""
5488+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
5489+
# The default value will be '644' if it's empty.
5490+
- name: CONFIG_FILE_MODE
5491+
value: "644"
54885492
volumeMounts:
54895493
- name: antrea-config
54905494
mountPath: /etc/antrea/antrea-cni.conflist

build/yamls/antrea-gke.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5483,6 +5483,10 @@ spec:
54835483
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
54845484
- name: SKIP_CNI_BINARIES
54855485
value: ""
5486+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
5487+
# The default value will be '644' if it's empty.
5488+
- name: CONFIG_FILE_MODE
5489+
value: "644"
54865490
volumeMounts:
54875491
- name: antrea-config
54885492
mountPath: /etc/antrea/antrea-cni.conflist

build/yamls/antrea-ipsec.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5497,6 +5497,10 @@ spec:
54975497
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
54985498
- name: SKIP_CNI_BINARIES
54995499
value: ""
5500+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
5501+
# The default value will be '644' if it's empty.
5502+
- name: CONFIG_FILE_MODE
5503+
value: "644"
55005504
volumeMounts:
55015505
- name: antrea-config
55025506
mountPath: /etc/antrea/antrea-cni.conflist

build/yamls/antrea.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5483,6 +5483,10 @@ spec:
54835483
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
54845484
- name: SKIP_CNI_BINARIES
54855485
value: ""
5486+
# CONFIG_FILE_MODE set the file permission for 10-antrea.conflist.
5487+
# The default value will be '644' if it's empty.
5488+
- name: CONFIG_FILE_MODE
5489+
value: "644"
54865490
volumeMounts:
54875491
- name: antrea-config
54885492
mountPath: /etc/antrea/antrea-cni.conflist

0 commit comments

Comments
 (0)