Skip to content

Auto-completion implemented in Go - #7323

Merged
marckhouzam merged 9 commits into
helm:masterfrom
VilledeMontreal:feat/dynamicCompletionInGo
Jan 17, 2020
Merged

marckhouzam merged 9 commits into
helm:masterfrom
VilledeMontreal:feat/dynamicCompletionInGo

Conversation

@marckhouzam

@marckhouzam marckhouzam commented Jan 2, 2020 •

Copy link
Copy Markdown
Member

Closes #7321

This one aims to help the Helm maintainers and developers.

This PR converts most of Helm's auto-completion custom bash code into Go implementations.
It is fully backwards-compatible with previous auto-completion support. It has been tested successfully with the acceptance-testing tests for completion.

To illustrate how much easier it is to provide completion code in Go, this PR also augments the existing completion support (in Go) (the last two commits of the PR):

  1. to consider the --generate-name flag for proper completion of helm install and helm template
  2. to provide completion for the --revision flag (helm status and helm get).

The PR introduces a new hidden helm sub-command: __complete that is to be called by the auto-completion script. Please see #7321 for details.
I chose the name with a double underscore prefix because ultimately, I would like to push this functionality into Cobra, which will need to make sure this command does not collide with any existing commands.

The support of the __complete command, and everything around it that enables to write auto-completions in Go, is contained within a new completion package. The idea is that if this feature is eventually pushed down to Cobra, the new completion package can be removed almost transparently.

From a Helm user's point-of-view, nothing changes (except the new completion support for the --generate-name and --revision flags). The real value of this PR is for Helm maintainers and developers who could now deal with shell auto-completion through Go code.

To try out the feature, set up completion exactly as before:

  • check out the PR branch
  • build helm
  • source the script output of helm completion bash or helm completion zsh
  • perform shell completion just like before:
    e.g.,
    • helm status <TAB>
    • helm --namespace <TAB>
    • helm status -o <TAB>
    • etc

Advantages of this approach:

  • Custom completions written in Go instead of bash
  • Access to full Helm code base to perform completions instead of having to rely on calling helm externally. For example, calling helm search repo is more limited than coding the logic directly in helm in Go.
  • Debugging and development much easier because helm developers can directly call e.g., helm __complete status ngin<ENTER> to test the corresponding completion code
  • The Go debugger can even be used
  • Go tests can be written for the custom completion code
  • Flag parsing done automatically by Cobra (instead of having to be coded in bash by helm)
  • Global flags handled automatically instead of being coded explicitly in bash (see changes required by feat(cli) Pass token via cli #7230)
  • No need to make sure the custom completion code works for both bash and zsh
  • No more issues with the use of shell tools (e.g., echo, cat, tail) that work differently on different OSes (e.g., bash completion: tail: cannot open ‘+2’ for reading: No such file or directory #7304)
  • Use of client-go library instead of kubectl

Questions for reviewers:

  1. No new APIs should be introduced as they are likely to be removed if this feature becomes part of Cobra. I believe that by putting the new completion package under cmd/helm, the package is not considered API. Should the new completion package be put under internal instead?

  2. Is the new sub-command name __complete acceptable?

@helm-bot helm-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 2, 2020
marckhouzam added a commit to VilledeMontreal/acceptance-testing that referenced this pull request Jan 2, 2020
This is to support
helm/helm#7323

Completion of the --namespace flag can not be stubbed easily anymore
so we'll probably need a real cluster to run these tests.
For now, I've commented them out.

Signed-off-by: Marc Khouzam <[email protected]>
@marckhouzam

Copy link
Copy Markdown
Member Author

I've posted an update to the acceptance-testing repo to pass with this PR.
The change is at helm/acceptance-testing#70

@mattfarina

Copy link
Copy Markdown
Collaborator

Thanks for putting this together. It'll take me a few days to get through something this large. From the get to I'll respond to your two questions with my two cents...

No new APIs should be introduced as they are likely to be removed if this feature becomes part of Cobra. I believe that by putting the new completion package under cmd/helm, the package is not considered API. Should the new completion package be put under internal instead?

I would suggest internal for two reasons:

  1. The API can change. If in trying to move the package to cobra something needs to be changed, such as a Go API name, that should be OK to change here if it is in internal as it's not part of the public API.
  2. Even if it's in the cmd/helm/completion package it becomes part of the public API we need to support through the v3 lifecycle. Even if it is merged into cobra and we can reference it there instead. We cannot get rid of it until v4. If it is in internal we can remove it to use the cobra one, if it lands there, because it's not part of the public API.

I think we have an easier support part if this is in internal for now.

Is the new sub-command name __complete acceptable?

This seems fine to me. Are there examples of cobra itself of anyone else using the __ to prefix an internal command?

@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from fc0df15 to c856e8b Compare January 2, 2020 15:58
@marckhouzam

Copy link
Copy Markdown
Member Author

@mattfarina Thanks for already getting involved on this. I've moved the new completion package under internal.

Is the new sub-command name __complete acceptable?

This seems fine to me. Are there examples of cobra itself of anyone else using the __ to prefix an internal command?

Not that I'm aware of. I'm not sure a similar situation has arisen before. Another approach would be to name the command in whatever way helm wants and then create an alias for that name if Cobra decides to use a different name. Personally, I think we can stick with __complete; after all, this command is meant for developers, not users.

@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from c856e8b to 2066d35 Compare January 2, 2020 16:16
Comment thread internal/completion/complete.go Resolved
@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from 2066d35 to 7cff468 Compare January 7, 2020 03:25
@bacongobbler bacongobbler added the v3.x Issues and Pull Requests related to the major version v3 label Jan 8, 2020
@marckhouzam

Copy link
Copy Markdown
Member Author

I've started looking at adding go tests for this. I now realize that calling os.Exit explicitly in my code will prevent tests from succeeding.

I will update the patch to use Errors instead.

@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from 7cff468 to 89541a7 Compare January 13, 2020 02:04
@marckhouzam

Copy link
Copy Markdown
Member Author

This revised series of commits better supports go tests for completion.

It also adds some go tests for completion of the status command as well as the --output and --revision flags. It helps illustrate one of the benefits of this PR, which is that it becomes possible to write go tests for completion.

Although more tests should eventually be added, considering the already xxl size of this patch, I don't think a review should wait for all the tests.

@marckhouzam

Copy link
Copy Markdown
Member Author

Test failure caused by #7391

@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from 07eea45 to ded59e8 Compare January 14, 2020 17:15
@marckhouzam

marckhouzam commented Jan 14, 2020 •

Copy link
Copy Markdown
Member Author

The last forced push is a rebase to allow the tests to pass after #7391 was merged

Conflicts:
	cmd/helm/completion/complete.go
	cmd/helm/root.go

Conflicts:
	cmd/helm/root.go

Signed-off-by: Marc Khouzam <[email protected]>
To use error codes to indicate completion directive to the completion
script had us use os.Exit() in the __complete command.  This prevented
go tests calling the __complete command from succeeding.

Another option was to return an error containing an error code
(like is done for helm plugins) instead of calling os.Exit().  However
such an approach requires a change in how helm handles the returned
error of a Cobra command; although we can do this for Helm, it would
be an annoying requirement for other programs if we ever push this
completion logic into Cobra.

The chosen solution instead is to printout the directive at the end
of the list of completions, and have the completion script extract it.
Note that we print both the completions and directive to stdout.
It would have been interesting to print the completions to stdout and
the directive to stderr; however, it is very complicated for the
completion script to extract both stdout and stderr to different
variables, and even if possible, such code would not be portable to
many shells.  Printing both to stdout is much simpler.

Signed-off-by: Marc Khouzam <[email protected]>
@marckhouzam
marckhouzam force-pushed the feat/dynamicCompletionInGo branch from ded59e8 to fc618b4 Compare January 16, 2020 00:11
@marckhouzam

Copy link
Copy Markdown
Member Author

The last forced push is a rebase and corresponding modification to make use of the new charts cache file introduced in #6809

@bacongobbler bacongobbler added this to the 3.1.0 milestone Jan 16, 2020

@bacongobbler bacongobbler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code in here looks great. So happy to have the auto-completion written in Go so we can take advantage of existing packages!

I had one comment regarding how the calling code could be improved to save a lookup call. Otherwise this all looks good to me.

Comment thread cmd/helm/flags.go Resolved
Comment thread cmd/helm/root.go Resolved
@marckhouzam

Copy link
Copy Markdown
Member Author

Thanks @bacongobbler for reviewing this! I realize it was really big.

@mattfarina are you good with the single approval? I don't mind waiting if you want to have a look as well.

@mattfarina
mattfarina self-requested a review January 17, 2020 16:15
@marckhouzam
marckhouzam merged commit a6b2c9e into helm:master Jan 17, 2020
@marckhouzam
marckhouzam deleted the feat/dynamicCompletionInGo branch January 17, 2020 18:12
@marckhouzam

Copy link
Copy Markdown
Member Author

Thanks a lot @mattfarina and @bacongobbler !

marckhouzam added a commit to helm/acceptance-testing that referenced this pull request Jan 28, 2020
This is to support
helm/helm#7323

Completion of the --namespace flag can not be stubbed easily anymore
so we'll probably need a real cluster to run these tests.
For now, I've commented them out.

Signed-off-by: Marc Khouzam <[email protected]>
adamreese added a commit to adamreese/helm that referenced this pull request Feb 25, 2020
Removes workaround introduced in helm#7323

Signed-off-by: Adam Reese <[email protected]>
kruglovmax added a commit to kruglovmax/helm that referenced this pull request May 8, 2020
* fix(install): use ca file for install (helm#7140)

Fixes a few bugs related to tls config when installing charts:

1. When installing via relative path, tls config for the selected
repository was not being set.

2. The `--ca-file` flag was not being passed when constructing the
downloader.

3. Setting tls config was not checking for zero value in repo
config, causing flag to get overwritten with empty string.

There's still a few oddities here. I would expect that the flag
passed in on the command line would override the repo config, but
that's not currently the case. Also, we always set the cert, key
and ca files as a trio, when they should be set individually
depending on combination of flags / repo config.

Signed-off-by: James McElwain <[email protected]>

* Repair failing unit tests - failure caused by os.Stat return values for directory size on Linux.

Signed-off-by: Pavel Macík <[email protected]>

* Add corresponding unit test to the function in parser.go

Signed-off-by: Guangwen Feng <[email protected]>

* Add hpa boilerplate

Signed-off-by: Naseem <[email protected]>

* Add unit test for Reverse() in pkg/releaseutil.go

Signed-off-by: Dao Cong Tien <[email protected]>

* Use /usr/bin/env for bash

After this change, make works on nixos.

Signed-off-by: Daniel Poelzleithner <[email protected]>

* fix(helm): sort hooks by kind for equal weight

Use the same install order for hooks as for normal resources (non-hooks) for hooks with equal weight.
This makes resource handling more consistent and helps, when there are hook consisting of several resources like e.g. a service account and a job using this service account.

The sort functions are changed from an in place search to an out of place sort to avoid inout parameters.

Closes helm#7416.

Signed-off-by: Daniel Strobusch <[email protected]>

* fixed dependencies processing in case of helm install or upgrade for disabled/enabled sub charts

Signed-off-by: Florian Hopfensperger <[email protected]>

* fix(helm): Don't wait for service to be ready when external IP are set

Resolves helm#7513
As the externalIPs are not managed by k8s (according to the doc: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#servicespec-v1-core) helm should not wait for services  which set al least one externalIPs.

Signed-off-by: Federico Bevione <[email protected]>

* ref(kind_sorter): use an in-place sort for sortManifestsByKind, reduce code duplication

Signed-off-by: Matthew Fisher <[email protected]>

* fix(helm): Reworded logs for clarity

Signed-off-by: Federico Bevione <[email protected]>

* fixed missing bullet

Signed-off-by: Matt Butcher <[email protected]>

* Fix 'helm template' to also print invalid yaml

Signed-off-by: Reinhard Naegele <[email protected]>

* fix(helm): improved logs

Signed-off-by: Federico Bevione <[email protected]>

* fix(kube): use non global Scheme to convert

But instead use a newly initialized Scheme with only Kubernetes native
resources added. This ensures the 3-way-merge patch strategy is not
accidentally chosen for custom resources due to them being added
to the global Scheme by e.g. versioned clients while using Helm as a
package, and not a self-contained binary.

Signed-off-by: Hidde Beydals <[email protected]>

* fix(kube): generate k8s native scheme only once

Signed-off-by: Hidde Beydals <[email protected]>

* Place rendering invalid YAML under --debug flag

Signed-off-by: Reinhard Naegele <[email protected]>

* Pass kube user token via cli, introduce HELM_KUBETOKEN envvar

Signed-off-by: Vibhav Bobade <[email protected]>

* Making fetch-dist get the sha256sum files

Fetching these files is part of the release process. When the new
file type was added this step was missed. It will cause the sign
make target to fail.

Signed-off-by: Matt Farina <[email protected]>

* ref(go.mod): k8s api 0.17.3

Signed-off-by: Rui Chen <[email protected]>

* IsReachable() needs to give detailed error message.

Signed-off-by: ylvmw <[email protected]>

* pkg/gates: add unit test for String

Signed-off-by: Zhou Hao <[email protected]>

* cmd/helm/search_repo: print info to stderr

Signed-off-by: Zhou Hao <[email protected]>

* fix golint failure in pkg/action

Signed-off-by: Song Shukun <[email protected]>

* pkg/helmpath: fix unit test for Windows

Signed-off-by: Song Shukun <[email protected]>

* Adds script to help craft release notes

Signed-off-by: Paul Czarkowski <[email protected]>

* add license headers to release-notes.sh script

Signed-off-by: Paul Czarkowski <[email protected]>

* Pass the apiserver address/port via cli, introduce HELM_KUBEAPISERVER envvar

Signed-off-by: Vibhav Bobade <[email protected]>

* Fix output of list action when it is failed

Signed-off-by: Song Shukun <[email protected]>

* feat(install): introduce --create-namespace

Signed-off-by: Matthew Fisher <[email protected]>

* feat(comp): Move kube-context completion to Go

Signed-off-by: Marc Khouzam <[email protected]>

* Adopt resources into release with correct instance and managed-by labels

Signed-off-by: Jacob LeGrone <[email protected]>

* Alternative: annotation-only solution

Signed-off-by: Jacob LeGrone <[email protected]>

* feat(comp): Static completion for plugins

Allow plugins to optionally specify their sub-cmds and flags through a
simple yaml file.

When generating the completion script with the command
'helm completion <bash|zsh>' (and only then), helm will look for that
yaml file in the plugin's directory.  If the file exists, helm will
create cobra commands and flags so that the completion script will
handle them.

Signed-off-by: Marc Khouzam <[email protected]>

* feat(comp): Dynamic completion for plugins

For each plugin, helm registers a ValidArgsFunction which the completion
script will call when it needs dynamic completion.  This
ValidArgsFunction will setup the plugin environment and then call the
executable `plugin.complete`, if it is provided by the plugin.

The output of the call to `plugin.complete` will be used as completion
choices.  The last line of the output can optionally be used by the
plugin to specify a completion directive.

Signed-off-by: Marc Khouzam <[email protected]>

* feat(tests): Allow to provision memory driver

The memory driver is used for go tests. It can also be used from the
command-line by setting the environment variable HELM_DRIVER=memory.
In the latter case however, there was no way to pre-provision some
releases.

This commit introduces the HELM_MEMORY_DRIVER_DATA variable which
can be used to provide a colon-separated list of yaml files specifying
releases to provision automatically.

For example:
   HELM_DRIVER=memory \
   HELM_MEMORY_DRIVER_DATA=./testdata/releases.yaml \
   helm list --all-namespaces

Signed-off-by: Marc Khouzam <[email protected]>

* fix(helm): add --skipCRDs flag to 'helm upgrade'
When 'helm upgrade --install' is run, this will allow to skip installing CRDs
Closes helm#7452

Signed-off-by: akash-gautam <[email protected]>

* pkg/storage/records: add unit test for Get

Signed-off-by: Zhou Hao <[email protected]>

* pkg/storage/records: add unit test for Index

Signed-off-by: Zhou Hao <[email protected]>

* pkg/storage/records: add unit test for Exists

Signed-off-by: Zhou Hao <[email protected]>

* Printing name of chart that do not have requested import value.

Signed-off-by: Tomas Kohout <[email protected]>

* fix(cmd/helm): upgrade go-shellwords

Removes workaround introduced in helm#7323

Signed-off-by: Adam Reese <[email protected]>

* Fix dep build to be compatiable with Helm 2 when requirements use repo alias

Signed-off-by: Song Shukun <[email protected]>

* Fix golangci-lint errors.

Signed-off-by: Pavel Macík <[email protected]>

* Return "unknown command" error for unknown subcommands

Signed-off-by: Xiangxuan Liu <[email protected]>

* Add test for unknown subcommand

Signed-off-by: Xiangxuan Liu <[email protected]>

* Update README.md

Typo fix: Space missed in Markdown header.

Signed-off-by: Evgeniy Yablokov <[email protected]>

* fix(helm): stdin values for helm upgrade --install

Signed-off-by: Matt Morrissette <[email protected]>

* Fixes verification output on pull command

When using the --verify flag on the pull command the output was
an internal Go object rather than useful detail. This is a bug.
The output new displays who signed the chart along with the
hash.

Fixes helm#7624

Signed-off-by: Matt Farina <[email protected]>

* Add verification output to the verify command

This complements the verification output fixed in helm#7706. On verify
there should be some detail about the verification rather than
no information.

Signed-off-by: Matt Farina <[email protected]>

* fix(ADOPTERS): alphabetize org list (helm#7645)

Signed-off-by: Matthew Fisher <[email protected]>

* add unit test for SecretDelete

Signed-off-by: Zhou Hao <[email protected]>

* add unit test for ConfigMapDelete

Signed-off-by: Zhou Hao <[email protected]>

* fix(helm): respect resource policy on ungrade
Don't delete a resource on upgrade if it is annotated with
helm.io/resource-policy=keep. This can cause data loss for users
if the annotation is ignored(e.g. for a PVC)

Close helm#7677

Signed-off-by: Dong Gang <[email protected]>

* add unit test for RecordsReplace

Signed-off-by: Zhou Hao <[email protected]>

* fix(helm): polish goimport

Signed-off-by: Dong Gang <[email protected]>

* test(helm): fix client update error

Signed-off-by: Dong Gang <[email protected]>

* Save Chart.lock to helm package tar

Signed-off-by: Song Shukun <[email protected]>

* ref(environment): use string checking instead

It is more idiomatic to compare the string against the empty string than to check the string's length.

Signed-off-by: Matthew Fisher <[email protected]>

* Add --insecure-skip-tls-verify for repositories (helm#7254)

* added --insecure-skip-tls-verify for chart repos

Signed-off-by: Matthias Riegler <[email protected]>

* fixed not passing the insecureSkipTLSverify option

Signed-off-by: Matthias Riegler <[email protected]>

* fixed testcase

Signed-off-by: Matthias Riegler <[email protected]>

* pass proxy when using insecureSkipVerify

Signed-off-by: Matthias Riegler <[email protected]>

* Add testcases for insecureSkipVerifyTLS

Signed-off-by: Matthias Riegler <[email protected]>

* added missing err check

Signed-off-by: Matthias Riegler <[email protected]>

* panic after json marshal fails

Signed-off-by: Matthias Riegler <[email protected]>

* fix: add new static linter and fix issues it found (helm#7655)

* fix: add new static linter and fix issues it found

Signed-off-by: Matt Butcher <[email protected]>

* fixed two additional linter errors.

Signed-off-by: Matt Butcher <[email protected]>

* Make the charts cache safe in presence of several Helm instances

If several instances of Helm are run at the same moment and try to download the
same chart, some of them might see an empty or incomplete file in cache. Prevent
that by saving the dowloaded file atomically.

Closes helm#7600

Signed-off-by: Mikhail Gusarov <[email protected]>

* chore(go.mod): run `go mod tidy`

Signed-off-by: Matthew Fisher <[email protected]>

* Use Create method if no resources need to be adopted

Signed-off-by: Jacob LeGrone <[email protected]>

* Port --devel flag from v2 to v3

Helm v2 PR helm#5141

Signed-off-by: Martin Hickey <[email protected]>

* Fix stray modules

Signed-off-by: Martin Hickey <[email protected]>

* Add unit test

Signed-off-by: Martin Hickey <[email protected]>

* Solve the issue helm#7749 where proper formating was not being done if --short(-q) option was used with other formating options like json, yaml

Signed-off-by: Anshul Verma <[email protected]>

* Solve the issue helm#7749 where proper formating was not being done if --short(-q) option was used with other formating options like json, yaml

Signed-off-by: Anshul Verma <[email protected]>

* Solve the issue helm#7749 where proper formating was not being done if --short(-q) option was used with other formating options like json, yaml

Signed-off-by: Anshul Verma <[email protected]>

* fix(install): correct append tls config.

Signed-off-by: James McElwain <[email protected]>

* Fixing issue where archives created on windows have broken paths

When archives are created on windows the path spearator in the
archive file is \\. This causes issues when the file is unpacked.
For example, on Linux the files are unpacked in a flat structure
and \ is part of the file name. This causes comp issues. In Helm
v2 the path was set as / when the archive was written. This works
on both Windows and POSIX systems.

The fix being implemented is to use the ToSlash function to ensure
/ is used as the separator.

Fixes helm#7748

Signed-off-by: Matt Farina <[email protected]>

* Solve the issue helm#7749 where proper formating was not being done if --short(-q) option was used with other formating options like json, yaml

Signed-off-by: Anshul Verma <[email protected]>

* Add more detail to error messages and support a non-force mode in metadata visitor

Signed-off-by: Jacob LeGrone <[email protected]>

* Add tests

Signed-off-by: Jacob LeGrone <[email protected]>

* Correcting links for release notes

Signed-off-by: Bridget Kromhout <[email protected]>

* fix(cli): Make upgrade check if cluster reachable

The 'helm upgrade' command was not checking if the cluster was reachable.
Also, 'helm upgrade --install' first checks if the release exists
already.  If that check fails there is no point in continuing the
upgrade.  This optimization avoids a second timeout of 30 seconds when
trying to do the upgrade.

Signed-off-by: Marc Khouzam <[email protected]>

* Fix a bug in storage/driver/secrets.go Delete() (helm#7348)

* Fix a bug in storage/driver/secrets.go

* Fix a bug in Delete() in storage/driver/cfgmaps.go (helm#7367)

* Add unit test for lint/values.go

Signed-off-by: Kim Bao Long <[email protected]>

* Improve error message to check in unit test

Signed-off-by: Martin Hickey <[email protected]>

* helm create command's templates more consistent

- Removed most right whitespace chomps except those directly following a
  template definition where it make sense to not lead with a blank line.
  The system applied is now to almost always left whitespace chomp but
  also whitespace chomp right if its the first thing in a file or
  template definition.
- Updated indentation to be systematic throughout all the boilerplace
  files.

Signed-off-by: Erik Sundell <[email protected]>

* Snapcraft installation instructions added

Helm is available as a snap - https://snapcraft.io/helm; added this to
the installation options

Signed-off-by: Ihor Dvoretskyi <[email protected]>

* pass subchart notes option to install client

Signed-off-by: Jon Leonard <[email protected]>

* add testing for upgrade --install with subchart notes

Signed-off-by: Jon Leonard <[email protected]>

* Delete unneeded chart output

Signed-off-by: Jon Leonard <[email protected]>

* Add fromYamlArray and fromJsonArray template helpers (helm#7712)

Signed-off-by: Tuan Nguyen <[email protected]>

* fix: update unit test for go 1.14 error string change (helm#7835)

* fix: update unit test for go 1.14 error string change

Signed-off-by: Matt Butcher <[email protected]>

* changed strategy based on conversation with Adam

Signed-off-by: Matt Butcher <[email protected]>

* update test chart to helm3 format

Signed-off-by: Jon Leonard <[email protected]>

* remove unneeded values files from testchart

Signed-off-by: Jon Leonard <[email protected]>

* Add unit test for pkg/chart/chart.go

Signed-off-by: Hu Shuai <[email protected]>

* Improve --show-only flag (helm#7816)

* Improve --show-only flag
* Ensure consistent manifest ordering

* fix(helm): Data race in kube/client Delete func. (helm#7820)

helm uninstall has a data race in its Delete function.
This resolves it using a mutex.

Signed-off-by: Liam Nattrass <[email protected]>

* Avoid downloading same chart multiple times

Signed-off-by: Andrey Voronkov <[email protected]>

* feat: add pod annotations

With the rise of sidecar injectors, pod annotations configuration is becoming more and more important.

Signed-off-by: Naseem <[email protected]>

* feat: allow image tag override

While using the chart version as image tag is the sanest default, it is not uncommon to want to override this if using a custom image, or using helm to manage  an in-house app running different tags across different environments.

Signed-off-by: Naseem <[email protected]>

* Adding notes on semver to create Chart.yaml

The version field in the Chart.yaml has a comment describing it
but it did not note the version needs to follow SemVer. There
have been numerous questions, over time, about this format. Add
note here so it's exposed in more places.

Signed-off-by: Matt Farina <[email protected]>

* fix: fixed bug in Dependency.List() (helm#7852)

* fix: fixed bug in Dependency.List()

A bug in Dependency.List() caused all compressed charts to flag their dependencies as "missing".

Closes helm#4431

Signed-off-by: Matt Butcher <[email protected]>

* removed some files from test fixtures

Signed-off-by: Matt Butcher <[email protected]>

* Implement support for multiple args for repo remove (helm#7791)

* Implement support for multiple args for repo remove

Signed-off-by: Andreas Lindhé <[email protected]>

* Adding template docs to the version command

Signed-off-by: Matt Farina <[email protected]>

* ref(*): kubernetes v1.18 (helm#7831)

Upgrade Kubernetes libraries to v0.18.0

Add new lazy load KubernetesClientSet to avoid missing kubeconfig error

In kubernetes v1.18 kubeconfig validation was added.  Minikube and Kind
both remove kubeconfig when stopping clusters.  This causes and error
when running any helm commands because we initialize the client before
executing the command.

Signed-off-by: Adam Reese <[email protected]>

* chore(comp): Remove unnecessary code

After the introduction of lazy loading of the Kubernetes client as part
of PR helm#7831, there is no longer a need to protect against an incomplete
--kube-context value when doing completion.

Signed-off-by: Marc Khouzam <[email protected]>

* fixed capitalization in a few help messages. (helm#7898)

Signed-off-by: Matt Butcher <[email protected]>

* fix(storage): preserve last deployed revision (helm#7806)

Signed-off-by: Eric Bailey <[email protected]>

* feat(cmd/helm): Update Cobra to 1.0.0 release

Signed-off-by: Marc Khouzam <[email protected]>

* updated help text for install --atomic, which was completely inaccurate (helm#7912)

Signed-off-by: Matt Butcher <[email protected]>

* add unit test for IsRoot

Signed-off-by: Zhou Hao <[email protected]>

* add unit test for ChartPath

Signed-off-by: Zhou Hao <[email protected]>

* add unit test for ChartFullPath

Signed-off-by: Zhou Hao <[email protected]>

* add unit test for metadata Validate

Signed-off-by: Zhou Hao <[email protected]>

* docs: Update inline docs on action/upgrade.go (helm#7834)

* docs: Update inline docs on action/upgrade.go

Signed-off-by: Matt Butcher <[email protected]>

* clarify atomic and cleanup-on-fail

Signed-off-by: Matt Butcher <[email protected]>

* updated the post-render documentation on action.Upgrade

Signed-off-by: Matt Butcher <[email protected]>

* Add unit test for Secrets/ConfigMaps (helm#7765)

* test(pkg/storage/secrets): make MockSecretsInterface.List follow ListOptions

Signed-off-by: Lu Fengqi <[email protected]>

* test(pkg/storage/secrets): add unit test for Secrets.Query

Signed-off-by: Lu Fengqi <[email protected]>

* test(pkg/storage/cfgmaps): make MockConfigMapsInterface.List follow ListOptions

Signed-off-by: Lu Fengqi <[email protected]>

* test(pkg/storage/cfgmaps): add unit test for ConfigMaps.Query

Signed-off-by: Lu Fengqi <[email protected]>

* fix(tests): fix broken unit tests in storage (helm#7928)

* fix(pkg/kube): continue deleting objects when one fails

* Continue deleting objects when one fails to minimize the risk of an
  upgrade ending in an unrecoverable state
* Exclude failed deleted object from the returned result set

Signed-off-by: Adam Reese <[email protected]>

* Add an improved user error message for removed k8s apis

The error message returned from Kubernetes when APIs are
removed is not very informative. This PR adds additional
information to the user. It covers the current release manifest
APIs.

Partial helm#7219

Signed-off-by: Martin Hickey <[email protected]>

* test: forward-port regression test from Helm 2 (helm#7927)

Signed-off-by: Matt Butcher <[email protected]>

* add softonic to adopters (helm#7918)

Signed-off-by: Riccardo Piccoli <[email protected]>

Co-authored-by: Riccardo Piccoli <[email protected]>

* Make get script eaiser for helm versions to live side by side (helm3 etc) (helm#7752)

* Make get script eaiser for helm versions to live side by side (helm3 etc)

Signed-off-by: Scott Rigby <[email protected]>

* Change PROJECT_NAME to BINARY_NAME for purpose clarity

Signed-off-by: Scott Rigby <[email protected]>

* fix: rebuild chart after dependency update on install (helm#7897)

* fix: rebuild chart after dependency update on install

Signed-off-by: Matt Butcher <[email protected]>

* add correct debug settings

Signed-off-by: Matt Butcher <[email protected]>

* add unit test for function FindPlugins

Signed-off-by: ZouYu <[email protected]>

* Updating sprig and semver to newer versions

Note, there is an issue with a dependency of sprig changing
behavior. A test has been added with a description to catch if a
behavior breaking change of mergo is used.

See darccio/mergo#139 for the mergo
issue and sprig for further details on handling this in the
future.

Closes  helm#7533

Signed-off-by: Matt Farina <[email protected]>

* Fix nested null value overrides (helm#7743)

* Fix nested null value overrides

Signed-off-by: Mingxiang Xue <[email protected]>

* Fix subchart value deletion

Signed-off-by: Mingxiang Xue <[email protected]>

* fix: Fixed a regression that was introduced with changed nil handling (helm#7938)

Signed-off-by: Matt Butcher <[email protected]>

* Migrate SQL storage driver to Helm 3 (helm#7635)

* Migrate SQL storage driver to Helm 3

Signed-off-by: Elliot Maincourt <[email protected]>

* Update pkg/storage/driver/sql.go

Co-Authored-By: Sebastian Pöhn <[email protected]>
Signed-off-by: Elliot Maincourt <[email protected]>

* Add authentication to releases_v3

Signed-off-by: Elliot Maincourt <[email protected]>

* Fix migration

Signed-off-by: Elliot Maincourt <[email protected]>

* Template the init migration

Signed-off-by: Elliot Maincourt <[email protected]>

* Prevent potential SQL injection

Signed-off-by: Elliot Maincourt <[email protected]>

* Use an SQL querybuilder

Signed-off-by: Elliot Maincourt <[email protected]>

* Remove references to HELM_DRIVER_SQL_DIALECT

Signed-off-by: Elliot Maincourt <[email protected]>

Co-authored-by: Sebastian Pöhn <[email protected]>
Co-authored-by: Matt Butcher <[email protected]>

* fix: removed inaccurate comment (helm#7937)

Signed-off-by: Matt Butcher <[email protected]>

* Updating get stripts to skip pre-releases

A recent change to the get scripts causes them to pickup
pre-releases in addition to stable releases. This update causes
only stable releases to be fetched by the get scripts.

Fixed helm#7941

Signed-off-by: Matt Farina <[email protected]>

* fix(helm): allow a previously failed release to be upgraded (helm#7653)

Signed-off-by: Matt Morrissette <[email protected]>

* fs_test: use os.Getuid() instead user.Current() to determine if a test is executed with root privileges.

This change lower the expectations on test env setup, i.e. tests could be executed in a container under a random UID,
without require an user in /etc/passwd

Signed-off-by: Predrag Knezevic <[email protected]>

* Parse reference templates in predictable order (helm#7702)

* Parse reference templates in predictable order

Fix issue helm#7701

Signed-off-by: Andre Sencioles <[email protected]>

* Add test case for issue helm#7701 regression

Signed-off-by: Andre Sencioles <[email protected]>

* gofmt

Signed-off-by: Andre Sencioles <[email protected]>

* fix linting error with lookup function (helm#7969)

Signed-off-by: Matt Butcher <[email protected]>

* fix(pkg/plugin): copy plugins directly to the data directory (helm#7962)

Copy plugins from the cache rather than create a symlink.

fixes: helm#7206

Signed-off-by: Adam Reese <[email protected]>

* Helm upgrades with --reuse-values and nil user values -- with tests (helm#7959)

* return the new values if modifications dont yet exist

Signed-off-by: David Pait <[email protected]>

* fix tests

Signed-off-by: David Pait <[email protected]>

* removed outter if statement as its not needed now

Signed-off-by: David Pait <[email protected]>

* fix(*): remove bom in utf files when loading chart files (helm#6081)

Removes the BOM prefix if present, in read files before
processing the data.
Affects the following pkg:
- pkg/chart/loader: directory and archive loader
- internal/ignore: when loading .helmignore file

Signed-off-by: Thomas FREYSS <[email protected]>

* fix(cmd/env): make helm env command respect cli flags (helm#7978)

Running `helm env` should respect cli flag overrides.

Signed-off-by: Adam Reese <[email protected]>

* fix(pkg/cli): ensure correct configuration from kubeconfig file

Bind Helm flags to Kubernetes configuration loader to get a merged
config with kubeconfig.

Fixes: helm#7539

Signed-off-by: Adam Reese <[email protected]>

* Modify Circle config to use Go 1.14 (helm#7980)

Signed-off-by: Josh Dolitsky <[email protected]>

* Fixing docs from version to appVersion (helm#7975)

In the created chart from `helm create` is notes a tag overrides
version. It actually overrides appVersion. Updating the docs
to reflect reality.

Signed-off-by: Matt Farina <[email protected]>

* test: add test for bom test data integrity

Signed-off-by: Thomas FREYSS <[email protected]>

* fix: write index.yaml file atomically (helm#7954)

* fix: write index.yaml file atomically

This refactors the already-existing `AtomicWriteFile` utility
to a central location and uses it to write index files
atomically.
This is done to avoid having half-written index files break
client requests.

Drive-bys:
  - Add test for AtomicWriteFile.
  - Add test IndexFile.WriteFile.
Signed-off-by: rabadin <[email protected]>

* Review fix: use RenameWithFallback instead of os.Rename

Signed-off-by: rabadin <[email protected]>

Co-authored-by: rabadin <[email protected]>

* Add unit test for pkg/chart/chart.go

Signed-off-by: Hu Shuai <[email protected]>

* Adding PR template from dev-v2 branch

Signed-off-by: Bridget Kromhout <[email protected]>

* Updating CONTRIBUTING to match current practice

Signed-off-by: Bridget Kromhout <[email protected]>

* Fix : Prints empty list in json/yaml is no repositories are present (helm#7949)

* Prints empty repolist in json/yaml if there are no repos and output format is given as json/yaml rather that printing the error msg "no repositories to show"

Signed-off-by: Anshul Verma <[email protected]>

* Prints empty repolist in json/yaml if there are no repos and output format is given as json/yaml rather that printing the error msg "no repositories to show"

Signed-off-by: Anshul Verma <[email protected]>

* feat: lint the names of templated resources (helm#8011)

Signed-off-by: Matt Butcher <[email protected]>

* Add support for using OCI references as the dependency repository

Signed-off-by: Leo Sjöberg <[email protected]>

* fix accidental bug in chart saving and fix linting

Signed-off-by: Leo Sjöberg <[email protected]>

* add tests and URL fallback handling

Signed-off-by: Leo Sjöberg <[email protected]>

* extract oci to its own constant

Signed-off-by: Leo Sjöberg <[email protected]>

* refactor to a GetWithDetails method

Signed-off-by: Leo Sjöberg <[email protected]>

* fix GetWithDetails tests

Signed-off-by: Leo Sjöberg <[email protected]>

* fix tests

Signed-off-by: Leo Sjöberg <[email protected]>

* rename ChartContent to Content and use naked return

Signed-off-by: Leo Sjöberg <[email protected]>

* move URL and filename handling into the downloader

Signed-off-by: Leo Sjöberg <[email protected]>

* fix imports

Signed-off-by: Leo Sjöberg <[email protected]>

* use old filepath.join behavior to avoid calling it twice

Signed-off-by: Leo Sjöberg <[email protected]>

Co-authored-by: James McElwain <[email protected]>
Co-authored-by: Pavel Macík <[email protected]>
Co-authored-by: Guangwen Feng <[email protected]>
Co-authored-by: Naseem <[email protected]>
Co-authored-by: Dao Cong Tien <[email protected]>
Co-authored-by: Daniel Poelzleithner <[email protected]>
Co-authored-by: Daniel Strobusch <[email protected]>
Co-authored-by: Florian Hopfensperger <[email protected]>
Co-authored-by: Federico Bevione <[email protected]>
Co-authored-by: Matthew Fisher <[email protected]>
Co-authored-by: Matt Butcher <[email protected]>
Co-authored-by: Reinhard Naegele <[email protected]>
Co-authored-by: Hidde Beydals <[email protected]>
Co-authored-by: Vibhav Bobade <[email protected]>
Co-authored-by: Matt Farina <[email protected]>
Co-authored-by: Rui Chen <[email protected]>
Co-authored-by: ylvmw <[email protected]>
Co-authored-by: Zhou Hao <[email protected]>
Co-authored-by: Martin Hickey <[email protected]>
Co-authored-by: Song Shukun <[email protected]>
Co-authored-by: Taylor Thomas <[email protected]>
Co-authored-by: Adam Reese <[email protected]>
Co-authored-by: Paul Czarkowski <[email protected]>
Co-authored-by: Marc Khouzam <[email protected]>
Co-authored-by: Jacob LeGrone <[email protected]>
Co-authored-by: akash-gautam <[email protected]>
Co-authored-by: Tomáš Kohout <[email protected]>
Co-authored-by: Adam Reese <[email protected]>
Co-authored-by: Xiangxuan Liu <[email protected]>
Co-authored-by: Evgenii Iablokov <[email protected]>
Co-authored-by: Matt Morrissette <[email protected]>
Co-authored-by: Dong Gang <[email protected]>
Co-authored-by: Matthias Riegler <[email protected]>
Co-authored-by: Mikhail Gusarov <[email protected]>
Co-authored-by: Anshul Verma <[email protected]>
Co-authored-by: Bridget Kromhout <[email protected]>
Co-authored-by: tiendc <[email protected]>
Co-authored-by: Kim Bao Long <[email protected]>
Co-authored-by: Erik Sundell <[email protected]>
Co-authored-by: Ihor Dvoretskyi <[email protected]>
Co-authored-by: Jon Leonard <[email protected]>
Co-authored-by: Tuan <[email protected]>
Co-authored-by: Hu Shuai <[email protected]>
Co-authored-by: Mario Valderrama <[email protected]>
Co-authored-by: lnattrass <[email protected]>
Co-authored-by: Andrey Voronkov <[email protected]>
Co-authored-by: Naseem <[email protected]>
Co-authored-by: Andreas Lindhé <[email protected]>
Co-authored-by: Eric Bailey <[email protected]>
Co-authored-by: Lu Fengqi <[email protected]>
Co-authored-by: Riccardo Piccoli <[email protected]>
Co-authored-by: Riccardo Piccoli <[email protected]>
Co-authored-by: Scott Rigby <[email protected]>
Co-authored-by: ZouYu <[email protected]>
Co-authored-by: uzxmx <[email protected]>
Co-authored-by: Elliot Maincourt <[email protected]>
Co-authored-by: Sebastian Pöhn <[email protected]>
Co-authored-by: Predrag Knezevic <[email protected]>
Co-authored-by: Andre Sencioles <[email protected]>
Co-authored-by: David Pait <[email protected]>
Co-authored-by: Thomas FREYSS <[email protected]>
Co-authored-by: Josh Dolitsky <[email protected]>
Co-authored-by: Raphaël <[email protected]>
Co-authored-by: rabadin <[email protected]>
Co-authored-by: Anshul Verma <[email protected]>
Co-authored-by: Leo Sjöberg <[email protected]>
hunsche pushed a commit to hunsche/helm that referenced this pull request Oct 2, 2020
Removes workaround introduced in helm#7323

Signed-off-by: Adam Reese <[email protected]>
Signed-off-by: Matheus Hunsche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. v3.x Issues and Pull Requests related to the major version v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Auto-completion in Go instead of bash

4 participants