Unsure if this is intended or not, but from what I would expect with a with* field, it would take the current object and add a field. However, there are some that are missing the self +, so they create a new object with only the field that was called. For example:
A container livenessProbe mixin I would expect this:
container.mixin.livenessProbe.httpGet
.withPath('/healthz')
.withScheme('HTTP')
.withPort(10254)
to generate:
"livenessProbe": {
"httpGet": {
"path": "/healthz",
"scheme": "HTTP",
"port": 10254
}
}
But it instead just generates:
"livenessProbe": {
"httpGet": {
"port": 10254
}
}
Along the same lines, if withPort is called before either of the others, jsonnet complains with an error:
RUNTIME ERROR: field does not exist: withScheme
x.jsonnet:(38:3)-(41:14) thunk <container>
x.jsonnet:45:55-74 thunk <array_element>
k8s.libsonnet:607:118-128 object <spec>
k8s.libsonnet:540:59-72 object <anonymous>
k8s.libsonnet:458:61-82 object <spec>
k8s.libsonnet:403:39-52 object <anonymous>
x.jsonnet:49:3-23 thunk <array_element>
k.libsonnet:60:59-74 object <anonymous>
During manifestation
As a workaround, the following does generate the correct output:
container.mixin.livenessProbe.httpGet
.withPath('/healthz')
.withScheme('HTTP') +
container.mixin.livenessProbe.httpGet
.withPort(10254) +
This is the livenessProbe section with the fields:
// Path to access on the HTTP server.
withPath(path):: self + __httpGetMixin({path: path}),
// Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
withPort(port):: __httpGetMixin({port: port}),
// Scheme to use for connecting to the host. Defaults to HTTP.
withScheme(scheme):: self + __httpGetMixin({scheme: scheme}),
Which is from the precompiled ksonnet.beta.3 file.
Unsure if this is intended or not, but from what I would expect with a
with*field, it would take the current object and add a field. However, there are some that are missing theself +, so they create a new object with only the field that was called. For example:A container
livenessProbemixin I would expect this:to generate:
But it instead just generates:
Along the same lines, if
withPortis called before either of the others, jsonnet complains with an error:As a workaround, the following does generate the correct output:
This is the
livenessProbesection with the fields:Which is from the precompiled
ksonnet.beta.3file.