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

Drop Helm v2 support #613

Merged
merged 3 commits into from
Jan 17, 2023
Merged

Drop Helm v2 support #613

merged 3 commits into from
Jan 17, 2023

Conversation

xiaomudk
Copy link
Contributor

@xiaomudk xiaomudk commented Jan 1, 2023

#589
Signed-off-by: xiaomudk [email protected]

@yxxhero
Copy link
Member

yxxhero commented Jan 6, 2023

@mumoshu do you think is ok that drop helm v2 support in the next version?

@mumoshu
Copy link
Contributor

mumoshu commented Jan 7, 2023

@yxxhero I believe so. I presume Helm v2 has been deprecated since Sep 2020 and not maintained since Dec 2020. It's 2023, and no one should be using Helm v2!
The removal of Helm v2 support should be noted in the next Helmfile release note though.

@yxxhero
Copy link
Member

yxxhero commented Jan 7, 2023

@xiaomudk yeah. looking forward to updating. 💯

@xiaomudk xiaomudk force-pushed the patch-2 branch 7 times, most recently from 18eb77b to 5c9d412 Compare January 9, 2023 16:15
@xiaomudk
Copy link
Contributor Author

xiaomudk commented Jan 9, 2023

please review @yxxhero @mumoshu

{Name: "test2", Flags: []string(nil)},
{Name: "test3", Flags: []string(nil)},
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
Copy link
Member

Choose a reason for hiding this comment

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

why change the code?

@@ -510,14 +508,11 @@ releases:
{label: "name!=", expectedCount: 0, expectErr: true, errMsg: "in ./helmfile.yaml: in .helmfiles[0]: in /path/to/helmfile.d/a1.yaml: malformed label: name!=. Expected label in form k=v or k!=v"},
{label: "name", expectedCount: 0, expectErr: true, errMsg: "in ./helmfile.yaml: in .helmfiles[0]: in /path/to/helmfile.d/a1.yaml: malformed label: name. Expected label in form k=v or k!=v"},
// See https://github.com/roboll/helmfile/issues/193
{label: "duplicatedNs=yes", expectedCount: 0, expectErr: true, errMsg: "in ./helmfile.yaml: in .helmfiles[2]: in /path/to/helmfile.d/b.yaml: duplicate release \"foo\" found in namespace \"zoo\" in kubecontext \"default\": there were 2 releases named \"foo\" matching specified selector"},
{label: "duplicatedCtx=yes", expectedCount: 0, expectErr: true, errMsg: "in ./helmfile.yaml: in .helmfiles[2]: in /path/to/helmfile.d/b.yaml: duplicate release \"foo\" found in namespace \"zoo\" in kubecontext \"default\": there were 2 releases named \"foo\" matching specified selector"},
{label: "duplicatedNs=yes", expectedCount: 0, expectErr: true, errMsg: "in ./helmfile.yaml: in .helmfiles[2]: in /path/to/helmfile.d/b.yaml: duplicate release \"foo\" found in kubecontext \"default\": there were 2 releases named \"foo\" matching specified selector"},
Copy link
Member

Choose a reason for hiding this comment

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

zoo --> foo? why?

helmV3ListFlags = "--kube-contextdefault--uninstalling--deployed--failed--pending"
helmV3ListFlagsWithoutKubeContext = "--uninstalling--deployed--failed--pending"
)

func listFlags(namespace, kubeContext string) string {
Copy link
Member

Choose a reason for hiding this comment

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

add some tests for this function will be better.

@yxxhero
Copy link
Member

yxxhero commented Jan 10, 2023

@xiaomudk Thanks for your great work.

@@ -26,6 +26,10 @@ func NewRun(st *state.HelmState, helm helmexec.Interface, ctx Context) *Run {
panic("Assertion failed: helmexec.Interface must not be nil")
}

if !helm.IsHelm3() {
panic("helmfile has deprecated helm2 since v1.0")
Copy link
Member

Choose a reason for hiding this comment

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

since v0.150.0. not panic. we can use os.Exit? WDYT? @mumoshu @xiaomudk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, panic message is not very friendly

@@ -289,7 +288,7 @@ exec: helm --kube-context dev upgrade --install release chart --timeout 10 --wai
buffer.Reset()
err = helm.SyncRelease(HelmContext{}, "release", "chart")
expected = `Upgrading release=release, chart=chart
exec: helm --kube-context dev upgrade --install release chart
exec: helm --kube-context dev upgrade --install release chart --history-max 0
Copy link
Member

Choose a reason for hiding this comment

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

--history-max? why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

got. but why 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably because 0 is the empty value hence the default value for the HistoryMax field of ReleaseSpec? It's propagated via the --history-max flag here:

flags = append(flags, "--history-max", strconv.Itoa(context.HistoryMax))

No behavior change introduced in this pull request. I presume it's just that we turned this helm v2 based test to helm v3 based one and the additional --history-max flag is the consequence of that.

Copy link
Contributor

@mumoshu mumoshu left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you so much for your awesome work @xiaomudk!

@mumoshu mumoshu merged commit c4eb623 into helmfile:main Jan 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants