mirror of https://github.com/helm/helm
Signed-off-by: Vlad Fratila <vfratila@adobe.com> Signed-off-by: Matheus Hunsche <matheus.hunsche@ifood.com.br>pull/8840/head
parent
1dbbc28c75
commit
9e69e66f98
@ -0,0 +1 @@
|
||||
out-of-chart-dir
|
@ -0,0 +1,6 @@
|
||||
NAME: virgil
|
||||
LAST DEPLOYED: Fri Sep 2 22:04:05 1977
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
# Source: configmap/templates/config-map.yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "RELEASE-NAME-"
|
||||
labels:
|
||||
# The "app.kubernetes.io/managed-by" label is used to track which tool
|
||||
# deployed a given chart. It is useful for admins who want to see what
|
||||
# releases a particular tool is responsible for.
|
||||
app.kubernetes.io/managed-by: "Helm"
|
||||
# The "app.kubernetes.io/instance" convention makes it easy to tie a release
|
||||
# to all of the Kubernetes resources that were created as part of that
|
||||
# release.
|
||||
app.kubernetes.io/instance: "RELEASE-NAME"
|
||||
app.kubernetes.io/version: 1.0
|
||||
# This makes it easy to audit chart usage.
|
||||
helm.sh/chart: "configmap-0.1.0"
|
||||
data:
|
||||
external.txt: out-of-chart-dir
|
@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: Deploy a basic Config Map from an external file
|
||||
home: https://helm.sh/helm
|
||||
name: configmap
|
||||
sources:
|
||||
- https://github.com/helm/helm
|
||||
version: 0.1.0
|
@ -0,0 +1 @@
|
||||
in-chart
|
@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "{{.Release.Name}}-{{.Values.Name}}"
|
||||
labels:
|
||||
# The "app.kubernetes.io/managed-by" label is used to track which tool
|
||||
# deployed a given chart. It is useful for admins who want to see what
|
||||
# releases a particular tool is responsible for.
|
||||
app.kubernetes.io/managed-by: {{.Release.Service | quote }}
|
||||
# The "app.kubernetes.io/instance" convention makes it easy to tie a release
|
||||
# to all of the Kubernetes resources that were created as part of that
|
||||
# release.
|
||||
app.kubernetes.io/instance: {{.Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
# This makes it easy to audit chart usage.
|
||||
helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
data:
|
||||
{{ (.Files.Glob .Values.external).AsConfig | indent 2 }}
|
@ -0,0 +1 @@
|
||||
external: external.txt
|
@ -0,0 +1,41 @@
|
||||
package files
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParseIntoString(t *testing.T) {
|
||||
need := require.New(t)
|
||||
is := assert.New(t)
|
||||
|
||||
dest := make(map[string]string)
|
||||
goodFlag := "foo.txt=../foo.txt"
|
||||
anotherFlag := " bar.txt=~/bar.txt, baz.txt=/path/to/baz.txt"
|
||||
|
||||
err := ParseIntoString(goodFlag, dest)
|
||||
need.NoError(err)
|
||||
|
||||
err = ParseIntoString(anotherFlag, dest)
|
||||
need.NoError(err)
|
||||
|
||||
is.Contains(dest, "foo.txt")
|
||||
is.Contains(dest, "bar.txt")
|
||||
is.Contains(dest, "baz.txt")
|
||||
|
||||
is.Equal(dest["foo.txt"], "../foo.txt", "foo.txt not mapped properly")
|
||||
is.Equal(dest["bar.txt"], "~/bar.txt", "bar.txt not mapped properly")
|
||||
is.Equal(dest["baz.txt"], "/path/to/baz.txt", "baz.txt not mapped properly")
|
||||
|
||||
overwriteFlag := "foo.txt=../new_foo.txt"
|
||||
err = ParseIntoString(overwriteFlag, dest)
|
||||
need.NoError(err)
|
||||
|
||||
is.Equal(dest["foo.txt"], "../new_foo.txt")
|
||||
|
||||
badFlag := "empty.txt"
|
||||
err = ParseIntoString(badFlag, dest)
|
||||
is.NotNil(err)
|
||||
}
|
Loading…
Reference in new issue