-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SKIP_CNI_BINARIES env var to support skipping installing specified cni bins #3454
Add SKIP_CNI_BINARIES env var to support skipping installing specified cni bins #3454
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3454 +/- ##
===========================================
- Coverage 65.28% 54.97% -10.32%
===========================================
Files 268 374 +106
Lines 26900 41447 +14547
===========================================
+ Hits 17563 22784 +5221
- Misses 7432 16263 +8831
- Partials 1905 2400 +495
Flags with carried forward coverage won't be shown. Click here to find out more.
|
68ccf8a
to
3a0ef43
Compare
build/yamls/base/agent.yml
Outdated
env: | ||
- name: SKIP_CNI_BINARIES | ||
value: "" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this line
build/images/scripts/install_cni
Outdated
for args in $flags; do | ||
binaries+=($args) | ||
done | ||
IFS=$oldDelimeter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above can be written in one line:
IFS=',' read -r -a binaries <<< "$SKIP_CNI_BINARIES"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think by specifying IFS before the command, it only affects that line. Maybe you can test to verify it.
build/images/scripts/install_cni
Outdated
# Install the loopback plugin. | ||
# It is required by kubelet on Linux when using docker as the container runtime. | ||
# We replace the binary files even they are already present on the Node to make | ||
# sure expected versions are used. | ||
install -m 755 /opt/cni/bin/loopback /host/opt/cni/bin/loopback | ||
if [[ ! " ${binaries[*]}" =~ "loopback" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it works for current case, it's not very precise. For example, if there is one cni called loopback2, it would be matched by mistake. This would be more precise:
if [[ ! " ${binaries[*]} " =~ " loopback " ]]; then
@@ -3296,6 +3296,9 @@ spec: | |||
initContainers: | |||
- command: | |||
- install_cni_chaining | |||
env: | |||
- name: SKIP_CNI_BINARIES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide a sample about how to set this variable? I didn't see you mention it anywhere.
I remember kustomize will remove all comments from yaml @tnqn any suggestion about where to put the sample information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I add the comment in the antrea.yml file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be used by distros and end users won't care about it. So perhaps adding comment to the base yaml is enough, I think it's fine to not have it in the generated yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, could you update the PR title to be more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes sure would do that
3a0ef43
to
fe0a93e
Compare
build/images/scripts/install_cni
Outdated
for args in $flags; do | ||
binaries+=($args) | ||
done | ||
IFS=$oldDelimeter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think by specifying IFS before the command, it only affects that line. Maybe you can test to verify it.
build/yamls/base/agent.yml
Outdated
@@ -48,6 +48,11 @@ spec: | |||
add: | |||
# SYS_MODULE is required to load the OVS kernel module. | |||
- SYS_MODULE | |||
env: | |||
# SKIP_CNI_BINARIES takes in values as a comma separated list of | |||
# binaries that need to be skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# binaries that need to be skipped. | |
# binaries that need to be skipped for installation, e.g. "portmap, bandwdith". |
This title may be more proper: Add SKIP_CNI_BINARIES env var to support skipping installing specified cni bins |
fe0a93e
to
f38ddda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
/test-all |
build/yamls/base/agent.yml
Outdated
@@ -48,6 +48,11 @@ spec: | |||
add: | |||
# SYS_MODULE is required to load the OVS kernel module. | |||
- SYS_MODULE | |||
env: | |||
# SKIP_CNI_BINARIES takes in values as a comma separated list of | |||
# binaries that need to be skipped for installation, e.g. "portmap, bandwdith". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# binaries that need to be skipped for installation, e.g. "portmap, bandwdith". | |
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth". |
This caused spelling check failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, I din't gave a relook to it. I will make the change
…d cni bins This commit adds a skip_cni_binaries variable, to allow users to skip installing some of the CNI plugin binaries which they think are not required for certain reasons. Signed-off-by: Pulkit Jain <[email protected]>
f38ddda
to
cfac4d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/test-all |
@@ -2,25 +2,38 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if in the future we should consider replacing this bash script with a small Go binary for maintainability and unit testing?
Fixes #3422.
This PR adds a new feature by introducing skip_cni_binaries variable, to allow users to skip
installing some of the CNI plugin binaries which they think are not
required for certain reasons.
Signed-off-by: Pulkit Jain [email protected]