Skip to content

Environment variable for setting the max history for an environment - #8369

Merged
hickeyma merged 1 commit into
helm:masterfrom
wawa0210:fix-8367
Jul 9, 2020
Merged

hickeyma merged 1 commit into
helm:masterfrom
wawa0210:fix-8367

Conversation

@wawa0210

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Environment variable for max release history

Special notes for your reviewer:

fix #8367

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@helm-bot helm-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 29, 2020
@wawa0210
wawa0210 force-pushed the fix-8367 branch 2 times, most recently from 16e9248 to f50deda Compare June 29, 2020 15:56
@wawa0210

Copy link
Copy Markdown
Contributor Author

@hickeyma @marckhouzam

I'm a little confused, if other modules (such as rollback) want to use this method, historyMaxFromEnv(), where is the best place to put it. Do you have any better ideas

@bacongobbler

Copy link
Copy Markdown
Member

pkg/cli is used to read and set other environment variables. That might be a better place to put this code logic.

func (s *EnvSettings) EnvVars() map[string]string {

@wawa0210
wawa0210 force-pushed the fix-8367 branch 5 times, most recently from bbb4b83 to c9c16b1 Compare June 30, 2020 02:47
@wawa0210

Copy link
Copy Markdown
Contributor Author

pkg/cli is used to read and set other environment variables. That might be a better place to put this code logic.

func (s *EnvSettings) EnvVars() map[string]string {

Thanks for reply, done.

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pushing the PR @wawa0210. Some small things to address.

Comment thread pkg/cli/environment.go Resolved
Comment thread pkg/cli/environment.go Resolved
Comment thread pkg/cli/environment.go Resolved
@wawa0210
wawa0210 force-pushed the fix-8367 branch 2 times, most recently from 4e312f7 to 3140597 Compare June 30, 2020 07:25
@wawa0210
wawa0210 requested a review from hickeyma June 30, 2020 07:27
Comment thread pkg/cli/environment.go Resolved
Comment thread pkg/cli/environment.go Resolved
Comment thread pkg/cli/environment.go Resolved
@wawa0210
wawa0210 force-pushed the fix-8367 branch 2 times, most recently from 79ca795 to 7659b82 Compare June 30, 2020 09:43

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion here. My comment in #8369 (comment) is an observation. I would prefer to change it to MaxHistory but I think because of the flag which cannot be changed until Helm 4, we should follow the naming for consistency.

@wawa0210 Do you mind changing it back?

@wawa0210

Copy link
Copy Markdown
Contributor Author

I would prefer to change it to MaxHistory but I think because of the flag which cannot be changed until Helm 4, we should follow the naming for consistency.

What we change is only the name of the environment variable, not the name of the command line flag~ Will this affect? If there is a negative impact, I can try to roll back

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good @wawa0210. Can you fix the CI build as style issue in pkg/cli/environment.go.

@hickeyma

Copy link
Copy Markdown
Contributor

I am ok with the naming now.

@wawa0210
wawa0210 force-pushed the fix-8367 branch 2 times, most recently from 0f3d323 to 7268a9e Compare June 30, 2020 14:11
@wawa0210

Copy link
Copy Markdown
Contributor Author

I am ok with the naming now.

It seems that all problems have been fixed, can you help approve?

@marckhouzam

Copy link
Copy Markdown
Member

@hickeyma do you think the new environment variable, since it is user-facing, should use the same name as the flag? So HELM_HISTORY_MAX? I'm not convinced it is essential but I wanted to ask.

@wawa0210
wawa0210 requested a review from hickeyma June 30, 2020 14:28
@wawa0210

wawa0210 commented Jul 3, 2020

Copy link
Copy Markdown
Contributor Author

@hickeyma @marckhouzam @liuming-dev

All questions have been answered, can you help approve?

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there @wawa0210, thanks. A few small nits and need to add the variable and description to https://github.com/helm/helm/blob/master/cmd/helm/root.go#L52

Comment thread pkg/cli/environment.go Outdated
"HELM_KUBECONTEXT": s.KubeContext,
"HELM_KUBETOKEN": s.KubeToken,
"HELM_KUBEAPISERVER": s.KubeAPIServer,
"HELM_MAX_HISTORY": strconv.Itoa(s.MaxHistory),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move just after HELM_NAMESPACE because comment applies to the kube vars

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feeling your feedback, done.

Comment thread pkg/cli/environment.go Outdated
RepositoryCache string
// PluginsDirectory is the path to the plugins directory.
PluginsDirectory string
// MaxHistory is the name of the env var for setting max history.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaxHistory is the name of the env var for setting max history. --> MaxHistory is the max release history maintained.

@hickeyma hickeyma added this to the 3.3.0 milestone Jul 7, 2020
@hickeyma

hickeyma commented Jul 7, 2020

Copy link
Copy Markdown
Contributor

do you think the new environment variable, since it is user-facing, should use the same name as the flag? So HELM_HISTORY_MAX? I'm not convinced it is essential but I wanted to ask.

Thought about it alright @marckhouzam and its something I deliberated over. I think it can remain as its a new variable and I would hope the flag would be changed in Helm 4 to be more descriptive.

@hickeyma

hickeyma commented Jul 7, 2020

Copy link
Copy Markdown
Contributor

I am still a little unconvinced that the env variable needs to be global in the code (i.e. in pkg/cli) as I think it will probably only be used by upgrade as it makes the most sense. I am however, open to the feedback from @bacongobbler and @marckhouzam in #8369 (comment) and #8367 (comment).

@hickeyma

hickeyma commented Jul 7, 2020

Copy link
Copy Markdown
Contributor

@wawa0210 If you can updated this asap, we can try and get it into the 3.3.0 release. It is dues the RC today I think.
/cc @bacongobbler

@marckhouzam

Copy link
Copy Markdown
Member

I am still a little unconvinced that the env variable needs to be global in the code (i.e. in pkg/cli) as I think it will probably only be used by upgrade as it makes the most sense.

@hickeyma I guess it depends on if we want to apply the Max history logic to helm rollback too? My impression is yes, but I can't evaluate if there are ramifications to doing that.

@bacongobbler

bacongobbler commented Jul 7, 2020 •

Copy link
Copy Markdown
Member

we're cutting rc.1 in a few hours, so we'll have to move this over to the 3.4.0 milestone.

@bacongobbler bacongobbler modified the milestones: 3.3.0, 3.4.0 Jul 7, 2020
@bacongobbler

Copy link
Copy Markdown
Member

I guess it depends on if we want to apply the Max history logic to helm rollback too?

Yes, this should also be made available for helm rollback as it was for Helm 2.

@wawa0210

wawa0210 commented Jul 7, 2020

Copy link
Copy Markdown
Contributor Author

@wawa0210 If you can updated this asap, we can try and get it into the 3.3.0 release. It is dues the RC today I think.

Sorry, I didn't have time to update yesterday, maybe the time is too late to 3.3.0 release

@wawa0210
wawa0210 requested a review from hickeyma July 7, 2020 23:23

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hickeyma

hickeyma commented Jul 8, 2020

Copy link
Copy Markdown
Contributor

Sorry, I didn't have time to update yesterday, maybe the time is too late to 3.3.0 release

That's ok. It can go into 3.4.

@helm-bot helm-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 8, 2020
@wawa0210
wawa0210 requested a review from hickeyma July 8, 2020 14:56
@wawa0210

wawa0210 commented Jul 8, 2020

Copy link
Copy Markdown
Contributor Author

It is nearly there @wawa0210. Do you mind adding a unit test in https://github.com/helm/helm/blob/master/pkg/cli/environment_test.go to test for the variable?

Added, troublesome review again

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @wawa0210

@hickeyma
hickeyma merged commit bd09f1f into helm:master Jul 9, 2020
@wawa0210
wawa0210 deleted the fix-8367 branch July 9, 2020 09:11
@pchico83

Copy link
Copy Markdown

is this feature included in 3.3.0? Will be included on the next release?

@marckhouzam

Copy link
Copy Markdown
Member

@pchico83 this feature is not in the 3.3 release but will be part of 3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment variable for max release history

7 participants