This updates commands install, upgrade, delete, and test to share the
same implementation for hook execution.
BREAKING CHANGES:
- The `test-failure` hook annotation is removed.
Signed-off-by: Jacob LeGrone <git@jacob.work>
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>
The stable repository provides a quick onboarding with a set of
community curated charts. Two problems with the community stable
repository has lead to its need to be removed.
1. The URL is hard coded to a Google Cloud bucket under Google's
control. This was setup when Helm was part of Kubernetes and
Kubernetes was a Google project. The bucket cannot be
transfered to another non-Google controlled project. And,
the bucket is not accessible in some parts of the world
(e.g., China).
2. The number of charts in the stable repository has grown
generally unmaintainable. The repository maintainers cannot
manage the number of PRs coming it cauing delays in response
or no response and PRs are automatically closed. This is
a poor experience.
The alternatice is the Helm Hub that provides a central point of
search for many Helm repositories. Different people and organizations
can maintain their own charts. A central server is not needed as
Helm is setup to be distributed.
Signed-off-by: Matt Farina <matt@mattfarina.com>
This fixes#6044, in which error parsing is greedily eating too many
colons, preventing users from using colons in their warning messages to
the `required` function
Signed-off-by: Ian Howell <ian.howell0@gmail.com>
This feature flag allows `helm template` to be used against a live cluster. Some charts need CRDs to be applied to the cluster before calling `helm install`. This allows users to validate their templates will render with those resources set.
Signed-off-by: Matthew Fisher <matt.fisher@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>
This restores the ability to pass in parameters at runtime to the
ChartDownloader, enabling users to pass in parameters like the --username
and --password flags.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Backport of https://github.com/helm/helm/pull/6010 to dev-v3 (the
description below is a copy-paste from the original v2 branch PR).
As https://github.com/helm/helm/pull/6016 is now merged to dev-v3, the
change is reasonably trivial.
This change is an attempt to address the common problem of json number
unmarshalling where any number is converted into a float64 and
represented in a scientific notation on a marshall call. This behavior
breaks things like: chart versions and image tags if not converted to
yaml strings explicitly.
An example of this behavior: k8s failure to fetch an image tagged with a
big number like: $IMAGE:20190612073634 after a few steps of yaml
re-rendering turns into: $IMAGE:2.0190612073634e+13.
Example issue: #1707
This commit forces yaml parser to use JSON modifiers and explicitly
enables interface{} unmarshalling instead of float64. The change
introduced might be breaking so should be processed with an extra care.
Due to the fact helm mostly dals with human-produced data (charts), we
have a decent level of confidence this change looses no functionality
helm users rely upon (the scientific notation).
Relevant doc: https://golang.org/pkg/encoding/json/#Decoder.UseNumber
Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.com>
Signed-off-by: Oleg Sidorov <me@whitebox.io>
This commit replaces usage of github.com/ghodss/yaml with it's forked
version maintained by SIG community. The replaced library has
low-to-none support activity unlike the latter. We believe the new
Helm branch could benefit from using the community-supported version on
a long-term run as yaml parser is a key component of Helm chart rendering
engine.
This commit locks sigs.k8s.io/yaml dependency version on 1.1.0 which
is backwards compatible with ghodss/yaml 1.0.0.
This change also resolves the outdated dependency version lock for
ghodss/yaml (currently 1.0.0) and makes it possible to port changes from
https://github.com/helm/helm/pull/6010 to dev-v3.
Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.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>
* set custom manifest config media type
Signed-off-by: Josh Dolitsky <jdolitsky@gmail.com>
* use v1 for manifest schema
Signed-off-by: Josh Dolitsky <jdolitsky@gmail.com>
* remove unneeded debug flag
Signed-off-by: Josh Dolitsky <jdolitsky@gmail.com>
* update to new config media type
Signed-off-by: Josh Dolitsky <jdolitsky@gmail.com>
In my previous PR, I did not notice that the wait functionality had been completely removed
from the actions. This restores wait functionality to upgrade and rollback
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>
instead of hard-coding the parameters being passed in the constructor, we should pass in an Options struct that can be used to pass in those parameters.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Have updated the required filter so that it doesn't break when linting a
chart. This work is based off #4221 and #4748 which didn't make it into
the v3 branch.
Signed-off-by: Thomas O'Donnell <andy.tom@gmail.com>
This function was introduced because an older version of Go did not correctly strip the port number from the hostname with .Hostname(). This has since been fixed so it's safe to remove this.
Signed-off-by: Matthew Fisher <matt.fisher@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>
In Helm 2, no chart validation was performed on v1 charts, so there are
a few charts out there that never added an apiVersion to the Chart.yaml.
To ensure those charts continue to work for Helm 3, we should assume
that charts loaded without an apiVersion set should be assumed as v1.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
The 'app.kubernetes.io/version' label was not being rendered as
expected. It was appending onto the label before it and also
the next label label was appending onto it on the same line.
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Want to avoid moving tags like using 'stable'. Therefore,
specify the specifc nginx version/tag.
Update from comment review:
- https://github.com/helm/helm/pull/5662#discussion_r280122531
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
* Add the Schema type and a function to read it
* Added a function to read a schema from a file
* Check that values.yaml matches schema
This commit uses the gojsonschema package to validate a values.yaml file
against a corresponding values.schema.yaml file.
* Add functionality to generate a schema from a values.yaml
* Add Schema to Chart and loader
* Clean up implementation in chartutil
* Add tests for helm install with schema
* Add schema validation to helm lint
* Clean up "matchSchema"
* Modify error output
* Add documentation
* Fix a linter issue
* Fix a test that broke during a rebase
* Clean up documentation
* Specify JSONSchema spec
Since JSONSchema is still in a draft state as of this commit, we need to
specify a particular version of the JSONSchema spec
* Switch to using builtin functionality for file extensions
* Switch to using a third-party library for JSON conversion
* Use the constants from the gojsonschema package
* Updates to unit tests
* Minor change to avoid string cast
* Remove JSON Schema generation
* Change Schema type from map[string]interface{} to []byte
* Convert all Schema YAML to JSON
* Fix some tests that were broken by a rebase
* Fix up YAML/JSON conversions
* This checks subcharts for schema validation
The final coalesced values for a given chart will be validated against
that chart's schema, as well as any dependent subchart's schema
* Add unit tests for ValidateAgainstSchema
* Remove nonessential test files
* Remove a misleading unit test
The TestReadSchema unit test was simply testing the ReadValues function,
which is already being validated in the TestReadValues unit test
* Update documentation to reflect changes to subchart schemas
When creating a Helm chart for the first time, the assumption should be that the app version is also 0.1.0, implying this is for a new application.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Most users want to see the release name and the namespace it was deployed to,
as those are the unique identifiers where the release is stored. I also added
integration tests for `helm list` to better test the command output.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Make template specific functions private to ensure they not misused and
make unit tests simpler. We may export the template helpers later if
needed.
This lays the foundation for the new chart pipeline.
Signed-off-by: Adam Reese <adam@reese.io>
The chart type is added to differentiaite between an application chart
and a library chart. Library charts can be used as dependencies but are
not installable.
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
* Add logic for platform specific commands to plugins
* Add plugins doc updated to incorporate platform specific commands
* Add condition for os match: If OS matches and there is no more specific match, the command
will be executed
* Remove helmVersion constraint from charts
* Guard compile time set variables behind `internal/`
* Allow configuration of UserAgent for HTTPGetter
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>
* feat: add pkg/action to encapsulate action logic
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* feat: replace client/server internals with action package
While we removed Tiller, we left the internal client/server architecture mostly intact. This replaces that architecture with the `pkg/action` package.
This implements the action package for list, but nothing else.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* feat: Add install and refactor some tests
This adds install to the action package, and then fixes up a lot of testing.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* fix: Move a bunch of sorters to the releaseutils package
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* fix: updated APIs and fixed a failed test
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* Use var for timestamper, instead of adding as a struct field
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
Enable to use charts with dependencies that have conditions (e.g. in
umbrella charts). Allow aliases for dependencies that have dependencies
with conditions.
Closes#3734
Signed-off-by: Christian Koeberl <christian.koeberl@gmail.com>
Since there is no tiller anymore this option make most sense with the
'helm upgrade' commando.
Origininally this was added in PR #2636 implementing the feature #2081.
Signed-off-by: Christian Koeberl <christian.koeberl@gmail.com>
To match the convention of `helm install`, `helm uninstall` is the inverse.
Other tangential changes in this PR:
- StatusDeleting has been changed to StatusUninstalling
- StatusDeleted has been changed to StatusUninstalled
- `helm list --deleted` has been changed to `helm list --uninstalled`
- `helm list --deleting` has been changed to `helm list --uninstalling`
- `helm.DeleteOption` and all delete options have been renamed to `helm.UninstallOption`
I have not made any changes to the "helm.sh/hook-delete-policy", "pre-delete" and "post-delete" hook annotations because
1. it's a major breaking change to existing helm charts, which we've commited to NOT break in Helm 3
2. there is no "helm.sh/hook-install-policy" to pair with "helm.sh/hook-uninstall-policy", so delete still makes sense here
`helm delete` and `helm del` have been added as aliases to `helm uninstall`, so `helm delete` and `helm del` still works as is.