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
5e654c03
Commit
5e654c03
authored
Jul 08, 2016
by
Michelle Noorali
Committed by
migmartri-michelleN
Jul 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(*): get helm & tiller chatting about upgrades
parent
e633b4b7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
11 deletions
+133
-11
upgrade.go
cmd/helm/upgrade.go
+36
-1
client.go
pkg/helm/client.go
+11
-7
compat.go
pkg/helm/compat.go
+82
-0
option.go
pkg/helm/option.go
+4
-3
No files found.
cmd/helm/upgrade.go
View file @
5e654c03
...
...
@@ -20,6 +20,8 @@ import (
"fmt"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm"
)
const
upgradeDesc
=
`
...
...
@@ -34,13 +36,46 @@ var upgradeCmd = &cobra.Command{
Short
:
"upgrade a release"
,
Long
:
upgradeDesc
,
RunE
:
runUpgrade
,
PersistentPreRunE
:
setupConnection
,
}
// upgrade flags
var
(
// upgradeDryRun performs a dry-run upgrade
upgradeDryRun
bool
// upgradeValues is the filename of supplied values.
upgradeValues
string
)
func
init
()
{
f
:=
upgradeCmd
.
Flags
()
f
.
StringVarP
(
&
upgradeValues
,
"values"
,
"f"
,
""
,
"path to a values YAML file"
)
f
.
BoolVar
(
&
upgradeDryRun
,
"dry-run"
,
false
,
"simulate an upgrade"
)
RootCommand
.
AddCommand
(
upgradeCmd
)
}
func
runUpgrade
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
fmt
.
Println
(
"Coming Soon"
)
if
err
:=
checkArgsLength
(
2
,
len
(
args
),
"release name, chart path"
);
err
!=
nil
{
return
err
}
chartPath
,
err
:=
locateChartPath
(
args
[
1
])
if
err
!=
nil
{
return
err
}
rawVals
,
err
:=
vals
(
upgradeValues
)
if
err
!=
nil
{
return
err
}
_
,
err
=
helm
.
UpdateRelease
(
args
[
0
],
chartPath
,
rawVals
,
upgradeDryRun
)
if
err
!=
nil
{
return
prettyError
(
err
)
}
fmt
.
Println
(
"Coming SOON to a Helm near YOU!"
)
return
nil
}
pkg/helm/client.go
View file @
5e654c03
...
...
@@ -17,10 +17,12 @@ limitations under the License.
package
helm
// import "k8s.io/helm/pkg/helm"
import
(
"os"
"google.golang.org/grpc"
"k8s.io/helm/pkg/chartutil"
rls
"k8s.io/helm/pkg/proto/hapi/services"
"os"
)
const
(
...
...
@@ -102,18 +104,20 @@ func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.Unins
return
h
.
opts
.
rpcDeleteRelease
(
rlsName
,
rls
.
NewReleaseServiceClient
(
c
),
opts
...
)
}
// UpdateRelease updates a release to a new/different chart.
//
// Note: there aren't currently any supported UpdateOptions, but they
// are kept in the API signature as a placeholder for future additions.
func
(
h
*
Client
)
UpdateRelease
(
rlsName
string
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
// UpdateRelease updates a release to a new/different chart
func
(
h
*
Client
)
UpdateRelease
(
rlsName
string
,
chStr
string
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
c
,
err
:=
grpc
.
Dial
(
h
.
opts
.
host
,
grpc
.
WithInsecure
())
if
err
!=
nil
{
return
nil
,
err
}
defer
c
.
Close
()
return
h
.
opts
.
rpcUpdateRelease
(
rlsName
,
rls
.
NewReleaseServiceClient
(
c
),
opts
...
)
chart
,
err
:=
chartutil
.
Load
(
chStr
)
if
err
!=
nil
{
return
nil
,
err
}
return
h
.
opts
.
rpcUpdateRelease
(
rlsName
,
chart
,
rls
.
NewReleaseServiceClient
(
c
),
opts
...
)
}
// ReleaseStatus returns the given release's status.
...
...
pkg/helm/compat.go
0 → 100644
View file @
5e654c03
/*
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
helm
import
(
rls
"k8s.io/helm/pkg/proto/hapi/services"
)
// These APIs are a temporary abstraction layer that captures the interaction between the current cmd/helm and old
// pkg/helm implementations. Post refactor the cmd/helm package will use the APIs exposed on helm.Client directly.
// Config is the base configuration
var
Config
struct
{
ServAddr
string
}
// ListReleases lists releases. DEPRECATED.
//
// Soon to be deprecated helm ListReleases API.
func
ListReleases
(
limit
int
,
offset
string
,
sort
rls
.
ListSort_SortBy
,
order
rls
.
ListSort_SortOrder
,
filter
string
)
(
*
rls
.
ListReleasesResponse
,
error
)
{
opts
:=
[]
ReleaseListOption
{
ReleaseListLimit
(
limit
),
ReleaseListOffset
(
offset
),
ReleaseListFilter
(
filter
),
ReleaseListSort
(
int32
(
sort
)),
ReleaseListOrder
(
int32
(
order
)),
}
return
NewClient
(
Host
(
Config
.
ServAddr
))
.
ListReleases
(
opts
...
)
}
// GetReleaseStatus gets a release status. DEPRECATED
//
// Soon to be deprecated helm GetReleaseStatus API.
func
GetReleaseStatus
(
rlsName
string
)
(
*
rls
.
GetReleaseStatusResponse
,
error
)
{
return
NewClient
(
Host
(
Config
.
ServAddr
))
.
ReleaseStatus
(
rlsName
)
}
// GetReleaseContent gets the content of a release.
// Soon to be deprecated helm GetReleaseContent API.
func
GetReleaseContent
(
rlsName
string
)
(
*
rls
.
GetReleaseContentResponse
,
error
)
{
return
NewClient
(
Host
(
Config
.
ServAddr
))
.
ReleaseContent
(
rlsName
)
}
// UpdateRelease updates a release.
// Soon to be deprecated helm UpdateRelease API.
func
UpdateRelease
(
rlsName
,
chStr
string
,
vals
[]
byte
,
dryRun
bool
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
return
NewClient
(
Host
(
Config
.
ServAddr
))
.
UpdateRelease
(
rlsName
,
chStr
)
}
// InstallRelease runs an install for a release.
// Soon to be deprecated helm InstallRelease API.
func
InstallRelease
(
vals
[]
byte
,
rlsName
,
chStr
string
,
dryRun
bool
)
(
*
rls
.
InstallReleaseResponse
,
error
)
{
client
:=
NewClient
(
Host
(
Config
.
ServAddr
))
if
dryRun
{
client
.
Option
(
DryRun
())
}
return
client
.
InstallRelease
(
chStr
,
ValueOverrides
(
vals
),
ReleaseName
(
rlsName
))
}
// UninstallRelease destroys an existing release.
// Soon to be deprecated helm UninstallRelease API.
func
UninstallRelease
(
rlsName
string
,
dryRun
bool
)
(
*
rls
.
UninstallReleaseResponse
,
error
)
{
client
:=
NewClient
(
Host
(
Config
.
ServAddr
))
if
dryRun
{
client
.
Option
(
DryRun
())
}
return
client
.
DeleteRelease
(
rlsName
)
}
pkg/helm/option.go
View file @
5e654c03
...
...
@@ -17,7 +17,6 @@ limitations under the License.
package
helm
import
(
"fmt"
"golang.org/x/net/context"
cpb
"k8s.io/helm/pkg/proto/hapi/chart"
rls
"k8s.io/helm/pkg/proto/hapi/services"
...
...
@@ -209,8 +208,10 @@ func (o *options) rpcDeleteRelease(rlsName string, rlc rls.ReleaseServiceClient,
}
// Executes tiller.UpdateRelease RPC.
func
(
o
*
options
)
rpcUpdateRelease
(
rlsName
string
,
rlc
rls
.
ReleaseServiceClient
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"helm: UpdateRelease: not implemented"
)
func
(
o
*
options
)
rpcUpdateRelease
(
rlsName
string
,
chr
*
cpb
.
Chart
,
rlc
rls
.
ReleaseServiceClient
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
//TODO: handle dryRun
return
rlc
.
UpdateRelease
(
context
.
TODO
(),
&
rls
.
UpdateReleaseRequest
{
Name
:
rlsName
,
Chart
:
chr
})
}
// Executes tiller.GetReleaseStatus RPC.
...
...
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