vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.
Apache License 2.0
728 stars 62 forks source link

Detect imported extvars and TLAs via sentinel import path #271

Open seh opened 5 years ago

seh commented 5 years ago

When a Jsonnet consults an Importer for a path nominated by an external variable or top-level argument file-based command-line flag, the "importedFrom" parameter passed to the Importer.Import method is not a valid URL, but is instead a sentinel placeholder value—namely, an empty string. Detect these sentinel values and use the current working directory as the base URL instead when resolving relative import paths.

NB: This patch is speculative for now, based on a change to the Jsonnet Importer.Import method's contract proposed by @sbarzowski (https://github.com/bitnami/kubecfg/pull/266#issuecomment-535090890). See google/go-jsonnet#329 for a request for establishing this contract.


This change is Reviewable

seh commented 4 years ago

See google/go-jsonnet#447. With that, we can proceed here. @mkmik, take note.