Commit graph

333 commits

Author SHA1 Message Date
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 Berry
3c445158d8
Update based on review comments
Signed-off-by: Chris Berry <bez625@gmail.com>
2025-02-21 19:00:39 -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
Jiasheng Zhu
2ebce786ba
fix: check group for resource info match
Closes: #13582

Signed-off-by: Jiasheng Zhu <gnehsaijuhz@hotmail.com>
(cherry picked from commit f5d488122b)
2025-01-17 15:33:33 -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
Alex Johnson
9fd943b481 Add tests to helm/pkg/kube/client_test.go to cover wait.go
Signed-off-by: Alex Johnson <alex.kattathra.johnson@gmail.com>
2024-11-05 09:51:54 -06:00
Robert Sirchia
7e6b34d7dd
removing duplicate empty test
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-10-23 15:17:44 -04:00
Robert Sirchia
16a4e37f20
fixing unit test as per Matt
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-10-23 12:24:04 -04:00
Robert Sirchia
a205af755e
adding more unit test
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-10-22 09:49:41 -04:00
Robert Sirchia
999b85145a
adding test coverage for ready.go
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-10-18 16:44:42 -04: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
Luis Davim
ab3c589809 chore: Make retryingRoundTripper type public
Make retryingRoundTripper type public to allow being used in other
projects

fixes: #13052
Signed-off-by: Luis Davim <luis.davim@gmail.com>
2024-10-09 08:02:27 +01: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
Joe Julian
ff4877e696
Merge pull request #13224 from sttts/sttts-fix-apiext-registration
kube/client: add to global client-go scheme in init func
2024-09-12 09:14:38 -07:00
Matt Farina
c261d0655c
Merge pull request #12876 from manno/sdk-ignore-missing-annotations
Allow install, update action to adopt existing resources (sdk only)
2024-08-14 15:56:37 -04: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
a753ee7f43
Merge pull request #12866 from robertsirc/Correcting-Linting-Errors
Correcting linting errors
2024-04-10 14:04:34 -04:00
Matt Farina
2dea5bf335
Merge pull request #11790 from Nordix/waitRetry
Add robustness to wait status checks
2024-03-14 13:23:14 -04:00
Mario Manno
a7856c0398 Add ability to adopt unmanaged resources
Allow the SDK actions to adopt existing resources. This allows install
and update to overwrite resources. If TakeOwnership is not set, adoption
is only possible if they existing resources have the right labels
(managed-by) and annotations (release-name, ...).

Signed-off-by: Mario Manno <mmanno@suse.com>
2024-03-13 14:09:23 +01:00
Robert Sirchia
d58d7b3762 Fixing all the linting errors
Cleaned up all the linting errors we are getting.

Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-03-11 17:13:34 -04:00
Matt Farina
c042264a9d
Fix issues when verify generation readiness was merged
CI, tests, and building failed after #10920 was merged. This change
fixes the issues that were introduced.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-01-08 22:40:28 -05:00
Matt Farina
b299359f66
Merge pull request #10920 from muang0/readiness-generation-check
Verify generation in readiness checks
2024-01-08 22:29:31 -05: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
Stefan McShane
1a3e9a95dd addressing comment
Signed-off-by: Stefan McShane <stefanmcshane@users.noreply.github.com>
2023-07-19 12:35:14 -04:00
MichaelMorris
d2cf8c66f1 Updated for review comments
Signed-off-by: MichaelMorris <michael.morris@est.tech>
2023-07-13 18:22:37 +01:00
MichaelMorris
fc74964f8a Add robustness to wait status checks
When a user specifies --wait for an install or upgrade this commit will enable the user to specifiy a number of retries to attepmt if a status check fails
Errors including a HTTP status code < 500 will not be retried

Signed-off-by: MichaelMorris <michael.morris@est.tech>
2023-07-13 17:26:21 +01:00
Joe Julian
99e1dce8c8
Merge pull request #9950 from jeffrosenberg/error-on-failed-jobs-9285
Throw an error from jobReady() if the job exceeds its BackoffLimit
2023-07-13 08:21:58 -07:00
Joe Julian
dcd54d59e6
Merge branch 'main' into readiness-generation-check
Signed-off-by: Joe Julian <me@joejulian.name>
2023-05-10 16:48:22 -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
Matt Farina
cf3d2531a8
Merge pull request #11898 from willzgli/waitbatchPerform
Fix goroutine leak in perform
2023-04-11 11:21:21 -04:00
Aman Nijhawan
eea2f27bab
Fixes Readiness Check for statefulsets using partitioned rolling update. (#11774)
* Fixes Readiness Check for statefulsets using partitioned rolling update.
Fixes #11773

This change updates readiness check in ready.go to correctly
account for statefulsets that are utilizing a partitioned upgrade.
These statefulsets only upgrade a subset of the managed pods with each call
to helm upgrade. This causes the upgrade to legitimately hit the condition where
sts.status.CurrentRevision != sts.Status.UpdateRevision which causes helm to mark
the upgrade has failed when in fact it is successful.

This change fixes that behavior to only check when partition is unspecified or 0.

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>

* Adding a unit test to verify that partitioned rolling upgrade for a statefulset works.

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>

---------

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>
Co-authored-by: Aman Nijhawan <anijhawan@yugabyte.com>
2023-03-30 10:39:29 -06:00
Matt Farina
4e7e939f19
Updating the Go version in go.mod
At this time both Go 1.19 and 1.20 are supported. The version
specified in the go.mod file is the minimum version we expect Helm
to be compiled against. This is the oldest supported version to
support environments where others compile Helm. The Helm project
is using Go 1.20 to build Helm itself.

Updating to Go 1.19 also includes dealing with io/ioutil
deprecation and some additional linting issues around staticcheck.
All the staticcheck issues were in test files so linting was
skipped for those.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:52:30 -04:00
Matt Farina
50c22ed7f9
Bump the Go version
Needed to gofmt source to meet changes in style

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:29:26 -04:00
willzgli
11150cdcc6 Fix goroutine leak in perform
Signed-off-by: willzgli <willzgli@tencent.com>
2023-03-17 23:30:12 +08:00
muang0
141fa4a037
Update pkg/kube/ready.go
more readable debug log fmt (i64)

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: muang0 <joden1995@gmail.com>
2023-02-26 09:23:13 -05:00
muang0
4cb62d1262
Update pkg/kube/ready.go
more readable debug log fmt (i64)

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: muang0 <joden1995@gmail.com>
2023-02-26 09:22:58 -05:00
muang0
dbb21fcf44
Update pkg/kube/ready.go
more readable debug log fmt (i64)

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: muang0 <joden1995@gmail.com>
2023-02-26 09:22:35 -05:00
muang0
fcc03324a6
Update pkg/kube/ready.go
more readable debug log fmt (i64)

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: muang0 <joden1995@gmail.com>
2023-02-26 09:22:18 -05:00
muang0
a1a1aafb7d
Update pkg/kube/ready.go
more readable debug log fmt (i64)

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: muang0 <joden1995@gmail.com>
2023-02-26 09:21:36 -05:00
cpanato
006bc0f39d
update k8s registry domain
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-02-17 09:50:04 +01: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