If a component has the same name as a Jsonnet library which is included (by any other component), the paths in vendor/ collide and therefore either the component is not included correctly, or the Jsonnet library can't be used with a relative import. Since kube-prometheus uses relative imports everywhere, it will break if we have a component named grafana.
Jsonnet-bundler just print a warning and skips the colliding symlink:
WARN: cannot link 'github.com/brancz/kubernetes-grafana/grafana' to '/app/data/vendor/grafana', because package '../dependencies/grafana' already uses that name. The absolute import still works
Steps to Reproduce the Problem
- Create a component called
component-grafana
- Compile a cluster which installs a component with a dependency on kube-prometheus (i.e. synsights-metrics)
Actual Behavior
Compilation fails:
Jsonnet error: failed to compile /app/data/vendor/spks-monitoring/component/main.jsonnet:
RUNTIME ERROR: couldn't open import "grafana/grafana.libsonnet": [Errno 2] No such file or directory: '/app/data/vendor/kube-prometheus/grafana/grafana.libsonnet'
/app/data/vendor/kube-prometheus/kube-prometheus.libsonnet:5:2-36 thunk <import>
/app/data/vendor/spks-monitoring/component/rules.libsonnet:62:4-54 thunk <kp>
/app/data/vendor/spks-monitoring/component/rules.libsonnet:88:31-33 object <anonymous>
During manifestation
Expected Behavior
The compilation is successful.
Ideas
- Forbid using component names which collide with library names.
Leads to bad UX and might break in the future if new libraries are included.
- Prefix all components in
vendor/ with component-.
Would require to change the compile input_paths of all components. We could introduce a helper variable like parameters._component (analog to `_instance) to make it easier.
Benefit: the names would match the actual git repo names.
- Always use absolute imports in Jsonnet.
Might not be possible to control in upstream projects (i.e. kube-prometheus).
If a component has the same name as a Jsonnet library which is included (by any other component), the paths in
vendor/collide and therefore either the component is not included correctly, or the Jsonnet library can't be used with a relative import. Since kube-prometheus uses relative imports everywhere, it will break if we have a component namedgrafana.Jsonnet-bundler just print a warning and skips the colliding symlink:
Steps to Reproduce the Problem
component-grafanaActual Behavior
Compilation fails:
Expected Behavior
The compilation is successful.
Ideas
Leads to bad UX and might break in the future if new libraries are included.
vendor/withcomponent-.Would require to change the compile input_paths of all components. We could introduce a helper variable like
parameters._component(analog to `_instance) to make it easier.Benefit: the names would match the actual git repo names.
Might not be possible to control in upstream projects (i.e. kube-prometheus).