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.`,
`local ns = k.core.v1.namespace;`,
``,
`ns.new() +`,
`ns.mixin.metadata.name(${name}) +`,
`ns.mixin.metadata.labels({name: ${name}})`,
`ns.mixin.metadata.name(import 'param://name') +`,
`ns.mixin.metadata.labels({name: import 'param://name'})`,
},
},
},
......@@ -101,10 +101,10 @@ will typically look something like:
`local port = k.core.v1.service.mixin.spec.portsType;`,
``,
`service.new(`,
` ${name},`,
` ${targetLabelSelector},`,
` port.new(${servicePort}, ${targetPort})) +`,
`service.mixin.spec.type(${type})`,
` import 'param://name',`,
` import 'param://targetLabelSelector',`,
` port.new(import 'param://servicePort', import 'param://targetPort')) +`,
`service.mixin.spec.type(import 'param://type')`,
},
},
},
......@@ -220,19 +220,19 @@ to 'targetLabelSelector', at 'targetPort'.`,
`local service = k.core.v1.service;`,
`local servicePort = k.core.v1.service.mixin.spec.portsType;`,
``,
`local targetPort = ${containerPort};`,
`local labels = {app: ${name}};`,
`local targetPort = import 'param://containerPort';`,
`local labels = {app: import 'param://name'};`,
``,
`local appService = service.new(`,
` ${name},`,
` import 'param://name',`,
` labels,`,
` servicePort.new(${servicePort}, targetPort)) +`,
`service.mixin.spec.type(${type});`,
` servicePort.new(import 'param://servicePort', targetPort)) +`,
`service.mixin.spec.type(import 'param://type');`,
``,
`local appDeployment = deployment.new(`,
` ${name},`,
` ${replicas},`,
` container.new(${name}, ${image}) +`,
` import 'param://name',`,
` import 'param://replicas',`,
` container.new(import 'param://name', import 'param://image') +`,
` container.ports(containerPort.new(targetPort)),`,
` labels);`,
``,
......@@ -272,8 +272,8 @@ to 'targetLabelSelector', at 'targetPort'.`,
`local configMap = k.core.v1.configMap;`,
``,
`configMap.new() +`,
`configMap.mixin.metadata.name("${name}") +`,
`configMap.data("${data}")`,
`configMap.mixin.metadata.name(import 'param://name') +`,
`configMap.data(import 'param://data')`,
},
},
},
......@@ -348,11 +348,11 @@ populated from 'name'.`,
`local port = container.portsType;`,
``,
`deployment.new(`,
` ${name},`,
` ${replicas},`,
` container.new(${name}, ${image}) +`,
` container.ports(port.new(${port:80})),`,
` {app: ${name}})`,
` import 'param://name',`,
` import 'param://replicas',`,
` container.new(import 'param://name', import 'param://image') +`,
` container.ports(port.new(import 'param://port')),`,
` {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