Skip to content
Snippets Groups Projects
Commit 480edded authored by Jessica Yuen's avatar Jessica Yuen
Browse files

Rewrite system prototype params to use import 'param://...' format

Rewrite system prototype params from `${foo}` format to `import
'param://foo'` so that they can be parsed correctly by the jsonnet
snippet.
parent 815ffc7c
No related branches found
No related tags found
No related merge requests found
...@@ -36,8 +36,8 @@ namespace.`, ...@@ -36,8 +36,8 @@ namespace.`,
`local ns = k.core.v1.namespace;`, `local ns = k.core.v1.namespace;`,
``, ``,
`ns.new() +`, `ns.new() +`,
`ns.mixin.metadata.name(${name}) +`, `ns.mixin.metadata.name(import 'param://name') +`,
`ns.mixin.metadata.labels({name: ${name}})`, `ns.mixin.metadata.labels({name: import 'param://name'})`,
}, },
}, },
}, },
...@@ -101,10 +101,10 @@ will typically look something like: ...@@ -101,10 +101,10 @@ will typically look something like:
`local port = k.core.v1.service.mixin.spec.portsType;`, `local port = k.core.v1.service.mixin.spec.portsType;`,
``, ``,
`service.new(`, `service.new(`,
` ${name},`, ` import 'param://name',`,
` ${targetLabelSelector},`, ` import 'param://targetLabelSelector',`,
` port.new(${servicePort}, ${targetPort})) +`, ` port.new(import 'param://servicePort', import 'param://targetPort')) +`,
`service.mixin.spec.type(${type})`, `service.mixin.spec.type(import 'param://type')`,
}, },
}, },
}, },
...@@ -220,19 +220,19 @@ to 'targetLabelSelector', at 'targetPort'.`, ...@@ -220,19 +220,19 @@ to 'targetLabelSelector', at 'targetPort'.`,
`local service = k.core.v1.service;`, `local service = k.core.v1.service;`,
`local servicePort = k.core.v1.service.mixin.spec.portsType;`, `local servicePort = k.core.v1.service.mixin.spec.portsType;`,
``, ``,
`local targetPort = ${containerPort};`, `local targetPort = import 'param://containerPort';`,
`local labels = {app: ${name}};`, `local labels = {app: import 'param://name'};`,
``, ``,
`local appService = service.new(`, `local appService = service.new(`,
` ${name},`, ` import 'param://name',`,
` labels,`, ` labels,`,
` servicePort.new(${servicePort}, targetPort)) +`, ` servicePort.new(import 'param://servicePort', targetPort)) +`,
`service.mixin.spec.type(${type});`, `service.mixin.spec.type(import 'param://type');`,
``, ``,
`local appDeployment = deployment.new(`, `local appDeployment = deployment.new(`,
` ${name},`, ` import 'param://name',`,
` ${replicas},`, ` import 'param://replicas',`,
` container.new(${name}, ${image}) +`, ` container.new(import 'param://name', import 'param://image') +`,
` container.ports(containerPort.new(targetPort)),`, ` container.ports(containerPort.new(targetPort)),`,
` labels);`, ` labels);`,
``, ``,
...@@ -272,8 +272,8 @@ to 'targetLabelSelector', at 'targetPort'.`, ...@@ -272,8 +272,8 @@ to 'targetLabelSelector', at 'targetPort'.`,
`local configMap = k.core.v1.configMap;`, `local configMap = k.core.v1.configMap;`,
``, ``,
`configMap.new() +`, `configMap.new() +`,
`configMap.mixin.metadata.name("${name}") +`, `configMap.mixin.metadata.name(import 'param://name') +`,
`configMap.data("${data}")`, `configMap.data(import 'param://data')`,
}, },
}, },
}, },
...@@ -348,11 +348,11 @@ populated from 'name'.`, ...@@ -348,11 +348,11 @@ populated from 'name'.`,
`local port = container.portsType;`, `local port = container.portsType;`,
``, ``,
`deployment.new(`, `deployment.new(`,
` ${name},`, ` import 'param://name',`,
` ${replicas},`, ` import 'param://replicas',`,
` container.new(${name}, ${image}) +`, ` container.new(import 'param://name', import 'param://image') +`,
` container.ports(port.new(${port:80})),`, ` container.ports(port.new(import 'param://port')),`,
` {app: ${name}})`, ` {app: import 'param://name'})`,
}, },
}, },
}, },
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment