Only create directories if they are needed
@@ -638,6 +638,10 @@ func checkConflictingNodes(client *client.Client, node *api.Node) {
// Checks that the filesystem is as expected and fix it if possible
func ensureFilesystemAsExpected() {
+ // BIRD requires the /var/run/calico directory in order to provide status
+ // information over the control socket, but other backends do not
+ // need this check.
+ if strings.ToLower(os.Getenv("CALICO_NETWORKING_BACKEND")) == "bird" {
runDir := "/var/run/calico"
// Check if directory already exists
if _, err := os.Stat(runDir); err != nil {
@@ -648,7 +652,10 @@ func ensureFilesystemAsExpected() {
}
warning("%s was not mounted, 'calicoctl node status' may provide incomplete status information", runDir)
}
+ }
+ // Ensure the log directory exists but only if logging to file is enabled.
+ if strings.ToLower(os.Getenv("CALICO_DISABLE_FILE_LOGGING")) != "true" {
logDir := "/var/log/calico"
// Check if directory already exists
if _, err := os.Stat(logDir); err != nil {
@@ -659,6 +666,7 @@ func ensureFilesystemAsExpected() {
}
warning("%s was not mounted, 'calicoctl node diags' will not be able to collect logs", logDir)
}
+ }
}
