Commit graph

201 commits

Author SHA1 Message Date
Patrick Seidensal
4ee3a19e9a
Fix --take-ownership
If a resource exists in the cluster and is to be adopted by helm install
--take-ownership, it is left unchanged while helm reports the
installation to have succeeded.

This is due to CRs and CRDs being merged without three-way-merge, which
results in an empty patch.

By using a three-way-merge transparently when --take-ownership is used,
the helm behaves as expected without breaking previous behavior.

Fixes #30622

Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
2025-04-17 17:55:06 +01:00
Chris Berry
b8e13878fc
Add HookOutputFunc and generic yaml unmarshaller
Signed-off-by: Chris Berry <bez625@gmail.com>
2025-02-21 19:00:41 -05:00
Chris
20f859c9ff
Tidy up imports
Signed-off-by: Chris <bez625@gmail.com>
2025-02-21 18:55:33 -05:00
Chris Berry
ca90972b3d
Add hook annotations to output pod logs to client on success and fail
Signed-off-by: Chris Berry <bez625@gmail.com>
2025-02-21 18:54:56 -05:00
Matt Farina
9f620b857a Update to Go 1.23
Multiple changes were made to pass linting. Some Go built-in names
are being used for variables (e.g., min). This happens in the Go
source itself including the Go standard library and is not always
a bad practice.

To handle allowing some built-in names to be used the linter config
is updated to allow (via opt-in) some names to pass. This allows us
to still check for re-use of Go built-in names and opt-in to any
new uses.

There were also several cases where a value was checked for nil
before checking its length when this is already handled by len()
or the types default value. These were cleaned up.

The license validation was updated because it was checking everything
in the .git directory including all remote content that was local.
The previous vendor directory was from a time prior to Go modules
when Helm handled dependencies differently. It was no longer needed.

Signed-off-by: Matt Farina <matt.farina@suse.com>
(cherry picked from commit 5727f56a96)
2024-12-28 12:06:27 -05:00
Matt Farina
8f59c8e807
Merge pull request #9713 from andreaskaris/issue9710
fix(helm): Retry Conflict error for createResource, deleteResource
2024-10-17 17:36:00 +02:00
Andreas Karis
79a1f2c801
fix(helm): Retry Conflict error for createResource, deleteResource
kubernetes might at any time throw 409 Conflict Error codes. Clients
are supposed to retry when this happens. As an example, see
kubernetes/issues/67761 where such an issues might happen when the
cluster manipulates a projects's ResourceQuotas.

Catch such Conflict Errors on createResource and deleteResource and
retry before giving up. Due to the more complex logic and focus on
kubernetes/issues/67761, this patch purposefully omits possibly
needed changes to updateResource and instead defers them to another
patch if required in the future.

Closes issue #9710

Signed-off-by: Andreas Karis <ak.karis@gmail.com>
2024-10-17 10:36:43 -04:00
Nathan Baulch
ef85fa7f2d
Grammar fixes
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-14 10:30:31 +10:00
Nathan Baulch
ff9dd262e3
Fix typos
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-14 10:29:56 +10:00
Dr. Stefan Schimanski
b9bdeca93b
kube/client: add to global client-go scheme in init func
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-08-01 16:29:25 +02:00
Matt Farina
847369c184
Update to Go 1.21 for builds
Noteis:
1. This moves golangci scanning to a GitHub action. This will
   enable inline pointers to issues in the PR where linting fails.
2. Go 1.21 is specified in the go.mod because Kubernetes libs
   require it.
3. The lint issues were removed. Some were fixed while others
   were handled by skipping linting or using _ as an argument.
   Many of these can be refactored later for better cleanup.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-01-08 15:48:36 -05:00
Serge Logvinov
b0d163771e feat: print failed hook name
Add more details when a hook fails.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
2023-10-12 17:26:11 +03:00
Joe Julian
eb4edc96c5
Merge pull request #10965 from mattfarina/factory-comment
Adding details on the Factory interface
2023-08-28 12:13:56 -07:00
Joe Julian
02ef594a43
Merge pull request #11591 from ruanxin/use_wrapped_error
Use wrapped error so that ErrNoObjectsVisited can be compared
2023-08-01 16:17:50 -07:00
Matt Farina
8b19f8df0e
Adding details on the Factory interface
This covers both the property and the minimal copy of the Factory
interface. It also notes that this interface is not covered by the
Helm backwards compatibility and why.

Signed-off-by: Matt Farina <matt.farina@suse.com>
Signed-off-by: Joe Julian <me@joejulian.name>
2023-05-05 17:20:31 -07:00
Matt Farina
b81428919b
Merge pull request #12015 from yann-soubeyrand/bump-k8s-io-deps
chore: bump k8s.io dependencies to v0.27.1
2023-05-01 09:54:14 -04:00
Matt Farina
3b74c13768
Merge pull request #11479 from MichaelMorrisEst/cascade
Add option to support foreground cascade deletion
2023-04-27 15:43:14 -04:00
Tom Wieczorek
b9361407a3
Bump k8s.io deps from v0.26.0 to v0.27.0
Adapt to changes in 1.27 client libs:

* The OpenAPIGetter method is now private, but the Validator method does
  what is needed instead.
* The function wait.PollImmediateUntil is deprecated. Switch to the
  recommended new function wait.PollUntilContextCancel.

Related dependency changes:

change k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 => v0.0.0-20230308215209-15aac26d736a

And some transitive version changes:

add github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
add github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
remove github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153
github.com/go-errors/errors v1.0.1 => v1.4.2
github.com/go-openapi/jsonpointer v0.19.5 => v0.19.6
github.com/go-openapi/jsonreference v0.20.0 => v0.20.1
github.com/go-openapi/swag v0.19.14 => v0.22.3
github.com/golang/protobuf v1.5.2 => v1.5.3
github.com/mailru/easyjson v0.7.6 => v0.7.7
github.com/onsi/ginkgo/v2 v2.4.0 => v2.9.1
github.com/onsi/gomega v1.23.0 => v1.27.4
github.com/rogpeppe/go-internal v1.9.0 => v1.10.0
golang.org/x/mod v0.8.0 => v0.9.0
golang.org/x/net v0.7.0 => v0.8.0
golang.org/x/term v0.5.0 => v0.6.0
golang.org/x/tools v0.6.0 => v0.7.0
gotest.tools/v3 v3.0.3 => v3.4.0
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 => v0.0.0-20221116044647-bc3834ca7abd
sigs.k8s.io/kustomize/api v0.12.1 => v0.13.2
sigs.k8s.io/kustomize/kyaml v0.13.9 => v0.14.1

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
2023-04-13 10:48:42 +02:00
willzgli
11150cdcc6 Fix goroutine leak in perform
Signed-off-by: willzgli <willzgli@tencent.com>
2023-03-17 23:30:12 +08:00
MichaelMorris
830d4a9ee9 Add option to support cascade deletion options
Add --cascade=<background|foreground|orphan> option to helm uninstall
Current behaviour is hardcoded to background

Addresses issue: https://github.com/helm/helm/issues/10586

Signed-off-by: MichaelMorris <michael.morris@est.tech>
2023-02-02 11:22:32 +00:00
Matt Farina
36e18fa6e1
Fix improper use of Table request/response to k8s API
Fixes #11712

A change was made that when validation was turned off the Kubernetes
packages were building objects as a Table type. This was done for
display purposes. When details about the objects was going to be
printed as part of #10912.

This broke rollback, and possibly other functionality, as a Table
type was returned in some cases that needed the regular object.
This caused things to break silently.

The fix involved adding in a new Function (and interface) to
query for tables instead of the objects themselves. There was not
a clean way to add it to the existing function that covered all
cases.

A second problem was noticed along the way. When data was output
via status as YAML or JSON it was in the form of a table rather
than the objects themselves. This did not reflect expectations
and did not match the functionality in kubectl. The code was
updated to return a table when that was presented and the objects
when they are being output for YAML or JSON. The API also supports
this handling to SDK users can replicate this functionality.

API changes made here were never released. The functions were
developed for this release of Helm and only ever appeared in an
RC. In this case, they can be changed.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-01-12 08:38:10 -05:00
Xin Ruan
a2b98281a1 Use errors.Is to compare
Signed-off-by: Xin Ruan <xin.ruan@sap.com>
2022-12-14 15:46:39 +01:00
Soujanya Mangipudi
038cc4a0ca
Merge branch 'main' into main
Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>
2022-12-12 10:48:20 -08:00
Xin Ruan
f01486a0ef Use wrapped error so that ErrNoObjectsVisited can be compared after return.
Signed-off-by: Xin Ruan <xin.ruan@sap.com>
2022-12-01 17:52:31 +01:00
Soujanya Mangipudi
ffa19a4b5d Addressing review comments - move printing code out of client.go
Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

fix circleci tests

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

fix formatting errors

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

fix tests

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

fix tests

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

fix gofmt issue

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>
2022-09-09 13:29:19 -07:00
Soujanya Mangipudi
9d5be803bc feat(helm): Supporting helm3 to show up resource names that were deployed as part of release in helm status command
Creating a new PR based on this existing stale PR https://github.com/helm/helm/pull/7728

Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>

# Conflicts:
#	go.sum
2022-09-09 13:28:48 -07:00
Marcin Owsiany
b7c35d2a0f During deletion, explicitly log already deleted resource name.
Unfortunately errors from the API server do not always (do they ever?) contain
the name of the resource in question.

Deletions for multiple resources are processed concurrently, so in a resulting
log, a preceding "Starting delete" line might be for a different object.

Signed-off-by: Marcin Owsiany <porridge@redhat.com>
2022-09-06 12:29:01 +02:00
Andrew Seigner
bd7c97f786 Bump k8s packages from 0.23.6 to 0.24.0
This required modifying the `kube.Factory` interface to conform to
changes in k8s' `cmdutil.Factory` interface:
fe3772890f

Signed-off-by: Andrew Seigner <andrew@sig.gy>
2022-05-04 10:58:09 +00:00
Martin Hickey
292368a64d
Merge pull request #10209 from yxxhero/fix_sa_issue
Add more debug msg when helm upgrade
2022-01-10 18:05:17 +00:00
yxxhero
f82896b0b5 add more debug msg when helm upgrade
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-01-11 01:41:27 +08:00
Matthew Fisher
67f92d63fa
Merge pull request #9640 from wangchenglong01/wangchl01
Add error check to avoid panic
2021-11-26 08:55:57 -08:00
Mike Ng
d51a61f9ab Introduce a new interface for WaitForDelete() to avoid breaking backwards compatibility
Signed-off-by: Mike Ng <ming@redhat.com>
2021-08-26 17:30:55 -04:00
Mike Ng
655bdcd2fd feat: add optional boolean '--wait' flag to 'uninstall' command.
If set, 'uninstall' command will wait until all the resources are deleted before returning.
It will wait for as long as --timeout

closes #2378

Signed-off-by: Mike Ng <ming@redhat.com>
2021-08-26 15:31:49 -04:00
Matt Farina
21251378b4
Merge pull request #9870 from mattfarina/fix-9859
Set Helm as manager for managedFields
2021-07-06 15:41:14 -04:00
小龙同学
cf0c6fed51
fix(doc): fix kube client interface doc. (#9882)
- add missing interface methods doc.
- fix some wrong english grammar.

Signed-off-by: longkai <im.longkai@gmail.com>
2021-07-06 10:41:55 -06:00
Matt Farina
aeb94798f0
Set Helm as manager for managedFields
managedFields were a changed that landed in 1.18. This is an array
under metadata with managedFields. The kubernetes client pkgs that
Helm uses automatically add them.

This change added a manager for the managedFields. The flow for
deciding on the name to use is:

1. An explicit name if one is chosen
2. The base name of the first os.Arg (the binary name) if no name
   explicitly set.
3. unknown if no name set and name cannot be detected

The name is at the package level as there is no other place to easily
set it for Helm v3. Since the name is for the binary or app it should
be ok to set app wide.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2021-06-25 18:36:27 -04:00
Cookie Wang
8959d93711 Add error check to avoid panic
Signed-off-by: Cookie Wang <wangchl01@inspur.com>
2021-04-22 16:51:23 +08:00
Joe Lanford
98d98369ed
Add ReadyChecker to decouple ready check logic from --wait
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
2021-03-29 11:52:33 -04:00
Matt Farina
f5ef87b96e
Merge pull request #8363 from zh168654/master
helm upgrade with --wait support jobs in manifest to be completed
2020-12-17 15:51:04 -05:00
Jon Huhn
5d08a0d00e Fix typo
Signed-off-by: Jon Huhn <huhnjon@gmail.com>
2020-11-24 13:49:45 -06:00
zh168654
bfc575dec2 add waitwithjobs instead of changing wait api
Signed-off-by: zh168654 <zhangye.168@163.com>
2020-11-05 17:13:15 +08:00
zh168654
957d2a2bf9 add wait-for-jobs flag
Signed-off-by: zh168654 <zhangye.168@163.com>
2020-11-03 22:07:24 +08:00
Janario Oliveira
cf3870a57f Adjusted import
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
2020-10-06 22:38:26 +02:00
Janario Oliveira
10a29d1662 Reuse kube-client
Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
2020-10-06 22:33:29 +02:00
Matt Farina
b7c38c879a Adding support for k8s 1.19
Closes #8806

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-09-25 12:15:06 -04:00
Rajat Jindal
4faeedd98b fix watch error due to elb/proxy timeout
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
2020-07-23 12:04:54 +05:30
Hidde Beydals
8217aba4a6 fix(kube): use logger instead of fmt.Printf
Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-07-13 10:59:00 +02:00
Matt Farina
dbd001e532
Removing tiller language
Since Tiller is no longer part of Helm v3, internal documentation
language about Tiller can be removed

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-05-21 15:26:16 -04:00
小明同学
decab8ea2e
fix: upgrade using --force shoud not run patch logic (#8000)
fix helm/helm#7999

Signed-off-by: Liu Ming <hit_oak_tree@126.com>
2020-05-13 15:53:37 -06:00
Liu Ming
ff3ed53b7c polish to keep the same log style
Signed-off-by: Liu Ming <hit_oak_tree@126.com>
2020-04-30 17:31:27 +08:00