Skip to content

Commit

Permalink
Limit the memory of the rsyslog service (#139)
Browse files Browse the repository at this point in the history
Co-authored-by: Plamen Kokanov <[email protected]>
  • Loading branch information
gardener-ci-robot and plkokanov authored Jul 15, 2024
1 parent fa081e0 commit 4ac347a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/webhook/operatingsystemconfig/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,19 @@ func getRsyslogFiles(rsyslogConfig []byte, useExpectedContent bool) []extensions
},
},
},
{
Path: "/etc/systemd/system/rsyslog.service.d/10-shoot-rsyslog-relp-memory-limits.conf",
Permissions: ptr.To(int32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Data: getBasedOnCondition(useExpectedContent, `[Service]
MemoryMin=15M
MemoryHigh=150M
MemoryMax=300M
MemorySwapMax=0`, "old"),
},
},
},
}
}

Expand Down
15 changes: 15 additions & 0 deletions pkg/webhook/operatingsystemconfig/rsyslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
rsyslogTLSDir = "/etc/ssl/rsyslog"
rsyslogTLSFromOSCDir = rsyslogOSCDir + "/tls"

rsyslogServiceMemoryLimitsDropInPath = "/etc/systemd/system/rsyslog.service.d/10-shoot-rsyslog-relp-memory-limits.conf"

rsyslogConfigPath = "/etc/rsyslog.d/60-audit.conf"
rsyslogConfigFromOSCPath = rsyslogOSCDir + "/rsyslog.d/60-audit.conf"
configureRsyslogScriptPath = rsyslogOSCDir + "/configure-rsyslog.sh"
Expand Down Expand Up @@ -159,6 +161,19 @@ func getRsyslogFiles(rsyslogRelpConfig *rsyslog.RsyslogRelpConfig, cluster *exte
},
},
},
{
Path: rsyslogServiceMemoryLimitsDropInPath,
Permissions: ptr.To(int32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Data: `[Service]
MemoryMin=15M
MemoryHigh=150M
MemoryMax=300M
MemorySwapMax=0`,
},
},
},
}...)

return rsyslogFiles, nil
Expand Down

0 comments on commit 4ac347a

Please sign in to comment.