bitnami / kube-libsonnet

Bitnami's jsonnet library for building Kubernetes manifests
https://bitnami.com
Apache License 2.0
172 stars 49 forks source link

ConfigMap: disable string validation #42

Closed GregoryVds closed 4 years ago

GregoryVds commented 4 years ago

Hello,

Thank your for this great library, this is extremely useful!

I having problems with slow builds on a project of mine. After some investigation, it appears that the "string" validation in ConfigMap() was causing this. I am jsonnet-newbie, and I thus have no idea how/if this can be optimized.

Do you have any idea what can be done to improve this? WDYT?

On my project, compilation time is:

(Note that I am sharing this PR just to illustrate the problematic code, I am not suggesting the right solution is to remove the check completely).

Signed-off-by: Gregory Vander Schueren gregory.vanderschueren@tessares.net

jjo commented 4 years ago

Thanks @GregoryVds for the feedback, and the PR. As you guessed, I'm not comfortable to completely remove that assertion (and I don't see means of speeding it up on e.g. large configmaps), that said I crafted an approach to let users decide on shutting off assertions by via:

local kube = (import "lib/kube.libsonnet") { _assert:: false };

Can you please give it a try, and feedback ? this branch -> https://github.com/bitnami-labs/kube-libsonnet/tree/jjo-assert-opt-out

Thanks! --jjo

GregoryVds commented 4 years ago

@jjo Thanks for the quick answer! I just tested your assert-opt-out. Nice solution, this is flexible and doing exactly what I need, thanks :-)