-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fingerprint: check if the CNI bridge plugin is available #11038
Conversation
97cc915
to
1268b0f
Compare
1268b0f
to
425432f
Compare
A client should declare the "bridge" network fingerprint only if the bridge CNI plugin is available. Currently, Linux clients with the bridge kernel module enabled (pretty much all Linux boxes with Docker installed) declare "bridge" network, but allocs requiring it will fail with `failed to find plugin "bridge" in path [/opt/cni/bin]` error.
425432f
to
551288f
Compare
if err := f.detect(bridgeKernelModuleName); err != nil { | ||
f.logger.Warn("failed to detect bridge kernel module, bridge network mode disabled", "error", err) | ||
if err := f.detect(req); err != nil { | ||
f.logger.Warn("failed to dtect bridge network setup, bridge network mode disabled", "error", err) |
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.
f.logger.Warn("failed to dtect bridge network setup, bridge network mode disabled", "error", err) | |
f.logger.Warn("failed to detect bridge network setup, bridge network mode disabled", "error", err) |
|
||
func (f *BridgeFingerprint) detectCNIBinaries(cniPath string) error { | ||
if cniPath == "" { | ||
return fmt.Errorf("cni is not configured") |
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.
return fmt.Errorf("cni is not configured") | |
return fmt.Errorf("cni_path is not configured") |
path := filepath.Join(cniPath, plugin) | ||
fi, err := os.Stat(path) | ||
if err != nil { | ||
return fmt.Errorf("failed to find the %v CNI plugin in %v: %v", plugin, path, err) | ||
} | ||
|
||
if !fi.Mode().IsRegular() { | ||
return fmt.Errorf("the %v CNI plugin is not a regular file: %v", plugin, path) | ||
|
||
} |
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.
cni_path
can contain multiple :
delimited paths, so this needs to use filepath.SplitList
and loop over the paths.
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Mahmood Ali seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
Closing this one as it was implemented in #15452. |
A client should declare the "bridge" network fingerprint only if the
bridge CNI plugin is available.
Currently, Linux clients with the bridge kernel module enabled (pretty
much all Linux boxes with Docker installed) declare "bridge" network,
but allocs requiring it will fail with
failed to find plugin "bridge" in path [/opt/cni/bin]
error.Related to #11034