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
1c3bada6
Commit
1c3bada6
authored
Dec 20, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(helm): standardize debug output for releases
parent
934249aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
76 deletions
+77
-76
get.go
cmd/helm/get.go
+1
-45
install.go
cmd/helm/install.go
+1
-3
printer.go
cmd/helm/printer.go
+74
-0
upgrade.go
cmd/helm/upgrade.go
+1
-28
No files found.
cmd/helm/get.go
View file @
1c3bada6
...
@@ -19,14 +19,10 @@ package main
...
@@ -19,14 +19,10 @@ package main
import
(
import
(
"errors"
"errors"
"io"
"io"
"text/template"
"time"
"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"
)
)
var
getHelp
=
`
var
getHelp
=
`
...
@@ -83,53 +79,13 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
...
@@ -83,53 +79,13 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
return
cmd
return
cmd
}
}
var
getTemplate
=
`REVISION: {{.Release.Version}}
RELEASED: {{.ReleaseDate}}
CHART: {{.Release.Chart.Metadata.Name}}-{{.Release.Chart.Metadata.Version}}
USER-SUPPLIED VALUES:
{{.Release.Config.Raw}}
COMPUTED VALUES:
{{.ComputedValues}}
HOOKS:
{{- range .Release.Hooks }}
---
# {{.Name}}
{{.Manifest}}
{{- end }}
MANIFEST:
{{.Release.Manifest}}
`
// getCmd is the command that implements 'helm get'
// getCmd is the command that implements 'helm get'
func
(
g
*
getCmd
)
run
()
error
{
func
(
g
*
getCmd
)
run
()
error
{
res
,
err
:=
g
.
client
.
ReleaseContent
(
g
.
release
,
helm
.
ContentReleaseVersion
(
g
.
version
))
res
,
err
:=
g
.
client
.
ReleaseContent
(
g
.
release
,
helm
.
ContentReleaseVersion
(
g
.
version
))
if
err
!=
nil
{
if
err
!=
nil
{
return
prettyError
(
err
)
return
prettyError
(
err
)
}
}
return
printRelease
(
g
.
out
,
res
.
Release
)
cfg
,
err
:=
chartutil
.
CoalesceValues
(
res
.
Release
.
Chart
,
res
.
Release
.
Config
)
if
err
!=
nil
{
return
err
}
cfgStr
,
err
:=
cfg
.
YAML
()
if
err
!=
nil
{
return
err
}
data
:=
map
[
string
]
interface
{}{
"Release"
:
res
.
Release
,
"ComputedValues"
:
cfgStr
,
"ReleaseDate"
:
timeconv
.
Format
(
res
.
Release
.
Info
.
LastDeployed
,
time
.
ANSIC
),
}
return
tpl
(
getTemplate
,
data
,
g
.
out
)
}
func
tpl
(
t
string
,
vals
map
[
string
]
interface
{},
out
io
.
Writer
)
error
{
tt
,
err
:=
template
.
New
(
"_"
)
.
Parse
(
t
)
if
err
!=
nil
{
return
err
}
return
tt
.
Execute
(
out
,
vals
)
}
}
func
ensureHelmClient
(
h
helm
.
Interface
)
helm
.
Interface
{
func
ensureHelmClient
(
h
helm
.
Interface
)
helm
.
Interface
{
...
...
cmd/helm/install.go
View file @
1c3bada6
...
@@ -285,9 +285,7 @@ func (i *installCmd) printRelease(rel *release.Release) {
...
@@ -285,9 +285,7 @@ func (i *installCmd) printRelease(rel *release.Release) {
// TODO: Switch to text/template like everything else.
// TODO: Switch to text/template like everything else.
fmt
.
Fprintf
(
i
.
out
,
"NAME: %s
\n
"
,
rel
.
Name
)
fmt
.
Fprintf
(
i
.
out
,
"NAME: %s
\n
"
,
rel
.
Name
)
if
flagDebug
{
if
flagDebug
{
fmt
.
Fprintf
(
i
.
out
,
"TARGET NAMESPACE: %s
\n
"
,
rel
.
Namespace
)
printRelease
(
i
.
out
,
rel
)
fmt
.
Fprintf
(
i
.
out
,
"CHART: %s %s
\n
"
,
rel
.
Chart
.
Metadata
.
Name
,
rel
.
Chart
.
Metadata
.
Version
)
fmt
.
Fprintf
(
i
.
out
,
"MANIFEST: %s
\n
"
,
rel
.
Manifest
)
}
}
}
}
...
...
cmd/helm/printer.go
0 → 100644
View file @
1c3bada6
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
main
import
(
"io"
"text/template"
"time"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/timeconv"
)
var
printReleaseTemplate
=
`REVISION: {{.Release.Version}}
RELEASED: {{.ReleaseDate}}
CHART: {{.Release.Chart.Metadata.Name}}-{{.Release.Chart.Metadata.Version}}
USER-SUPPLIED VALUES:
{{.Release.Config.Raw}}
COMPUTED VALUES:
{{.ComputedValues}}
HOOKS:
{{- range .Release.Hooks }}
---
# {{.Name}}
{{.Manifest}}
{{- end }}
MANIFEST:
{{.Release.Manifest}}
`
func
printRelease
(
out
io
.
Writer
,
rel
*
release
.
Release
)
error
{
if
rel
==
nil
{
return
nil
}
cfg
,
err
:=
chartutil
.
CoalesceValues
(
rel
.
Chart
,
rel
.
Config
)
if
err
!=
nil
{
return
err
}
cfgStr
,
err
:=
cfg
.
YAML
()
if
err
!=
nil
{
return
err
}
data
:=
map
[
string
]
interface
{}{
"Release"
:
rel
,
"ComputedValues"
:
cfgStr
,
"ReleaseDate"
:
timeconv
.
Format
(
rel
.
Info
.
LastDeployed
,
time
.
ANSIC
),
}
return
tpl
(
printReleaseTemplate
,
data
,
out
)
}
func
tpl
(
t
string
,
vals
map
[
string
]
interface
{},
out
io
.
Writer
)
error
{
tt
,
err
:=
template
.
New
(
"_"
)
.
Parse
(
t
)
if
err
!=
nil
{
return
err
}
return
tt
.
Execute
(
out
,
vals
)
}
cmd/helm/upgrade.go
View file @
1c3bada6
...
@@ -21,17 +21,13 @@ import (
...
@@ -21,17 +21,13 @@ import (
"io"
"io"
"io/ioutil"
"io/ioutil"
"strings"
"strings"
"time"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"k8s.io/helm/cmd/helm/strvals"
"k8s.io/helm/cmd/helm/strvals"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/storage/driver"
"k8s.io/helm/pkg/storage/driver"
"k8s.io/helm/pkg/timeconv"
)
)
const
upgradeDesc
=
`
const
upgradeDesc
=
`
...
@@ -162,7 +158,7 @@ func (u *upgradeCmd) run() error {
...
@@ -162,7 +158,7 @@ func (u *upgradeCmd) run() error {
}
}
if
flagDebug
{
if
flagDebug
{
u
.
printRelease
(
resp
.
Release
)
printRelease
(
u
.
out
,
resp
.
Release
)
}
}
fmt
.
Fprintf
(
u
.
out
,
"Release %q has been upgraded. Happy Helming!
\n
"
,
u
.
release
)
fmt
.
Fprintf
(
u
.
out
,
"Release %q has been upgraded. Happy Helming!
\n
"
,
u
.
release
)
...
@@ -201,26 +197,3 @@ func (u *upgradeCmd) vals() ([]byte, error) {
...
@@ -201,26 +197,3 @@ func (u *upgradeCmd) vals() ([]byte, error) {
return
yaml
.
Marshal
(
base
)
return
yaml
.
Marshal
(
base
)
}
}
// printRelease prints info about a release.
func
(
u
*
upgradeCmd
)
printRelease
(
rel
*
release
.
Release
)
error
{
if
rel
==
nil
{
return
nil
}
cfg
,
err
:=
chartutil
.
CoalesceValues
(
rel
.
Chart
,
rel
.
Config
)
if
err
!=
nil
{
return
err
}
cfgStr
,
err
:=
cfg
.
YAML
()
if
err
!=
nil
{
return
err
}
data
:=
map
[
string
]
interface
{}{
"Release"
:
rel
,
"ComputedValues"
:
cfgStr
,
"ReleaseDate"
:
timeconv
.
Format
(
rel
.
Info
.
LastDeployed
,
time
.
ANSIC
),
}
return
tpl
(
getTemplate
,
data
,
u
.
out
)
}
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