SwissDataScienceCenter / amalthea

A kubernetes operator for spawning and exposing interactive user session servers.
Apache License 2.0
14 stars 4 forks source link

Add support for adjusting /dev/shm #630

Closed sgaist closed 1 month ago

sgaist commented 1 month ago
          For adjusting `/dev/shm` this is how we patch it in the old sessions:
            {
                "type": "application/json-patch+json",
                "patch": [
                    {
                        "op": "add",
                        "path": "/statefulset/spec/template/spec/volumes/-",
                        "value": {
                            "name": "shm",
                            "emptyDir": {
                                "medium": "Memory",
                                # NOTE: We are giving /dev/shm up to half of the memory request
                                "sizeLimit": int(server.server_options.storage / 2),
                            },
                        },
                    },
                    {
                        "op": "add",
                        "path": "/statefulset/spec/template/spec/containers/1/volumeMounts/-",
                        "value": {
                            "mountPath": "/dev/shm",
                            "name": "shm",
                        },
                    },
                ],
            }

So it is a memory backed volume mounted at /dev/shm. And its size is half the memory request for the session. Here we can make it part of the CRD with a default value of 1Gi or something like that.

Originally posted by @olevski in https://github.com/SwissDataScienceCenter/amalthea/issues/597#issuecomment-2213228409