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
This fixes a bug in which 'helm status' fails if any of the expected
resources are missing in Kubernetes. Now it prints a list of missing
resources at the end of the status report.
Closes#2118
Headless services (with `clusterIP` set to `None`) were reporting
as not being ready because they didn't have an IP address. This adds
a logic check to ignore those services.
When manifests do not change, they didn't get populated with the
latest label info from the API server and then panic'd. This resolves
that bug
Closes#2043
* This is a simple mvp which processes a test definition with the
hook annotation for test when you run `helm test [release]`
* helm client cmd, proto def, tiller logic
Installs, rollback, upgrade, and delete now accept a `--timeout` flag
that allows the user to specify the maximum number of seconds that
any kubernetes command can take.
Closes#1678
It is unnecessary to create a namespace just to test that it exists.
Roles that don't have post namespace will error out even if the namespace exists
and it is possible to install the package anyway. This patch Gets a namespace and
only creates one if it doesn't exist.
Adds validation against the swagger schema.
Example error:
Error: release telling-wildebeest failed: error validating "": error
validating data: expected type int, for field
spec.template.spec.containers[0].ports[0].containerPort, got string
Current error:
unable to decode "": [pos 177]: json: expect char '"' but got char 'n'"'
This does the following to improve deletion failure handling:
- In an UninstallRelease operation, the release is marked DELETED
as soon as the basic checks are passed. This resolves 1508. I filed a
followup issue for doing this even better when we can modify protos
again.
- If a YAML manifest fails to parse, the error messages now suggests
that the record is corrupt, and the resources must be manually
deleted.
- If a resource is missing during deletion, the error messages now make
it clear that an object was skipped, but that the deletion continued.
Closes#1508
This feature has been disabled in the past because simply enabling the
feature causes the Kubernetes library to make requests to a server.
Thus, running any tests that use the 'pkg/kube' library has required
running a kube API server.
This patch makes it possible to selectively activate 3rdParty API
support, and then disables that support during testing.
Future versions of the Kubernetes library appear to make it easier to
configure and mock this behavior, so this is most likely a stop-gap
measure. (Famous last words.)
Closes#1472
- decouple tunnel from kube client
- add context switching for init cmd
- add unit tests for installer and init command
- refactor installer and remove unused code
Currently, delete returns an error if a resource is not found.
That is a bit confusing because if you delete something that
is not found, the end state is not really an error. The end
state is what you wanted to do in the first place. This type
of error is not propogated from the kube client but it is logged
in tiller. We could also change this to keep returning errors
(even the not found) and filter it out in the release server.
This commit adds an Update function to the client.
The Update function takes in the modified manifests and
the original manifests. It then iterates through the modified
objects, creates objects not found in kubernetes, and updates
objects that exists but have been modified. Finally, it
iterates through the original resources and checks to see if
they have been deleted in the modified configuration and then
proceeds to delete them. #690