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
cad1936f
Commit
cad1936f
authored
Jun 20, 2016
by
Matt Butcher
Committed by
GitHub
Jun 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #842 from technosophos/feat/get-all-values
feat(helm): add 'helm get values --all' for all values
parents
e36647d1
f30ff915
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
get.go
cmd/helm/get.go
+35
-2
values.go
pkg/chartutil/values.go
+6
-1
No files found.
cmd/helm/get.go
View file @
cad1936f
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/timeconv"
"k8s.io/helm/pkg/timeconv"
)
)
...
@@ -44,6 +45,8 @@ charts, those resources will also be included in the manifest.
...
@@ -44,6 +45,8 @@ charts, those resources will also be included in the manifest.
// If it is blank, output is sent to os.Stdout.
// If it is blank, output is sent to os.Stdout.
var
getOut
=
""
var
getOut
=
""
var
allValues
=
false
var
errReleaseRequired
=
errors
.
New
(
"release name is required"
)
var
errReleaseRequired
=
errors
.
New
(
"release name is required"
)
var
getCommand
=
&
cobra
.
Command
{
var
getCommand
=
&
cobra
.
Command
{
...
@@ -69,7 +72,12 @@ var getManifestCommand = &cobra.Command{
...
@@ -69,7 +72,12 @@ var getManifestCommand = &cobra.Command{
}
}
func
init
()
{
func
init
()
{
// 'get' command flags.
getCommand
.
PersistentFlags
()
.
StringVarP
(
&
getOut
,
"file"
,
"f"
,
""
,
"output file"
)
getCommand
.
PersistentFlags
()
.
StringVarP
(
&
getOut
,
"file"
,
"f"
,
""
,
"output file"
)
// 'get values' flags.
getValuesCommand
.
PersistentFlags
()
.
BoolVarP
(
&
allValues
,
"all"
,
"a"
,
false
,
"dump all (computed) values"
)
getCommand
.
AddCommand
(
getValuesCommand
)
getCommand
.
AddCommand
(
getValuesCommand
)
getCommand
.
AddCommand
(
getManifestCommand
)
getCommand
.
AddCommand
(
getManifestCommand
)
RootCommand
.
AddCommand
(
getCommand
)
RootCommand
.
AddCommand
(
getCommand
)
...
@@ -86,10 +94,21 @@ func getCmd(cmd *cobra.Command, args []string) error {
...
@@ -86,10 +94,21 @@ func getCmd(cmd *cobra.Command, args []string) error {
return
prettyError
(
err
)
return
prettyError
(
err
)
}
}
cfg
,
err
:=
chartutil
.
CoalesceValues
(
res
.
Release
.
Chart
,
res
.
Release
.
Config
,
nil
)
if
err
!=
nil
{
return
err
}
cfgStr
,
err
:=
cfg
.
YAML
()
if
err
!=
nil
{
return
err
}
fmt
.
Printf
(
"CHART: %s-%s
\n
"
,
res
.
Release
.
Chart
.
Metadata
.
Name
,
res
.
Release
.
Chart
.
Metadata
.
Version
)
fmt
.
Printf
(
"CHART: %s-%s
\n
"
,
res
.
Release
.
Chart
.
Metadata
.
Name
,
res
.
Release
.
Chart
.
Metadata
.
Version
)
fmt
.
Printf
(
"RELEASED: %s
\n
"
,
timeconv
.
Format
(
res
.
Release
.
Info
.
LastDeployed
,
time
.
ANSIC
))
fmt
.
Printf
(
"RELEASED: %s
\n
"
,
timeconv
.
Format
(
res
.
Release
.
Info
.
LastDeployed
,
time
.
ANSIC
))
fmt
.
Println
(
"
CONFIG
:"
)
fmt
.
Println
(
"
USER-SUPPLIED VALUES
:"
)
fmt
.
Println
(
res
.
Release
.
Config
.
Raw
)
fmt
.
Println
(
res
.
Release
.
Config
.
Raw
)
fmt
.
Println
(
"COMPUTED VALUES:"
)
fmt
.
Println
(
cfgStr
)
fmt
.
Println
(
"MANIFEST:"
)
fmt
.
Println
(
"MANIFEST:"
)
fmt
.
Println
(
res
.
Release
.
Manifest
)
fmt
.
Println
(
res
.
Release
.
Manifest
)
return
nil
return
nil
...
@@ -105,7 +124,21 @@ func getValues(cmd *cobra.Command, args []string) error {
...
@@ -105,7 +124,21 @@ func getValues(cmd *cobra.Command, args []string) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
prettyError
(
err
)
return
prettyError
(
err
)
}
}
return
getToFile
(
res
.
Release
.
Config
)
// If the user wants all values, compute the values and return.
if
allValues
{
cfg
,
err
:=
chartutil
.
CoalesceValues
(
res
.
Release
.
Chart
,
res
.
Release
.
Config
,
nil
)
if
err
!=
nil
{
return
err
}
cfgStr
,
err
:=
cfg
.
YAML
()
if
err
!=
nil
{
return
err
}
return
getToFile
(
cfgStr
)
}
return
getToFile
(
res
.
Release
.
Config
.
Raw
)
}
}
// getManifest implements 'helm get manifest'
// getManifest implements 'helm get manifest'
...
...
pkg/chartutil/values.go
View file @
cad1936f
...
@@ -20,6 +20,12 @@ const GlobalKey = "global"
...
@@ -20,6 +20,12 @@ const GlobalKey = "global"
// Values represents a collection of chart values.
// Values represents a collection of chart values.
type
Values
map
[
string
]
interface
{}
type
Values
map
[
string
]
interface
{}
// YAML encodes the Values into a YAML string.
func
(
v
Values
)
YAML
()
(
string
,
error
)
{
b
,
err
:=
yaml
.
Marshal
(
v
)
return
string
(
b
),
err
}
// Table gets a table (YAML subsection) from a Values object.
// Table gets a table (YAML subsection) from a Values object.
//
//
// The table is returned as a Values.
// The table is returned as a Values.
...
@@ -113,7 +119,6 @@ func CoalesceValues(chrt *chart.Chart, vals *chart.Config, overrides map[string]
...
@@ -113,7 +119,6 @@ func CoalesceValues(chrt *chart.Chart, vals *chart.Config, overrides map[string]
// Parse values if not nil. We merge these at the top level because
// Parse values if not nil. We merge these at the top level because
// the passed-in values are in the same namespace as the parent chart.
// the passed-in values are in the same namespace as the parent chart.
if
vals
!=
nil
{
if
vals
!=
nil
{
log
.
Printf
(
"Merging overrides into config."
)
evals
,
err
:=
ReadValues
([]
byte
(
vals
.
Raw
))
evals
,
err
:=
ReadValues
([]
byte
(
vals
.
Raw
))
if
err
!=
nil
{
if
err
!=
nil
{
return
cvals
,
err
return
cvals
,
err
...
...
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