mirror of https://github.com/kubeflow/examples.git
Add a component to run TensorBoard. (#110)
* Add a component to run TensorBoard. * Autoformate jsonnet file. * * Set a default of "" for logDir; there's not a really good default location because it will depend on where the data is stored.
This commit is contained in:
parent
e12231bae3
commit
afdd4c544e
|
|
@ -47,6 +47,13 @@
|
||||||
tensor2tensor: {
|
tensor2tensor: {
|
||||||
namespace: "null",
|
namespace: "null",
|
||||||
},
|
},
|
||||||
|
tensorboard: {
|
||||||
|
image: "tensorflow/tensorflow:1.7.0",
|
||||||
|
// logDir needs to be overwritten based on where the data is
|
||||||
|
// actually stored.
|
||||||
|
logDir: "",
|
||||||
|
name: "gh",
|
||||||
|
},
|
||||||
tfjob: {
|
tfjob: {
|
||||||
namespace: "null",
|
namespace: "null",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
local env = std.extVar("__ksonnet/environments");
|
||||||
|
local params = std.extVar("__ksonnet/params").components.tensorboard;
|
||||||
|
local k = import "k.libsonnet";
|
||||||
|
|
||||||
|
local name = params.name;
|
||||||
|
local namespace = env.namespace;
|
||||||
|
local service = {
|
||||||
|
apiVersion: "v1",
|
||||||
|
kind: "Service",
|
||||||
|
metadata: {
|
||||||
|
name: name + "-tb",
|
||||||
|
namespace: env.namespace,
|
||||||
|
annotations: {
|
||||||
|
"getambassador.io/config":
|
||||||
|
std.join("\n", [
|
||||||
|
"---",
|
||||||
|
"apiVersion: ambassador/v0",
|
||||||
|
"kind: Mapping",
|
||||||
|
"name: " + name + "_mapping",
|
||||||
|
"prefix: /tensorboard/" + name + "/",
|
||||||
|
"rewrite: /",
|
||||||
|
"service: " + name + "-tb." + namespace,
|
||||||
|
]),
|
||||||
|
}, //annotations
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
ports: [
|
||||||
|
{
|
||||||
|
name: "http",
|
||||||
|
port: 80,
|
||||||
|
targetPort: 80,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
selector: {
|
||||||
|
app: "tensorboard",
|
||||||
|
"tb-job": name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local deployment = {
|
||||||
|
apiVersion: "apps/v1beta1",
|
||||||
|
kind: "Deployment",
|
||||||
|
metadata: {
|
||||||
|
name: name + "-tb",
|
||||||
|
namespace: env.namespace,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
replicas: 1,
|
||||||
|
template: {
|
||||||
|
metadata: {
|
||||||
|
labels: {
|
||||||
|
app: "tensorboard",
|
||||||
|
"tb-job": name,
|
||||||
|
},
|
||||||
|
name: name,
|
||||||
|
namespace: namespace,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
containers: [
|
||||||
|
{
|
||||||
|
command: [
|
||||||
|
"/usr/local/bin/tensorboard",
|
||||||
|
"--logdir=" + params.logDir,
|
||||||
|
"--port=80",
|
||||||
|
],
|
||||||
|
image: params.image,
|
||||||
|
name: "tensorboard",
|
||||||
|
ports: [
|
||||||
|
{
|
||||||
|
containerPort: 80,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// "livenessProbe": {
|
||||||
|
// "httpGet": {
|
||||||
|
// "path": "/",
|
||||||
|
// "port": 80
|
||||||
|
// },
|
||||||
|
// "initialDelaySeconds": 15,
|
||||||
|
// "periodSeconds": 3
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
std.prune(k.core.v1.list.new([service, deployment]))
|
||||||
Loading…
Reference in New Issue