Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
d4c4d222
Unverified
Commit
d4c4d222
authored
May 24, 2018
by
Matthew Fisher
Committed by
GitHub
May 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4105 from balboah/feature/template_release_isinstall
Add helm template --is-upgrade
parents
086139ab
93e8f0a6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
13 deletions
+34
-13
template.go
cmd/helm/template.go
+16
-12
template_test.go
cmd/helm/template_test.go
+14
-0
helm_template.md
docs/helm/helm_template.md
+2
-1
service.yaml
...l/testdata/subpop/charts/subchart1/templates/service.yaml
+2
-0
No files found.
cmd/helm/template.go
View file @
d4c4d222
...
@@ -63,18 +63,19 @@ To render just one template in a chart, use '-x':
...
@@ -63,18 +63,19 @@ To render just one template in a chart, use '-x':
`
`
type
templateCmd
struct
{
type
templateCmd
struct
{
namespace
string
namespace
string
valueFiles
valueFiles
valueFiles
valueFiles
chartPath
string
chartPath
string
out
io
.
Writer
out
io
.
Writer
values
[]
string
values
[]
string
stringValues
[]
string
stringValues
[]
string
nameTemplate
string
nameTemplate
string
showNotes
bool
showNotes
bool
releaseName
string
releaseName
string
renderFiles
[]
string
releaseIsUpgrade
bool
kubeVersion
string
renderFiles
[]
string
outputDir
string
kubeVersion
string
outputDir
string
}
}
func
newTemplateCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
func
newTemplateCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
...
@@ -93,6 +94,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command {
...
@@ -93,6 +94,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command {
f
:=
cmd
.
Flags
()
f
:=
cmd
.
Flags
()
f
.
BoolVar
(
&
t
.
showNotes
,
"notes"
,
false
,
"show the computed NOTES.txt file as well"
)
f
.
BoolVar
(
&
t
.
showNotes
,
"notes"
,
false
,
"show the computed NOTES.txt file as well"
)
f
.
StringVarP
(
&
t
.
releaseName
,
"name"
,
"n"
,
"RELEASE-NAME"
,
"release name"
)
f
.
StringVarP
(
&
t
.
releaseName
,
"name"
,
"n"
,
"RELEASE-NAME"
,
"release name"
)
f
.
BoolVar
(
&
t
.
releaseIsUpgrade
,
"is-upgrade"
,
false
,
"set .Release.IsUpgrade instead of .Release.IsInstall"
)
f
.
StringArrayVarP
(
&
t
.
renderFiles
,
"execute"
,
"x"
,
[]
string
{},
"only execute the given templates"
)
f
.
StringArrayVarP
(
&
t
.
renderFiles
,
"execute"
,
"x"
,
[]
string
{},
"only execute the given templates"
)
f
.
VarP
(
&
t
.
valueFiles
,
"values"
,
"f"
,
"specify values in a YAML file (can specify multiple)"
)
f
.
VarP
(
&
t
.
valueFiles
,
"values"
,
"f"
,
"specify values in a YAML file (can specify multiple)"
)
f
.
StringVar
(
&
t
.
namespace
,
"namespace"
,
""
,
"namespace to install the release into"
)
f
.
StringVar
(
&
t
.
namespace
,
"namespace"
,
""
,
"namespace to install the release into"
)
...
@@ -159,6 +161,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
...
@@ -159,6 +161,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
}
}
options
:=
chartutil
.
ReleaseOptions
{
options
:=
chartutil
.
ReleaseOptions
{
Name
:
t
.
releaseName
,
Name
:
t
.
releaseName
,
IsInstall
:
!
t
.
releaseIsUpgrade
,
IsUpgrade
:
t
.
releaseIsUpgrade
,
Time
:
timeconv
.
Now
(),
Time
:
timeconv
.
Now
(),
Namespace
:
t
.
namespace
,
Namespace
:
t
.
namespace
,
}
}
...
...
cmd/helm/template_test.go
View file @
d4c4d222
...
@@ -107,6 +107,20 @@ func TestTemplateCmd(t *testing.T) {
...
@@ -107,6 +107,20 @@ func TestTemplateCmd(t *testing.T) {
expectKey
:
"subchart1/templates/service.yaml"
,
expectKey
:
"subchart1/templates/service.yaml"
,
expectValue
:
"release-name:
\"
test
\"
"
,
expectValue
:
"release-name:
\"
test
\"
"
,
},
},
{
name
:
"check_release_is_install"
,
desc
:
"verify --is-upgrade toggles .Release.IsInstall"
,
args
:
[]
string
{
subchart1ChartPath
,
"--is-upgrade=false"
},
expectKey
:
"subchart1/templates/service.yaml"
,
expectValue
:
"release-is-install:
\"
true
\"
"
,
},
{
name
:
"check_release_is_upgrade"
,
desc
:
"verify --is-upgrade toggles .Release.IsUpgrade"
,
args
:
[]
string
{
subchart1ChartPath
,
"--is-upgrade"
,
"true"
},
expectKey
:
"subchart1/templates/service.yaml"
,
expectValue
:
"release-is-upgrade:
\"
true
\"
"
,
},
{
{
name
:
"check_notes"
,
name
:
"check_notes"
,
desc
:
"verify --notes shows notes"
,
desc
:
"verify --notes shows notes"
,
...
...
docs/helm/helm_template.md
View file @
d4c4d222
...
@@ -26,6 +26,7 @@ helm template [flags] CHART
...
@@ -26,6 +26,7 @@ helm template [flags] CHART
```
```
-x, --execute stringArray only execute the given templates
-x, --execute stringArray only execute the given templates
--is-upgrade set .Release.IsUpgrade instead of .Release.IsInstall
--kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9")
--kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9")
-n, --name string release name (default "RELEASE-NAME")
-n, --name string release name (default "RELEASE-NAME")
--name-template string specify template used to name the release
--name-template string specify template used to name the release
...
@@ -51,4 +52,4 @@ helm template [flags] CHART
...
@@ -51,4 +52,4 @@ helm template [flags] CHART
### SEE ALSO
### SEE ALSO
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on
9-Mar
-2018
###### Auto generated by spf13/cobra on
22-May
-2018
pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml
View file @
d4c4d222
...
@@ -6,6 +6,8 @@ metadata:
...
@@ -6,6 +6,8 @@ metadata:
chart
:
"
{{
.Chart.Name
}}-{{
.Chart.Version
}}"
chart
:
"
{{
.Chart.Name
}}-{{
.Chart.Version
}}"
namespace
:
"
{{
.Release.Namespace
}}"
namespace
:
"
{{
.Release.Namespace
}}"
release-name
:
"
{{
.Release.Name
}}"
release-name
:
"
{{
.Release.Name
}}"
release-is-upgrade
:
"
{{
.Release.IsUpgrade
}}"
release-is-install
:
"
{{
.Release.IsInstall
}}"
kube-version/major
:
"
{{
.Capabilities.KubeVersion.Major
}}"
kube-version/major
:
"
{{
.Capabilities.KubeVersion.Major
}}"
kube-version/minor
:
"
{{
.Capabilities.KubeVersion.Minor
}}"
kube-version/minor
:
"
{{
.Capabilities.KubeVersion.Minor
}}"
kube-version/gitversion
:
"
v{{
.Capabilities.KubeVersion.Major
}}.{{
.Capabilities.KubeVersion.Minor
}}.0"
kube-version/gitversion
:
"
v{{
.Capabilities.KubeVersion.Major
}}.{{
.Capabilities.KubeVersion.Minor
}}.0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment