mirror of https://github.com/kubeflow/examples.git
Use kind Job instead of Pod
This commit is contained in:
parent
6527aba7c1
commit
c86f306d79
|
|
@ -1,54 +1,11 @@
|
||||||
local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
||||||
|
|
||||||
{
|
{
|
||||||
|
spec(params, env, apiVersion="extensions/v1beta1", kind="Deployment"):: {
|
||||||
indexCreator(params, env):: {
|
apiVersion: apiVersion,
|
||||||
apiVersion: "v1",
|
kind: kind,
|
||||||
kind: "Pod",
|
|
||||||
metadata: {
|
metadata: {
|
||||||
name: params.name + "-pod",
|
name: params.name,
|
||||||
namespace: env.namespace,
|
|
||||||
labels: {
|
|
||||||
app: params.name,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
restartPolicy: "OnFailure",
|
|
||||||
containers: [
|
|
||||||
{
|
|
||||||
name: params.name,
|
|
||||||
image: params.image,
|
|
||||||
args: params.args,
|
|
||||||
env: [
|
|
||||||
{
|
|
||||||
name: "GOOGLE_APPLICATION_CREDENTIALS",
|
|
||||||
value: "/secret/gcp-credentials/user-gcp-sa.json",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
volumeMounts: [
|
|
||||||
{
|
|
||||||
mountPath: "/secret/gcp-credentials",
|
|
||||||
name: "gcp-credentials",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: "gcp-credentials",
|
|
||||||
secret: {
|
|
||||||
secretName: "user-gcp-sa",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
searchServer(params, env):: {
|
|
||||||
apiVersion: "extensions/v1beta1",
|
|
||||||
kind: "Deployment",
|
|
||||||
metadata: {
|
|
||||||
name: params.name + "-deployment",
|
|
||||||
namespace: env.namespace,
|
namespace: env.namespace,
|
||||||
labels: {
|
labels: {
|
||||||
app: params.name,
|
app: params.name,
|
||||||
|
|
@ -56,7 +13,7 @@ local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
replicas: params.replicas,
|
replicas: params.replicas,
|
||||||
selector: {
|
[if kind == "Deployment" then "selector"]: {
|
||||||
matchLabels: {
|
matchLabels: {
|
||||||
app: params.name,
|
app: params.name,
|
||||||
},
|
},
|
||||||
|
|
@ -68,6 +25,7 @@ local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
|
[if kind == "Job" then "restartPolicy"]: "OnFailure",
|
||||||
containers: [
|
containers: [
|
||||||
{
|
{
|
||||||
name: params.name,
|
name: params.name,
|
||||||
|
|
@ -158,7 +116,7 @@ local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
||||||
},
|
},
|
||||||
|
|
||||||
all: [
|
all: [
|
||||||
$.indexCreator(creatorParams, env),
|
$.spec(creatorParams, env, apiVersion="batch/v1", kind="Job"),
|
||||||
],
|
],
|
||||||
}.all,
|
}.all,
|
||||||
|
|
||||||
|
|
@ -177,7 +135,7 @@ local baseParams = std.extVar("__ksonnet/params").components["nmslib"];
|
||||||
|
|
||||||
all: [
|
all: [
|
||||||
$.service(serverParams, env),
|
$.service(serverParams, env),
|
||||||
$.searchServer(serverParams, env),
|
$.spec(serverParams, env),
|
||||||
],
|
],
|
||||||
}.all,
|
}.all,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue