-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment name set in spec.json is ignored #393
Conversation
Hey, good spot! This is actually by design. The environment name is exclusively generated from the directories name. It is defined as the relative path from the projectRoot to the directory that contains The rationale behind this is to avoid confusion and drift between those, but also iirc this value is used in Nevertheless, I agree this is totally unclear from |
Gotcha. Tanka has a philosophy I can very much relate to so I totally respect you standing the ground on this. The issue I originally run into is twofold:
I'm not sure I explained the error/warning appropriately. I've updated the patch to better illustrate my point. If this is still unnecessary complexity, at least https://github.com/grafana/tanka/blob/master/docs/docs/config.md certainly requires an update |
Could you explain how exactly this relates to the environment config? After all,
When does this happen? afaict the name is something internal and never leaves Tankas area of responsibility |
tldr Oh I see! The context I'm coming from is this:
apiVersion: my.org/v1
kind: GenericRelease
metadata:
name: name-for-my-service
labels:
service: foo
spec:
target:
cluster: target-cluster
namespace: target-ns
# … and basically helm values here So very similar to how Tanka works, with the main difference being the addition of the templating values in the file. From what I understood so far Tankas |
To elaborate with a concrete example: |
Ahh, now I see. We use environments a bit differently I guess: The crucial part here is that environments don't actually include any resource definitions. There is no In environments, we only import and configure (ports, secrets, etc) those libraries. So your "Helm Chart" equivalent is a library, and a library usually knows what it creates (ie Would that be an option for you? |
I think we are on the same page with libraries. In fact that is why I got stuck for the most part. In the end I replaced That being said the original issue I believe is still valid. It is very confusing for users to have their
Not sure I got you there, but the latest change I propose allows users to explicitly set the value as long as it is identical to the generated value (that's what I understood from the “visible in the config” part). |
To my understanding, the current naming scheme at Grafana I agree here with @Mikulas that this issue is valid and the behavior is confusing. I like the check implemented here but maybe we can drop a warning instead of returning an error? I also think it would be interesting to have a Example warning:
|
Needing software to repair itself sounds like poor design to me :) I guess we can do better! I agree with @Mikulas and @Duologic that we have confusing behavior here and erroring out would solve that at the cost of UX when moving environments around. What might solve that though would be a |
It doesn't repair itself, it just a shortcut for typing Also intended for the use case where the move has already happened. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Currently
tk.env.metadata.name
is always set to the default generated value, regardless of whethermetadata.name
is set inspec.json
or not.This patch
spec.json
.I found a somewhat relevant mention in #163 and a link to #131, but that may be slightly different issue. As an alternative solution tk could instead throw an error when the name is set in
spec.json
if you believe the generated value is best. This would also be better for backwards compatibility if there are already users unknowingly using the default value while having a different name specified inspec.json
./kind bug