Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Some with* missing self + #137

Open
DustinChaloupka opened this issue May 11, 2018 · 0 comments
Open

Some with* missing self + #137

DustinChaloupka opened this issue May 11, 2018 · 0 comments

Comments

@DustinChaloupka
Copy link

DustinChaloupka commented May 11, 2018

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.

@DustinChaloupka DustinChaloupka changed the title with* missing self + Some with* missing self + May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant