Tim Windelschmidt | d9f1f1e | 2023-10-31 15:44:35 +0100 | [diff] [blame^] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "strconv" |
| 6 | |
| 7 | "source.monogon.dev/metropolis/pkg/supervisor" |
| 8 | "source.monogon.dev/metropolis/pkg/sysctl" |
| 9 | ) |
| 10 | |
| 11 | func nodeSysctls(ctx context.Context) error { |
| 12 | const vmMaxMapCount = 2<<30 - 1 |
| 13 | options := sysctl.Options{ |
| 14 | // We increase the max mmap count to nearly the maximum, as it gets |
| 15 | // accounted by the cgroup memory limit. |
| 16 | "vm.max_map_count": strconv.Itoa(vmMaxMapCount), |
| 17 | } |
| 18 | |
| 19 | if err := options.Apply(); err != nil { |
| 20 | return err |
| 21 | } |
| 22 | |
| 23 | supervisor.Signal(ctx, supervisor.SignalHealthy) |
| 24 | supervisor.Signal(ctx, supervisor.SignalDone) |
| 25 | return nil |
| 26 | } |