Skip to content

Commit aac921e

Browse files
committed
mariadb: allow mysqld to set max_connections at startup
Mariadb pods are started as user mysql, which has no specific right to configure file descriptor limits. This prevents the server from honoring the requested max_connections of 4096. Make the pod start mysqld as root, and let the mysqld server drop privileges to user mysql explicitly. This way, the server can configure limits prior to accepting connections.
1 parent 9b37cd8 commit aac921e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/pod.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
// Pod -
1010
func Pod(db *databasev1beta1.MariaDB, configHash string) *corev1.Pod {
1111

12+
runAsUser := int64(0)
1213
pod := &corev1.Pod{
1314
ObjectMeta: metav1.ObjectMeta{
1415
Name: "mariadb-" + db.Name,
@@ -21,6 +22,9 @@ func Pod(db *databasev1beta1.MariaDB, configHash string) *corev1.Pod {
2122
{
2223
Name: "mariadb",
2324
Image: db.Spec.ContainerImage,
25+
SecurityContext: &corev1.SecurityContext{
26+
RunAsUser: &runAsUser,
27+
},
2428
Env: []corev1.EnvVar{
2529
{
2630
Name: "KOLLA_CONFIG_STRATEGY",

0 commit comments

Comments
 (0)