forked from kubeflow/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a GPU model deployment to use for E2E testing of serving with …
…GPUs. * This is the first step to creating an E2E for the GPU serving kubeflow#291. * This deployment is suitable for testing that we can deploy the GPU container and not have it crash because of linking errors. * This caught a bug in the Dockerfile. * Fix the Docker file for the GPU image; we need to remove the symbolic links from /usr/local/nvidia to /usr/local/cuda * On GKE the device plugin will make drivers available at /usr/local/nvidia and we don't want this to override /usr/local/cuda Related to kubeflow#291
- Loading branch information
Showing
11 changed files
with
75,639 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
components/k8s-model-server/images/releaser/components/gpu_model.jsonnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
local params = std.extVar("__ksonnet/params").components.gpu_model; | ||
// TODO(https://github.com/ksonnet/ksonnet/issues/222): We have to add namespace as an explicit parameter | ||
// because ksonnet doesn't support inheriting it from the environment yet. | ||
|
||
local k = import "k.libsonnet"; | ||
local tfServing = import "kubeflow/tf-serving/tf-serving.libsonnet"; | ||
|
||
local name = params.name; | ||
local namespace = params.namespace; | ||
local modelPath = params.model_path; | ||
local modelServerImage = params.model_server_image; | ||
local httpProxyImage = params.http_proxy_image; | ||
local serviceType = params.service_type; | ||
|
||
|
||
// TODO(jlewi): This is awful. We need to find a better way to structure our configs to | ||
// make it easy to override the resources. | ||
local containers = tfServing.parts.deployment.modelServer(name, namespace, modelPath, modelServerImage, httpProxyImage).spec.template.spec.containers; | ||
|
||
local tfServingContainer = containers[0] { | ||
resources+: { | ||
limits+: { | ||
"nvidia.com/gpu": 1, | ||
}, | ||
}, | ||
}; | ||
|
||
local httpProxyContainer = containers[1]; | ||
local server = tfServing.parts.deployment.modelServer(name, namespace, modelPath, modelServerImage, httpProxyImage) | ||
+ { | ||
spec+: { | ||
template+: { | ||
spec+: { | ||
containers: std.prune([tfServingContainer, httpProxyContainer]), | ||
// TODO(jlewi): For the CPU image we set the user and group to 1000 which are defined within the Docker container. | ||
// But we don't do the same for the GPU image. | ||
securityContext: null, | ||
}, | ||
}, | ||
}, | ||
}; | ||
std.prune(k.core.v1.list.new([ | ||
server, | ||
tfServing.parts.deployment.modelService(name, namespace, serviceType), | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
components/k8s-model-server/images/releaser/environments/testing/.metadata/k.libsonnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
local k8s = import "k8s.libsonnet"; | ||
|
||
local apps = k8s.apps; | ||
local core = k8s.core; | ||
local extensions = k8s.extensions; | ||
|
||
local hidden = { | ||
mapContainers(f):: { | ||
local podContainers = super.spec.template.spec.containers, | ||
spec+: { | ||
template+: { | ||
spec+: { | ||
// IMPORTANT: This overwrites the 'containers' field | ||
// for this deployment. | ||
containers: std.map(f, podContainers), | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
mapContainersWithName(names, f) :: | ||
local nameSet = | ||
if std.type(names) == "array" | ||
then std.set(names) | ||
else std.set([names]); | ||
local inNameSet(name) = std.length(std.setInter(nameSet, std.set([name]))) > 0; | ||
self.mapContainers( | ||
function(c) | ||
if std.objectHas(c, "name") && inNameSet(c.name) | ||
then f(c) | ||
else c | ||
), | ||
}; | ||
|
||
k8s + { | ||
apps:: apps + { | ||
v1beta1:: apps.v1beta1 + { | ||
local v1beta1 = apps.v1beta1, | ||
|
||
daemonSet:: v1beta1.daemonSet + { | ||
mapContainers(f):: hidden.mapContainers(f), | ||
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f), | ||
}, | ||
|
||
deployment:: v1beta1.deployment + { | ||
mapContainers(f):: hidden.mapContainers(f), | ||
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f), | ||
}, | ||
}, | ||
}, | ||
|
||
core:: core + { | ||
v1:: core.v1 + { | ||
list:: { | ||
new(items):: | ||
{apiVersion: "v1"} + | ||
{kind: "List"} + | ||
self.items(items), | ||
|
||
items(items):: if std.type(items) == "array" then {items+: items} else {items+: [items]}, | ||
}, | ||
}, | ||
}, | ||
|
||
extensions:: extensions + { | ||
v1beta1:: extensions.v1beta1 + { | ||
local v1beta1 = extensions.v1beta1, | ||
|
||
daemonSet:: v1beta1.daemonSet + { | ||
mapContainers(f):: hidden.mapContainers(f), | ||
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f), | ||
}, | ||
|
||
deployment:: v1beta1.deployment + { | ||
mapContainers(f):: hidden.mapContainers(f), | ||
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f), | ||
}, | ||
}, | ||
}, | ||
} |
Oops, something went wrong.