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
bcda0b87
Commit
bcda0b87
authored
Oct 05, 2016
by
Matt Butcher
Committed by
GitHub
Oct 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1278 from technosophos/feat/1227-reuse-values-on-upgrade
feat(tiller): re-use values during upgrade
parents
d2c8a81a
3e3312ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
release_server.go
cmd/tiller/release_server.go
+13
-0
release_server_test.go
cmd/tiller/release_server_test.go
+7
-1
chartfile.go
pkg/chartutil/chartfile.go
+3
-1
No files found.
cmd/tiller/release_server.go
View file @
bcda0b87
...
...
@@ -325,6 +325,16 @@ func (s *releaseServer) performUpdate(originalRelease, updatedRelease *release.R
return
res
,
nil
}
// reuseValues copies values from the current release to a new release if the new release does not have any values.
//
// If the request already has values, or if there are no values in the current release, this does nothing.
func
(
s
*
releaseServer
)
reuseValues
(
req
*
services
.
UpdateReleaseRequest
,
current
*
release
.
Release
)
{
if
(
req
.
Values
==
nil
||
req
.
Values
.
Raw
==
""
)
&&
current
.
Config
!=
nil
&&
current
.
Config
.
Raw
!=
""
{
log
.
Printf
(
"Copying values from %s (v%d) to new release."
,
current
.
Name
,
current
.
Version
)
req
.
Values
=
current
.
Config
}
}
// prepareUpdate builds an updated release for an update operation.
func
(
s
*
releaseServer
)
prepareUpdate
(
req
*
services
.
UpdateReleaseRequest
)
(
*
release
.
Release
,
*
release
.
Release
,
error
)
{
if
req
.
Name
==
""
{
...
...
@@ -341,6 +351,9 @@ func (s *releaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
return
nil
,
nil
,
err
}
// If new values were not supplied in the upgrade, re-use the existing values.
s
.
reuseValues
(
req
,
currentRelease
)
ts
:=
timeconv
.
Now
()
options
:=
chartutil
.
ReleaseOptions
{
Name
:
req
.
Name
,
...
...
cmd/tiller/release_server_test.go
View file @
bcda0b87
...
...
@@ -110,7 +110,7 @@ func namedReleaseStub(name string, status release.Status_Code) *release.Release
Status
:
&
release
.
Status
{
Code
:
status
},
},
Chart
:
chartStub
(),
Config
:
&
chart
.
Config
{
Raw
:
`name
= "value"
`
},
Config
:
&
chart
.
Config
{
Raw
:
`name
: value
`
},
Version
:
1
,
Hooks
:
[]
*
release
.
Hook
{
{
...
...
@@ -568,6 +568,12 @@ func TestUpdateRelease(t *testing.T) {
t
.
Errorf
(
"No manifest returned: %v"
,
res
.
Release
)
}
if
res
.
Release
.
Config
==
nil
{
t
.
Errorf
(
"Got release without config: %#v"
,
res
.
Release
)
}
else
if
res
.
Release
.
Config
.
Raw
!=
rel
.
Config
.
Raw
{
t
.
Errorf
(
"Expected release values %q, got %q"
,
rel
.
Config
.
Raw
,
res
.
Release
.
Config
.
Raw
)
}
if
len
(
updated
.
Manifest
)
==
0
{
t
.
Errorf
(
"Expected manifest in %v"
,
res
)
}
...
...
pkg/chartutil/chartfile.go
View file @
bcda0b87
...
...
@@ -24,7 +24,9 @@ import (
"k8s.io/helm/pkg/proto/hapi/chart"
)
// APIVersionV1 is the API version number for version 1.
// ApiVersionV1 is the API version number for version 1.
//
// This is ApiVersionV1 instead of APIVersionV1 to match the protobuf-generated name.
const
ApiVersionV1
=
"v1"
// UnmarshalChartfile takes raw Chart.yaml data and unmarshals it.
...
...
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