Skip to content
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

Release.Namespace and Release.Time in charts repo but missing from Helm v3 #5732

Closed
mattfarina opened this issue May 15, 2019 · 8 comments
Closed
Labels
v3.x Issues and Pull Requests related to the major version v3
Milestone

Comments

@mattfarina
Copy link
Collaborator

The dev-v3 branch, as of c62a3a4, no longer has .Release.Namespace and .Release.Time available in templates. It appears this was changed in aa859e3 in order to "make template rendering discrete and repeatable".

There are some problems with this.

  1. Charts in the charts repo use both of these features. See .Release.Time here and .Release.Namespace here. These charts won't work with Helm v3
  2. .Release.Namespace is needed for RBAC. Removing it hinders the ability of a chart to create RBAC config. See the comment on the commit and how it's used in the charts repo. Removal of namespace limits what charts can be used for

This was referenced in #4255 (comment) where @adamreese said it would be added back.

cc @bacongobbler @adamreese

@mattfarina mattfarina added the v3.x Issues and Pull Requests related to the major version v3 label May 15, 2019
adamreese added a commit to adamreese/helm that referenced this issue May 15, 2019
ref: helm#5732

Signed-off-by: Adam Reese <adam@reese.io>
@technosophos
Copy link
Member

So .Release.Time is effectively the same as calling now as a template function. And when I looked at the use cases, most might be better served by calling a random function instead. I am in favor of not putting that one back in if we can get away with it.

.Release.Namespace got merged back in on #5737 (as a result of this issue). So basically, if we can decide on .Release.Time, that's all that is left for this issue.

@mattfarina
Copy link
Collaborator Author

There aren't many public uses of .Release.Time from what I can tell. I would suggest:

  1. We update the cases in the charts repo to use the template function instead
  2. We document the use of the template function instead as part of the 2->3 docs

Once we do those two things we can close this out unless I missed something.

@mattfarina
Copy link
Collaborator Author

@technosophos So... everyone is using .Release.Time.Seconds which is seconds in UTC since the unix epoch. There is no golang format pattern to get this. So, we need a different way to handle this.

If we add a function to sprig there will be many using a version of Helm that doesn't support this. Sadly, lots of people use old helm versions. Not sure if they are using this part of release.

I created Masterminds/sprig#164 to give sprig the ability to do this.

@bacongobbler
Copy link
Member

Are there action items we should be addressing for Helm 3, or is this safe to close with the sprig bump?

@bacongobbler bacongobbler added this to the 3.0.0 milestone Aug 13, 2019
@bacongobbler
Copy link
Member

perhaps this should be closed in favour of #5733 if that's the last action item to close this one out.

@bacongobbler bacongobbler modified the milestones: 3.0.0, 3.0.0-beta.5 Oct 11, 2019
@bacongobbler
Copy link
Member

closing in favour of #5733.

@KIVagant
Copy link

So .Release.Time is effectively the same as calling now as a template function.

@technosophos, but isn't there a risk that now can return 1 second difference if it is called in several templates when Helm is processing them very close to a second end? This tiny difference could result in a deployment that could not be able to find it's pod because a label is +/-1 second different?

Was not the .Release.Time calling time.Now() only once and then every subsequent call would return 100% the same number?

@KIVagant
Copy link

Also, is there a way of getting a consistent random value that would work equally through all templates (without writing a new helper and defining variables in global scope)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

No branches or pull requests

4 participants