Currently, if using the --atomic flag or deleting a release that failed due to an already existing
resource, Helm will deleting those resources that aren't managed by it. This PR fixes the issue
by checking for pre-existing resources during install and upgrade. This is done as a validation
step so the release will not even be started if resources currently exist. This PR is inspired by
@xchapter7x's work in #3477.
This also fixes a small bug in upgrade where deletes fail if the resource was already deletes
Fixes#6407
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
This ports the functionality of cleanup on fail to v3 as introduced in #4871. This has been tested manually
and would be a good candidate for a new acceptance test.
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
* fix: clear the discovery cache after CRDs are installed
This fixes an issue in which a chart could not contain both a CRD and an instance of that CRD. It works around a stale cache by force cache invalidation whenever a CRD is added.
Closes#6316
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* fix: wait for CRD to register before allowing CRDs to be installed
This fixes an issue with the previous version of this patch in which the CRD would not be available quickly enough.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* feat: use Wait() to wait for CRDs to be ready
This forward-ports the CRD wait logic to Helm 3, and then uses that to wait for CRDs to be registered.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* ref: moved the scheme modification to an appropriate place.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* fix: turned warnings into fatal errors, fixed spelling, clear cache once
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
Sometimes the stateful set `rollingUpdate` field can be nil even when the
strategy is a rolling update
Fixes#6174
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
This changes most of the KubeClient interface to only ever build objects once and
then pass in everything as lists of resources. As a consequence, we needed to refactor
several of the actions. I took the opportunity to refactor out some duplicated
code while I was in the same area
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
`Result` is a misnomer and is going to be repurposed in a future commit for a
common result type for the different kube `Interface` methods
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
This fixes an issue where resources that hardcode the metadata.namespace parameter cannot be installed.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
The partition and maxUnavailable values are now used in determining the state
of both objects
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
This reenables wait functionality and fixes some small bugs in the logic. Please
note that there are still some naive assumptions made about pods belonging to
DaemonSets and StatefulSets, but that is how the logic was before, so it was not
in scope to modify it for this PR. I will improve this logic in a follow up PR
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
* move the main interface to it's own file
* removed summarizeKeptManifests() which was the last place kube.Get()
was called
* when polling for hooks, use external types
* refactor out legacyschema
* refactor detecting selectors from object
* refactor creating test client
Signed-off-by: Adam Reese <adam@reese.io>
This fixes a dozen or so style errors, almost all of which were just missing comments.
I left several which are fixed in other outstanding PRs, or which belong to code that is about to be removed.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
CRDs and other objects seen as unstructured cannot use strategic
merge patching. It has never been supported on CRDs. Previously,
cases like unstructured objects could have caused an unregistered
error. This is no longer the case.
This change explicitly looks for unstructured objects and handles
those using json merge patching.
Closes#3382
This error occures when resource is not found in helm release:
`Error: UPGRADE FAILED: no resource with the name "redis-cluster-sentinel" found`
Changed to:
`Error: UPGRADE FAILED: no ConfigMap with the name "redis-cluster-sentinel" found`
So now that resource can easily be found in cluster.
k8s client-go closes the ready channel that's passed in (see https://github.com/kubernetes/client-go/blob/master/tools/portforward/portforward.go#L171) This means that Tunnel's Close will always panic, as the client-go library will have closed then channel. This isn't reproducible unless helm.Client is externally, as the helm cli runner doesn't actually invoke Close.
Kind can change it's APIVersion with time, such as "Deployment" which was
"extensions/v1beta1" and then migrated to "apps/v1beta1" in Kube 1.6.
Name, Kind and optinally Namespace are used to find relevant Info
object for a original resource which is being upgraded, it safe enough,
as it is uniquely identifies an object.
This builds on previous work and adds more logging to follow
the full process of installing, updating, deleting, and rolling back.
This also standardizes capitalization of logs and small formatting
fixes
The current methodology generated its own RS slice instead of using
a helper method that uses a `clientset`. This caused some issues where
`FindNewReplicaSet` always returned `nil`. This switches the method and
removes some unneeded API calls and code.
Closes#2426