Changes to enable helm --set-file (#2752)

Necessary STDIN changes to support Windows

Added support for SE Linux

Informational message about linting OOM

Updated due to latest helm stable being 3.x
This commit is contained in:
Sean Dukehart 2020-01-29 11:26:05 -05:00 committed by GitHub
parent 7edcf47a03
commit 57eeaa4231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1576 additions and 456 deletions

View file

@ -9,7 +9,7 @@ GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run vendor/github.com/gobuffalo/packr/packr/main.go"; fi)
VOLUME_MOUNT=$(shell [[ $(go env GOOS)=="darwin" ]] && echo ":delegated" || echo "")
VOLUME_MOUNT=$(shell if [[ selinuxenabled -eq 0 ]]; then echo ":Z"; elif [[ $(go env GOOS)=="darwin" ]]; then echo ":delegated"; else echo ""; fi)
define run-in-dev-tool
docker run --rm -it -u $(shell id -u) -e HOME=/home/user -v ${CURRENT_DIR}:/go/src/github.com/argoproj/argo-cd${VOLUME_MOUNT} -w /go/src/github.com/argoproj/argo-cd argocd-dev-tools bash -c "GOPATH=/go $(1)"
@ -164,7 +164,9 @@ install-lint-tools:
.PHONY: lint
lint:
golangci-lint --version
golangci-lint run --fix --verbose
# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC
# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
GOGC=100 golangci-lint run --fix --verbose
.PHONY: build
build:
@ -172,11 +174,12 @@ build:
.PHONY: test
test:
./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`
./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`
.PHONY: test-e2e
test-e2e:
./hack/test.sh -timeout 15m ./test/e2e
# NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system
NO_PROXY=* ./hack/test.sh -timeout 15m ./test/e2e
.PHONY: start-e2e
start-e2e: cli
@ -239,4 +242,4 @@ lint-docs:
.PHONY: publish-docs
publish-docs: lint-docs
mkdocs gh-deploy
mkdocs gh-deploy

View file

@ -85,7 +85,7 @@
"ApplicationService"
],
"summary": "List returns list of applications",
"operationId": "ListMixin8",
"operationId": "List",
"parameters": [
{
"type": "string",
@ -135,7 +135,7 @@
"ApplicationService"
],
"summary": "Create creates an application",
"operationId": "CreateMixin8",
"operationId": "Create",
"parameters": [
{
"name": "body",
@ -162,7 +162,7 @@
"ApplicationService"
],
"summary": "Update updates an application",
"operationId": "UpdateMixin8",
"operationId": "Update",
"parameters": [
{
"type": "string",
@ -293,7 +293,7 @@
"ApplicationService"
],
"summary": "Get returns an application by name",
"operationId": "GetMixin8",
"operationId": "Get",
"parameters": [
{
"type": "string",
@ -343,7 +343,7 @@
"ApplicationService"
],
"summary": "Delete deletes an application",
"operationId": "DeleteMixin8",
"operationId": "Delete",
"parameters": [
{
"type": "string",
@ -982,7 +982,7 @@
"ClusterService"
],
"summary": "List returns list of clusters",
"operationId": "List",
"operationId": "ListMixin3",
"parameters": [
{
"type": "string",
@ -1004,7 +1004,7 @@
"ClusterService"
],
"summary": "Create creates a cluster",
"operationId": "Create",
"operationId": "CreateMixin3",
"parameters": [
{
"name": "body",
@ -1031,7 +1031,7 @@
"ClusterService"
],
"summary": "Update updates a cluster",
"operationId": "Update",
"operationId": "UpdateMixin3",
"parameters": [
{
"type": "string",
@ -1064,7 +1064,7 @@
"ClusterService"
],
"summary": "Get returns a cluster by server address",
"operationId": "GetMixin2",
"operationId": "GetMixin3",
"parameters": [
{
"type": "string",
@ -1087,7 +1087,7 @@
"ClusterService"
],
"summary": "Delete deletes a cluster",
"operationId": "Delete",
"operationId": "DeleteMixin3",
"parameters": [
{
"type": "string",
@ -1137,7 +1137,7 @@
"ProjectService"
],
"summary": "List returns list of projects",
"operationId": "ListMixin6",
"operationId": "ListMixin4",
"parameters": [
{
"type": "string",
@ -1159,7 +1159,7 @@
"ProjectService"
],
"summary": "Create a new project.",
"operationId": "CreateMixin6",
"operationId": "CreateMixin4",
"parameters": [
{
"name": "body",
@ -1186,7 +1186,7 @@
"ProjectService"
],
"summary": "Get returns a project by name",
"operationId": "GetMixin6",
"operationId": "GetMixin4",
"parameters": [
{
"type": "string",
@ -1209,7 +1209,7 @@
"ProjectService"
],
"summary": "Delete deletes a project",
"operationId": "DeleteMixin6",
"operationId": "DeleteMixin4",
"parameters": [
{
"type": "string",
@ -1284,7 +1284,7 @@
"ProjectService"
],
"summary": "Update updates a project",
"operationId": "UpdateMixin6",
"operationId": "UpdateMixin4",
"parameters": [
{
"type": "string",
@ -1744,7 +1744,7 @@
"SessionService"
],
"summary": "Create a new JWT for authentication and set a cookie if using HTTP.",
"operationId": "CreateMixin10",
"operationId": "CreateMixin7",
"parameters": [
{
"name": "body",
@ -1769,7 +1769,7 @@
"SessionService"
],
"summary": "Delete an existing JWT cookie if using HTTP.",
"operationId": "DeleteMixin10",
"operationId": "DeleteMixin7",
"responses": {
"200": {
"description": "(empty)",
@ -1803,7 +1803,7 @@
"SettingsService"
],
"summary": "Get returns Argo CD settings",
"operationId": "Get",
"operationId": "GetMixin9",
"responses": {
"200": {
"description": "(empty)",
@ -2301,6 +2301,13 @@
"type": "object",
"title": "HelmAppSpec contains helm app name in source repo",
"properties": {
"fileParameters": {
"type": "array",
"title": "helm file parameters",
"items": {
"$ref": "#/definitions/v1alpha1HelmFileParameter"
}
},
"name": {
"type": "string"
},
@ -3118,6 +3125,13 @@
"type": "object",
"title": "ApplicationSourceHelm holds helm specific options",
"properties": {
"fileParameters": {
"type": "array",
"title": "FileParameters are file parameters to the helm template",
"items": {
"$ref": "#/definitions/v1alpha1HelmFileParameter"
}
},
"parameters": {
"type": "array",
"title": "Parameters are parameters to the helm template",
@ -3476,6 +3490,20 @@
}
}
},
"v1alpha1HelmFileParameter": {
"type": "object",
"title": "HelmFileParameter is a file parameter to a helm template",
"properties": {
"name": {
"type": "string",
"title": "Name is the name of the helm parameter"
},
"path": {
"type": "string",
"title": "Path is the path value for the helm parameter"
}
}
},
"v1alpha1HelmParameter": {
"type": "object",
"title": "HelmParameter is a parameter to a helm template",

View file

@ -496,6 +496,8 @@ func setAppSpecOptions(flags *pflag.FlagSet, spec *argoappv1.ApplicationSpec, ap
setHelmOpt(&spec.Source, helmOpts{helmSets: appOpts.helmSets})
case "helm-set-string":
setHelmOpt(&spec.Source, helmOpts{helmSetStrings: appOpts.helmSetStrings})
case "helm-set-file":
setHelmOpt(&spec.Source, helmOpts{helmSetFiles: appOpts.helmSetFiles})
case "directory-recurse":
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Recurse: appOpts.directoryRecurse}
case "config-management-plugin":
@ -586,6 +588,7 @@ type helmOpts struct {
releaseName string
helmSets []string
helmSetStrings []string
helmSetFiles []string
}
func setHelmOpt(src *argoappv1.ApplicationSource, opts helmOpts) {
@ -612,6 +615,13 @@ func setHelmOpt(src *argoappv1.ApplicationSource, opts helmOpts) {
}
src.Helm.AddParameter(*p)
}
for _, text := range opts.helmSetFiles {
p, err := argoappv1.NewHelmFileParameter(text)
if err != nil {
log.Fatal(err)
}
src.Helm.AddFileParameter(*p)
}
if src.Helm.IsZero() {
src.Helm = nil
}
@ -649,6 +659,7 @@ type appOptions struct {
releaseName string
helmSets []string
helmSetStrings []string
helmSetFiles []string
project string
syncPolicy string
autoPrune bool
@ -678,6 +689,7 @@ func addAppFlags(command *cobra.Command, opts *appOptions) {
command.Flags().StringVar(&opts.releaseName, "release-name", "", "Helm release-name")
command.Flags().StringArrayVar(&opts.helmSets, "helm-set", []string{}, "Helm set values on the command line (can be repeated to set several values: --helm-set key1=val1 --helm-set key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetStrings, "helm-set-string", []string{}, "Helm set STRING values on the command line (can be repeated to set several values: --helm-set-string key1=val1 --helm-set-string key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetFiles, "helm-set-file", []string{}, "Helm set values from respective files specified via the command line (can be repeated to set several values: --helm-set-file key1=path1 --helm-set-file key2=path2)")
command.Flags().StringVar(&opts.project, "project", "", "Application project name")
command.Flags().StringVar(&opts.syncPolicy, "sync-policy", "", "Set the sync policy (one of: automated, none)")
command.Flags().BoolVar(&opts.autoPrune, "auto-prune", false, "Set automatic pruning when sync is automated")

View file

@ -34,6 +34,11 @@ func Test_setHelmOpt(t *testing.T) {
setHelmOpt(&src, helmOpts{helmSetStrings: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmParameter{{Name: "foo", Value: "bar", ForceString: true}}, src.Helm.Parameters)
})
t.Run("HelmSetFiles", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{helmSetFiles: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmFileParameter{{Name: "foo", Path: "bar"}}, src.Helm.FileParameters)
})
}
func Test_setJsonnetOpt(t *testing.T) {

View file

@ -24,7 +24,7 @@ Install:
Brew users can quickly install the lot:
```bash
brew install go git-lfs kubectl kubectx dep ksonnet/tap/ks kubernetes-helm kustomize
brew install go git-lfs kubectl kubectx dep ksonnet/tap/ks helm@2 kustomize
```
Check the versions:

View file

@ -114,7 +114,9 @@ clean_swagger() {
find "${SWAGGER_ROOT}" -name '*.swagger.json' -delete
}
collect_swagger server 31
echo "If additional types are added, the number of expected collisions may need to be increased"
EXPECTED_COLLISION_COUNT=32
collect_swagger server ${EXPECTED_COLLISION_COUNT}
clean_swagger server
clean_swagger reposerver
clean_swagger controller

View file

@ -126,6 +126,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -391,6 +406,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to a helm
template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -626,6 +656,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -865,6 +911,23 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters
to the helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm
parameter
type: string
path:
description: Path is the path value for the
helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm
template
@ -1132,6 +1195,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -1389,6 +1468,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:

View file

@ -127,6 +127,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -392,6 +407,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to a helm
template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -627,6 +657,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -866,6 +912,23 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters
to the helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm
parameter
type: string
path:
description: Path is the path value for the
helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm
template
@ -1133,6 +1196,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -1390,6 +1469,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:

View file

@ -127,6 +127,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -392,6 +407,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to a helm
template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -627,6 +657,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -866,6 +912,23 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters
to the helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm
parameter
type: string
path:
description: Path is the path value for the
helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm
template
@ -1133,6 +1196,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -1390,6 +1469,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:

View file

@ -127,6 +127,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -392,6 +407,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to a helm
template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -627,6 +657,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -866,6 +912,23 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters
to the helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm
parameter
type: string
path:
description: Path is the path value for the
helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm
template
@ -1133,6 +1196,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -1390,6 +1469,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:

View file

@ -127,6 +127,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -392,6 +407,21 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the helm
template
items:
description: HelmFileParameter is a file parameter to a helm
template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -627,6 +657,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter to
a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -866,6 +912,23 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters
to the helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm
parameter
type: string
path:
description: Path is the path value for the
helm parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm
template
@ -1133,6 +1196,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:
@ -1390,6 +1469,22 @@ spec:
helm:
description: Helm holds helm specific options
properties:
fileParameters:
description: FileParameters are file parameters to the
helm template
items:
description: HelmFileParameter is a file parameter
to a helm template
properties:
name:
description: Name is the name of the helm parameter
type: string
path:
description: Path is the path value for the helm
parameter
type: string
type: object
type: array
parameters:
description: Parameters are parameters to the helm template
items:

View file

@ -5,6 +5,7 @@ API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/appli
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,AppProjectSpec,Roles
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,AppProjectSpec,SourceRepos
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,ApplicationList,Items
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,ApplicationSourceHelm,FileParameters
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,ApplicationSourceHelm,Parameters
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,ApplicationSourceHelm,ValueFiles
API rule violation: list_type_missing,github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1,ApplicationSourceJsonnet,ExtVars

File diff suppressed because it is too large Load diff

View file

@ -167,6 +167,9 @@ message ApplicationSourceHelm {
// Values is Helm values, typically defined as a block
optional string values = 4;
// FileParameters are file parameters to the helm template
repeated HelmFileParameter fileParameters = 5;
}
// ApplicationSourceJsonnet holds jsonnet specific options
@ -394,6 +397,15 @@ message HealthStatus {
optional string message = 2;
}
// HelmFileParameter is a file parameter to a helm template
message HelmFileParameter {
// Name is the name of the helm parameter
optional string name = 1;
// Path is the path value for the helm parameter
optional string path = 2;
}
// HelmParameter is a parameter to a helm template
message HelmParameter {
// Name is the name of the helm parameter

View file

@ -43,6 +43,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.ConnectionState": schema_pkg_apis_application_v1alpha1_ConnectionState(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.EnvEntry": schema_pkg_apis_application_v1alpha1_EnvEntry(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HealthStatus": schema_pkg_apis_application_v1alpha1_HealthStatus(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmFileParameter": schema_pkg_apis_application_v1alpha1_HelmFileParameter(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmParameter": schema_pkg_apis_application_v1alpha1_HelmParameter(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.Info": schema_pkg_apis_application_v1alpha1_Info(ref),
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.InfoItem": schema_pkg_apis_application_v1alpha1_InfoItem(ref),
@ -617,11 +618,24 @@ func schema_pkg_apis_application_v1alpha1_ApplicationSourceHelm(ref common.Refer
Format: "",
},
},
"fileParameters": {
SchemaProps: spec.SchemaProps{
Description: "FileParameters are file parameters to the helm template",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmFileParameter"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmParameter"},
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmFileParameter", "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1.HelmParameter"},
}
}
@ -1419,6 +1433,33 @@ func schema_pkg_apis_application_v1alpha1_HealthStatus(ref common.ReferenceCallb
}
}
func schema_pkg_apis_application_v1alpha1_HelmFileParameter(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "HelmFileParameter is a file parameter to a helm template",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Description: "Name is the name of the helm parameter",
Type: []string{"string"},
Format: "",
},
},
"path": {
SchemaProps: spec.SchemaProps{
Description: "Path is the path value for the helm parameter",
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_pkg_apis_application_v1alpha1_HelmParameter(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{

View file

@ -181,6 +181,8 @@ type ApplicationSourceHelm struct {
ReleaseName string `json:"releaseName,omitempty" protobuf:"bytes,3,opt,name=releaseName"`
// Values is Helm values, typically defined as a block
Values string `json:"values,omitempty" protobuf:"bytes,4,opt,name=values"`
// FileParameters are file parameters to the helm template
FileParameters []HelmFileParameter `json:"fileParameters,omitempty" protobuf:"bytes,5,opt,name=fileParameters"`
}
// HelmParameter is a parameter to a helm template
@ -193,6 +195,14 @@ type HelmParameter struct {
ForceString bool `json:"forceString,omitempty" protobuf:"bytes,3,opt,name=forceString"`
}
// HelmFileParameter is a file parameter to a helm template
type HelmFileParameter struct {
// Name is the name of the helm parameter
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// Path is the path value for the helm parameter
Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"`
}
var helmParameterRx = regexp.MustCompile(`([^\\]),`)
func NewHelmParameter(text string, forceString bool) (*HelmParameter, error) {
@ -207,6 +217,17 @@ func NewHelmParameter(text string, forceString bool) (*HelmParameter, error) {
}, nil
}
func NewHelmFileParameter(text string) (*HelmFileParameter, error) {
parts := strings.SplitN(text, "=", 2)
if len(parts) != 2 {
return nil, fmt.Errorf("Expected helm file parameter of the form: param=path. Received: %s", text)
}
return &HelmFileParameter{
Name: parts[0],
Path: helmParameterRx.ReplaceAllString(parts[1], `$1\,`),
}, nil
}
func (in *ApplicationSourceHelm) AddParameter(p HelmParameter) {
found := false
for i, cp := range in.Parameters {
@ -221,8 +242,22 @@ func (in *ApplicationSourceHelm) AddParameter(p HelmParameter) {
}
}
func (in *ApplicationSourceHelm) AddFileParameter(p HelmFileParameter) {
found := false
for i, cp := range in.FileParameters {
if cp.Name == p.Name {
found = true
in.FileParameters[i] = p
break
}
}
if !found {
in.FileParameters = append(in.FileParameters, p)
}
}
func (h *ApplicationSourceHelm) IsZero() bool {
return h == nil || (h.ReleaseName == "") && len(h.ValueFiles) == 0 && len(h.Parameters) == 0 && h.Values == ""
return h == nil || (h.ReleaseName == "") && len(h.ValueFiles) == 0 && len(h.Parameters) == 0 && len(h.FileParameters) == 0 && h.Values == ""
}
type KustomizeImage string

View file

@ -841,6 +841,19 @@ func TestApplicationSourceHelm_AddParameter(t *testing.T) {
})
}
func TestApplicationSourceHelm_AddFileParameter(t *testing.T) {
src := ApplicationSourceHelm{}
t.Run("Add", func(t *testing.T) {
src.AddFileParameter(HelmFileParameter{Name: "foo", Path: "bar"})
assert.ElementsMatch(t, []HelmFileParameter{{Name: "foo", Path: "bar"}}, src.FileParameters)
})
t.Run("Replace", func(t *testing.T) {
src.AddFileParameter(HelmFileParameter{Name: "foo", Path: "baz"})
assert.ElementsMatch(t, []HelmFileParameter{{Name: "foo", Path: "baz"}}, src.FileParameters)
})
}
func TestNewHelmParameter(t *testing.T) {
t.Run("Invalid", func(t *testing.T) {
_, err := NewHelmParameter("garbage", false)
@ -869,6 +882,7 @@ func TestApplicationSourceHelm_IsZero(t *testing.T) {
{"ValueFiles", &ApplicationSourceHelm{ValueFiles: []string{""}}, false},
{"Parameters", &ApplicationSourceHelm{Parameters: []HelmParameter{{}}}, false},
{"ReleaseName", &ApplicationSourceHelm{ReleaseName: "foa"}, false},
{"FileParameters", &ApplicationSourceHelm{FileParameters: []HelmFileParameter{{}}}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View file

@ -318,6 +318,11 @@ func (in *ApplicationSourceHelm) DeepCopyInto(out *ApplicationSourceHelm) {
*out = make([]HelmParameter, len(*in))
copy(*out, *in)
}
if in.FileParameters != nil {
in, out := &in.FileParameters, &out.FileParameters
*out = make([]HelmFileParameter, len(*in))
copy(*out, *in)
}
return
}
@ -828,6 +833,22 @@ func (in *HealthStatus) DeepCopy() *HealthStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmFileParameter) DeepCopyInto(out *HelmFileParameter) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmFileParameter.
func (in *HelmFileParameter) DeepCopy() *HelmFileParameter {
if in == nil {
return nil
}
out := new(HelmFileParameter)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmParameter) DeepCopyInto(out *HelmParameter) {
*out = *in

View file

@ -624,10 +624,12 @@ type HelmAppSpec struct {
// the output of `helm inspect values`
Parameters []*v1alpha1.HelmParameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty"`
// the contents of values.yaml
Values string `protobuf:"bytes,5,opt,name=values,proto3" json:"values,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Values string `protobuf:"bytes,5,opt,name=values,proto3" json:"values,omitempty"`
// helm file parameters
FileParameters []*v1alpha1.HelmFileParameter `protobuf:"bytes,6,rep,name=fileParameters,proto3" json:"fileParameters,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *HelmAppSpec) Reset() { *m = HelmAppSpec{} }
@ -691,6 +693,13 @@ func (m *HelmAppSpec) GetValues() string {
return ""
}
func (m *HelmAppSpec) GetFileParameters() []*v1alpha1.HelmFileParameter {
if m != nil {
return m.FileParameters
}
return nil
}
// KustomizeAppSpec contains kustomize images
type KustomizeAppSpec struct {
// images is a list of available images.
@ -1078,80 +1087,82 @@ func init() {
}
var fileDescriptor_dd8723cfcc820480 = []byte{
// 1160 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0x45,
0x14, 0xce, 0xda, 0xce, 0x8f, 0x8f, 0xfb, 0xe3, 0x4c, 0x4b, 0x59, 0x4c, 0x6a, 0x99, 0x15, 0xa0,
0x42, 0xe9, 0x9a, 0x84, 0x4a, 0x44, 0x45, 0xaa, 0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 0xff, 0xff,
0xf0, 0x7a, 0xca, 0x89, 0x27, 0x0f, 0x00, 0x00,
// 1185 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0xc5,
0x17, 0xcf, 0xda, 0xce, 0x87, 0x8f, 0xdb, 0xd4, 0x99, 0xf6, 0xdf, 0xff, 0x62, 0x12, 0xcb, 0xac,
0x00, 0x05, 0x4a, 0xd7, 0x24, 0x54, 0x22, 0x2a, 0x52, 0x25, 0x93, 0xa4, 0x29, 0x72, 0xa2, 0xa6,
0x1b, 0xa8, 0xc4, 0x87, 0x54, 0x4d, 0xd6, 0x93, 0xf5, 0xe0, 0xf5, 0xee, 0xb0, 0x33, 0x36, 0x4a,
0x5f, 0x00, 0xee, 0x11, 0x37, 0x5c, 0xf2, 0x08, 0xdc, 0x71, 0xcf, 0x05, 0x97, 0x3c, 0x02, 0xca,
0x1d, 0x3c, 0x05, 0x9a, 0xd9, 0xaf, 0xf1, 0xda, 0xc9, 0x8d, 0xfb, 0x71, 0x63, 0xcf, 0x9c, 0x39,
0x73, 0xce, 0x99, 0xdf, 0xf9, 0x9d, 0x33, 0xb3, 0xf0, 0x6e, 0x44, 0x58, 0xc8, 0x49, 0x34, 0x26,
0x51, 0x5b, 0x0d, 0xa9, 0x08, 0xa3, 0x73, 0x6d, 0x68, 0xb3, 0x28, 0x14, 0x21, 0x82, 0x5c, 0xd2,
0xb8, 0xe5, 0x85, 0x5e, 0xa8, 0xc4, 0x6d, 0x39, 0x8a, 0x35, 0x1a, 0xeb, 0x5e, 0x18, 0x7a, 0x3e,
0x69, 0x63, 0x46, 0xdb, 0x38, 0x08, 0x42, 0x81, 0x05, 0x0d, 0x03, 0x9e, 0xac, 0x5a, 0x83, 0x1d,
0x6e, 0xd3, 0x50, 0xad, 0xba, 0x61, 0x44, 0xda, 0xe3, 0xad, 0xb6, 0x47, 0x02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79,
0xa0, 0xbb, 0xb3, 0x9d, 0x5c, 0x72, 0xc9, 0x34, 0xba, 0x73, 0x11, 0x63, 0xd2, 0xa6, 0xb5, 0x80,
0x8e, 0xd5, 0x99, 0xf3, 0x04, 0xa3, 0x8d, 0x99, 0x99, 0xcc, 0xa0, 0x6b, 0x5e, 0xb6, 0x9c, 0x9e,
0xf3, 0xd3, 0x07, 0x7f, 0x5e, 0x34, 0x8d, 0xbf, 0x2e, 0x9a, 0xc6, 0xdf, 0x17, 0x4d, 0xe3, 0xab,
0x0f, 0xaf, 0xfa, 0xac, 0xd5, 0x3e, 0xbf, 0x31, 0xa3, 0xae, 0x4f, 0x49, 0x20, 0x4e, 0x97, 0xd4,
0x47, 0xec, 0x47, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x32, 0x19, 0x00, 0x6e, 0x9d, 0x0f, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1983,6 +1994,20 @@ func (m *HelmAppSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.FileParameters) > 0 {
for iNdEx := len(m.FileParameters) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.FileParameters[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintRepository(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
}
if len(m.Values) > 0 {
i -= len(m.Values)
copy(dAtA[i:], m.Values)
@ -2590,6 +2615,12 @@ func (m *HelmAppSpec) Size() (n int) {
if l > 0 {
n += 1 + l + sovRepository(uint64(l))
}
if len(m.FileParameters) > 0 {
for _, e := range m.FileParameters {
l = e.Size()
n += 1 + l + sovRepository(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@ -4615,6 +4646,40 @@ func (m *HelmAppSpec) Unmarshal(dAtA []byte) error {
}
m.Values = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FileParameters", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRepository
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthRepository
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthRepository
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FileParameters = append(m.FileParameters, &v1alpha1.HelmFileParameter{})
if err := m.FileParameters[len(m.FileParameters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipRepository(dAtA[iNdEx:])

View file

@ -234,6 +234,7 @@ func helmTemplate(appPath string, repoRoot string, env *v1alpha1.Env, q *apiclie
KubeVersion: text.SemVer(q.KubeVersion),
Set: map[string]string{},
SetString: map[string]string{},
SetFile: map[string]string{},
}
appHelm := q.ApplicationSource.Helm
@ -291,6 +292,9 @@ func helmTemplate(appPath string, repoRoot string, env *v1alpha1.Env, q *apiclie
templateOpts.Set[p.Name] = p.Value
}
}
for _, p := range appHelm.FileParameters {
templateOpts.SetFile[p.Name] = p.Path
}
}
if templateOpts.Name == "" {
templateOpts.Name = q.AppLabelValue
@ -301,6 +305,9 @@ func helmTemplate(appPath string, repoRoot string, env *v1alpha1.Env, q *apiclie
for i, j := range templateOpts.SetString {
templateOpts.SetString[i] = env.Envsubst(j)
}
for i, j := range templateOpts.SetFile {
templateOpts.SetFile[i] = env.Envsubst(j)
}
h, err := helm.NewHelmApp(appPath, getHelmRepos(q.Repos))
if err != nil {
return nil, err
@ -731,6 +738,12 @@ func (s *Service) GetAppDetails(ctx context.Context, q *apiclient.RepoServerAppD
Value: v,
})
}
for _, v := range fileParameters(q) {
res.Helm.FileParameters = append(res.Helm.FileParameters, &v1alpha1.HelmFileParameter{
Name: v.Name,
Path: v.Path, //filepath.Join(appPath, v.Path),
})
}
case v1alpha1.ApplicationSourceTypeKustomize:
res.Kustomize = &apiclient.KustomizeAppSpec{}
k := kustomize.NewKustomizeApp(appPath, q.Repo.GetGitCreds(), q.Repo.Repo)
@ -797,6 +810,13 @@ func valueFiles(q *apiclient.RepoServerAppDetailsQuery) []string {
return q.Source.Helm.ValueFiles
}
func fileParameters(q *apiclient.RepoServerAppDetailsQuery) []v1alpha1.HelmFileParameter {
if q.Source.Helm == nil {
return nil
}
return q.Source.Helm.FileParameters
}
func (s *Service) newClient(repo *v1alpha1.Repository) (git.Client, error) {
gitClient, err := s.newGitClient(repo.Repo, repo.GetGitCreds(), repo.IsInsecure(), repo.EnableLFS)
if err != nil {

View file

@ -84,6 +84,8 @@ message HelmAppSpec {
repeated github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.HelmParameter parameters = 4;
// the contents of values.yaml
string values = 5;
// helm file parameters
repeated github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.HelmFileParameter fileParameters = 6;
}
// KustomizeAppSpec contains kustomize images

View file

@ -3,6 +3,8 @@ package repository
import (
"context"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
@ -335,6 +337,68 @@ func TestGenerateHelmWithValuesDirectoryTraversalOutsideRepo(t *testing.T) {
assert.Error(t, err, "should be on or under current directory")
}
// The requested file parameter (`/tmp/external-secret.txt`) is outside the app path
// (`./util/helm/testdata/redis`), and outside the repo directory. It is used as a means
// of providing direct content to a helm chart via a specific key.
func TestGenerateHelmWithAbsoluteFileParameter(t *testing.T) {
service := newService("../..")
file, err := ioutil.TempFile("", "external-secret.txt")
assert.NoError(t, err)
externalSecretPath := file.Name()
defer func() { _ = os.RemoveAll(externalSecretPath) }()
expectedFileContent, err := ioutil.ReadFile("../../util/helm/testdata/external/external-secret.txt")
assert.NoError(t, err)
err = ioutil.WriteFile(externalSecretPath, expectedFileContent, 0644)
assert.NoError(t, err)
_, err = service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{
Repo: &argoappv1.Repository{},
AppLabelValue: "test",
ApplicationSource: &argoappv1.ApplicationSource{
Path: "./util/helm/testdata/redis",
Helm: &argoappv1.ApplicationSourceHelm{
ValueFiles: []string{"values-production.yaml"},
Values: `cluster: {slaveCount: 2}`,
FileParameters: []argoappv1.HelmFileParameter{
argoappv1.HelmFileParameter{
Name: "passwordContent",
Path: externalSecretPath,
},
},
},
},
})
assert.NoError(t, err)
}
// The requested file parameter (`../external/external-secret.txt`) is outside the app path
// (`./util/helm/testdata/redis`), however since the requested value is sill under the repo
// directory (`~/go/src/github.com/argoproj/argo-cd`), it is allowed. It is used as a means of
// providing direct content to a helm chart via a specific key.
func TestGenerateHelmWithFileParameter(t *testing.T) {
service := newService("../..")
_, err := service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{
Repo: &argoappv1.Repository{},
AppLabelValue: "test",
ApplicationSource: &argoappv1.ApplicationSource{
Path: "./util/helm/testdata/redis",
Helm: &argoappv1.ApplicationSourceHelm{
ValueFiles: []string{"values-production.yaml"},
Values: `cluster: {slaveCount: 2}`,
FileParameters: []argoappv1.HelmFileParameter{
argoappv1.HelmFileParameter{
Name: "passwordContent",
Path: "../external/external-secret.txt",
},
},
},
},
})
assert.NoError(t, err)
}
func TestGenerateNullList(t *testing.T) {
service := newService(".")

View file

@ -167,6 +167,18 @@ func TestHelmSetString(t *testing.T) {
})
}
func TestHelmSetFile(t *testing.T) {
Given(t).
Path("helm").
When().
Create().
AppSet("--helm-set-file", "foo=bar.yaml", "--helm-set-file", "foo=baz.yaml").
Then().
And(func(app *Application) {
assert.Equal(t, []HelmFileParameter{{Name: "foo", Path: "baz.yaml"}}, app.Spec.Source.Helm.FileParameters)
})
}
// ensure we can use envsubst in "set" variables
func TestHelmSetEnv(t *testing.T) {
Given(t).

1
test/e2e/testdata/helm/baz.yaml vendored Normal file
View file

@ -0,0 +1 @@
a: b

View file

@ -346,7 +346,11 @@ export const ApplicationCreatePanel = (props: {
if (details.type !== type) {
switch (type) {
case 'Helm':
details = {type, path: details.path, helm: {name: '', valueFiles: [], path: '', parameters: []}};
details = {
type,
path: details.path,
helm: {name: '', valueFiles: [], path: '', parameters: [], fileParameters: []}
};
break;
case 'Kustomize':
details = {type, path: details.path, kustomize: {path: ''}};

View file

@ -263,6 +263,29 @@ export const ApplicationParameters = (props: {
})
)
);
const fileParamsByName = new Map<string, models.HelmFileParameter>();
(props.details.helm.fileParameters || []).forEach(param => fileParamsByName.set(param.name, param));
const fileOverridesByName = new Map<string, number>();
((source.helm && source.helm.fileParameters) || []).forEach((override, i) => fileOverridesByName.set(override.name, i));
attributes = attributes.concat(
getParamsEditableItems(
app,
'PARAMETERS',
'spec.source.helm.parameters',
removedOverrides,
setRemovedOverrides,
distinct(fileParamsByName.keys(), fileOverridesByName.keys()).map(name => {
const param = fileParamsByName.get(name);
const original = (param && param.path) || '';
let overrideIndex = fileOverridesByName.get(name);
if (overrideIndex === undefined) {
overrideIndex = -1;
}
const value = (overrideIndex > -1 && source.helm.fileParameters[overrideIndex].path) || original;
return {overrideIndex, original, metadata: {name, value}};
})
)
);
} else if (props.details.type === 'Plugin') {
attributes.push({
title: 'NAME',

View file

@ -167,6 +167,7 @@ export interface ApplicationSourceHelm {
valueFiles: string[];
values?: string;
parameters: HelmParameter[];
fileParameters: HelmFileParameter[];
}
export interface ApplicationSourceKustomize {
@ -485,12 +486,18 @@ export interface HelmParameter {
value: string;
}
export interface HelmFileParameter {
name: string;
path: string;
}
export interface HelmAppSpec {
name: string;
path: string;
valueFiles: string[];
values?: string;
parameters: HelmParameter[];
fileParameters: HelmFileParameter[];
}
export interface KustomizeAppSpec {

View file

@ -162,6 +162,7 @@ type TemplateOpts struct {
KubeVersion string
Set map[string]string
SetString map[string]string
SetFile map[string]string
Values []string
}
@ -188,6 +189,9 @@ func (c *Cmd) template(chart string, opts *TemplateOpts) (string, error) {
for key, val := range opts.SetString {
args = append(args, "--set-string", key+"="+cleanSetParameters(val))
}
for key, val := range opts.SetFile {
args = append(args, "--set-file", key+"="+cleanSetParameters(val))
}
for _, val := range opts.Values {
args = append(args, "--values", val)
}

View file

@ -0,0 +1 @@
YW9maWUyOTRBUwo=

View file

@ -10,7 +10,9 @@ metadata:
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{- if .Values.password }}
{{- if .Values.passwordContent }}
redis-password: {{ .Values.passwordContent | quote }}
{{- else if .Values.password }}
redis-password: {{ .Values.password | b64enc | quote }}
{{- else }}
redis-password: {{ randAlphaNum 10 | b64enc | quote }}