local kube = import "k8s/configs/base.libsonnet"; local linuxserver = import "k8s/configs/templates/core/linuxserver.libsonnet"; local images = import "k8s/configs/images.libsonnet"; local Params = kube.simpleFieldStruct([ "namespace", "name", "filePath", "claimNames", "sshNodePort", "publicKey", "username", ]) { local inPodPort = 2222, labels: {}, lsParams: linuxserver.AppParams { name: $.name, namespace: $.namespace, filePath: $.filePath, templatePath: std.thisFile, baseAppName: "openssh-server", imageName: "linuxserver/openssh-server", labels+: $.labels, nodeSelector: { #"nvidia.com/gpu.present": "true", }, services: [ linuxserver.Service { suffix: "ssh-node", spec: kube.SvcUtil.BasicNodePortSpec(inPodPort, $.sshNodePort), }, ], ports: [ kube.DeployUtil.ContainerPort("ssh", inPodPort), ], pvcs: [ linuxserver.Pvc{ name: "config-claim", mountPath: "/config", bindName: $.configClaim, }, ] + [ linuxserver.Pvc{ name: claimName, mountPath: "/kubemnt/" + claimName, bindName: claimName, } for claimName in $.claimNames ], env: linuxserver.Env { others: [ kube.NameVal("PUBLIC_KEY", $.publicKey), kube.NameVal("USER_NAME", $.username), ], }, resources: { requests: { cpu: "50m", memory: "100Mi", }, limits: { cpu: "100m", memory: "400Mi", }, }, }, }; local App(params) = linuxserver.App(params.lsParams); { Params: Params, App(params): App(params), }